/** * Transfer data between the Category DataObject and panel controls. * * @param toDataObject, determines the direction of the transfer. */ public void transferData(boolean toDataObject) { // must have a DataObject Feature dobj = (Feature) getDataObject(); Util.argCheckNull(dobj); if (toDataObject) { // to the Category DataObject // skip as Feature is a readonly object } else { // to the controls _txtName.setText(dobj.getName()); _txtDescription.setText(dobj.getDescription()); } }
/** * Init the panel's controls. Feature is a read-only Dataobject so the text fields are disabled. */ private void initGroupPropertiesPanelControls() { // set layout setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); // Group Name control WslLabel lbl = new WslLabel(LABEL_NAME.getText()); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.insets.left = GuiConst.DEFAULT_INSET; gbc.insets.top = GuiConst.DEFAULT_INSET; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 0.2; gbc.gridx = 0; gbc.gridy = 0; add(lbl, gbc); gbc.gridx = 1; gbc.weightx = 0.8; gbc.insets.right = GuiConst.DEFAULT_INSET; _txtName.setEnabled(false); add(_txtName, gbc); addMandatory(MANDATORY_GROUP_NAME.getText(), _txtName); // Group description control lbl = new WslLabel(LABEL_DESCRIPTION.getText()); gbc.insets.right = 0; gbc.gridx = 0; gbc.gridy = 1; add(lbl, gbc); gbc.gridx = 1; gbc.insets.right = GuiConst.DEFAULT_INSET; gbc.insets.bottom = GuiConst.DEFAULT_INSET; gbc.weighty = 1; gbc.gridheight = GridBagConstraints.REMAINDER; _txtDescription.setEnabled(false); add(_txtDescription, gbc); }