private void CloseBtnActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_CloseBtnActionPerformed modelController.changeNameOfProperty(node, this.NameTxt.getText()); modelController.changeDescriptionOfProperty(node, this.DescriptionArea.getText()); modelController.changeLowervalueOfProperty( node, Integer.parseInt(this.lowervalueTxt.getText())); modelController.changeHighervalueOfProperty( node, Integer.parseInt(this.highervalueTxt.getText())); if (propertyTypeComboBox.getSelectedItem() != null) modelController.changeTypeOfProperty(node, propertyTypeComboBox.getSelectedItem().toString()); this.dispose(); } // GEN-LAST:event_CloseBtnActionPerformed
/** Creates new form elementDialog */ public PropertyElementDialog( java.awt.Frame parent, boolean modal, Property node, ModelController modelController) { super(parent, modal); initComponents(); this.node = node; this.NameTxt.setText(node.getName()); this.DescriptionArea.setText(node.getDescription()); this.lowervalueTxt.setText(Integer.toString(node.getLowervalue())); this.highervalueTxt.setText(Integer.toString(node.getHighervalue())); this.modelController = modelController; // Initialize the combobox containing all typenames (from the classes). boolean itemWasSelected = false; ArrayList<String> typeNames = modelController.getTypeNames(); for (int i = 0; i < typeNames.size(); i++) { propertyTypeComboBox.addItem(typeNames.get(i)); if (typeNames.get(i).equals(node.getType())) { propertyTypeComboBox.setSelectedItem(node.getType()); itemWasSelected = true; } } if (!itemWasSelected) propertyTypeComboBox.setSelectedIndex(-1); }