1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 package com.sun.star.wizards.form; 24 25 import com.sun.star.awt.XRadioButton; 26 import com.sun.star.awt.XTextComponent; 27 import com.sun.star.wizards.common.Desktop; 28 import com.sun.star.wizards.common.PropertyNames; 29 import com.sun.star.wizards.ui.*; 30 31 /** 32 * @author Administrator 33 * 34 * To change the template for this generated type comment go to 35 * Window>Preferences>Java>Code Generation>Code and Comments 36 */ 37 public class Finalizer 38 { 39 40 WizardDialog CurUnoDialog; 41 short curtabindex; 42 XRadioButton optModifyForm; 43 XRadioButton optWorkWithForm; 44 XTextComponent txtFormName; 45 FormDocument oFormDocument; 46 Finalizer(WizardDialog _CurUnoDialog)47 public Finalizer(WizardDialog _CurUnoDialog) 48 { 49 this.CurUnoDialog = _CurUnoDialog; 50 curtabindex = (short) (FormWizard.SOSTORE_PAGE * 100); 51 52 String slblFormName = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 50); 53 String slblProceed = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 51); 54 String sWorkWithForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 52); 55 String sModifyForm = CurUnoDialog.m_oResource.getResText(UIConsts.RID_FORM + 53); 56 CurUnoDialog.insertLabel("lblFormName", 57 new String[] 58 { 59 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 60 }, 61 new Object[] 62 { 63 UIConsts.INTEGERS[8], slblFormName, 97, 25, UIConsts.INTEGERS[8], new Short(curtabindex++), 111 64 }); 65 txtFormName = CurUnoDialog.insertTextField("txtFormName", "toggleFinishButton", this, 66 new String[] 67 { 68 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, "Text", PropertyNames.PROPERTY_WIDTH 69 }, 70 new Object[] 71 { 72 UIConsts.INTEGER_12, "HID:WIZARDS_HID_DLGFORM_TXTPATH", 97, 35, UIConsts.INTEGERS[8], new Short((short) 82), PropertyNames.EMPTY_STRING, 185 73 }); 74 CurUnoDialog.insertLabel("lblProceed", 75 new String[] 76 { 77 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 78 }, 79 new Object[] 80 { 81 UIConsts.INTEGERS[8], slblProceed, 97, 62, UIConsts.INTEGERS[8], new Short(curtabindex++), 185 82 }); 83 CurUnoDialog.insertRadioButton("optWorkWithForm", null, 84 new String[] 85 { 86 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STATE, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 87 }, 88 new Object[] 89 { 90 UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTWORKWITHFORM", sWorkWithForm, 101, 77, new Short((short) 1), UIConsts.INTEGERS[8], new Short(curtabindex++), 107 91 }); 92 optModifyForm = CurUnoDialog.insertRadioButton("optModifyForm", null, 93 new String[] 94 { 95 PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HELPURL, PropertyNames.PROPERTY_LABEL, PropertyNames.PROPERTY_POSITION_X, PropertyNames.PROPERTY_POSITION_Y, PropertyNames.PROPERTY_STEP, PropertyNames.PROPERTY_TABINDEX, PropertyNames.PROPERTY_WIDTH 96 }, 97 new Object[] 98 { 99 UIConsts.INTEGERS[8], "HID:WIZARDS_HID_DLGFORM_OPTMODIFYFORM", sModifyForm, 101, 89, UIConsts.INTEGERS[8], new Short(curtabindex++), 107 100 }); 101 } 102 initialize(String _formname, FormDocument _oFormDocument)103 public void initialize(String _formname, FormDocument _oFormDocument) 104 { 105 if (oFormDocument == null) 106 { 107 oFormDocument = _oFormDocument; 108 } 109 if (txtFormName.getText().length() == 0) 110 { 111 txtFormName.setText(Desktop.getUniqueName(_oFormDocument.oMainFormDBMetaData.getFormDocuments(), _formname)); 112 } 113 } 114 toggleFinishButton()115 public void toggleFinishButton() 116 { 117 CurUnoDialog.enableFinishButton(txtFormName.getText().length() > 0); 118 } 119 getName()120 public String getName() 121 { 122 return txtFormName.getText(); 123 } 124 getOpenForEditing()125 public boolean getOpenForEditing() 126 { 127 return optModifyForm.getState(); 128 } 129 finish()130 public boolean finish() 131 { 132 // if (!oFormDocument.oMainFormDBMetaData.hasFormDocumentByName(sFormName)){ 133 return oFormDocument.oMainFormDBMetaData.storeDatabaseDocumentToTempPath(this.oFormDocument.xComponent, getName()); 134 // } 135 } 136 } 137