List of usage examples for com.jgoodies.forms.layout CellConstraints TOP
Alignment TOP
To view the source code for com.jgoodies.forms.layout CellConstraints TOP.
Click Source Link
From source file:ai.aitia.meme.paramsweep.gui.Page_LoadModel.java
License:Open Source License
private void layoutGUI() { buttonsPanel = FormsUtils.build("p ~ p ~ p ~ p ~ p:g", "0123", loadSettingsButton, resourcesButton, preferencesButton, aboutButton).getPanel(); content = FormsUtils.build("p ~ p:g ~ p", "[DialogBorder]012 p||" + "345||" + "678||" + "_79||" + "_7A||" + "_7B||" + "_7C||" + "_7D||" + "_7_ p:g||" + "EF_ p:g(0.2)|" + "_F_||" + "GHI p||||" + "_J_|" + "_K_|" + "_L_|" + "_M_|" + "NNN", modelDirectoryLabel, modelDirectoryField, dBrowseButton, modelFileLabel, modelFileField, browseButton, classPathLabel, classPathScr, addButton, removeButton, topButton, moveUpButton, moveDownButton, bottomButton, "Description (optional): ", CellConstraints.TOP, descriptionScr, parameterFileLabel, parameterFileField, pBrowseButton, "<html><b>Note: Use 'Parameter file (optional)' field only if you have an existing parameter </b></html>", "<html><b> file. If the selected file is appropriate the wizard initializes the batch runs with </b></html>", "<html><b> its contents.</b></html>", " ", buttonsPanel).getPanel(); dBrowseButton.setActionCommand("BROWSE_DIR"); browseButton.setActionCommand("BROWSE_MODEL"); pBrowseButton.setActionCommand("BROWSE_PARAM"); modelDirectoryField.setActionCommand("DIR_FIELD"); modelFileField.setActionCommand("MODEL_FIELD"); modelDirectoryField.setPreferredSize(new Dimension(200, 20)); modelFileField.setPreferredSize(new Dimension(200, 20)); classPathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); classPathList.setCellRenderer(new ClassPathListRenderer()); classPathList.setBackground(modelFileField.getBackground()); classPathScr.setPreferredSize(new Dimension(200, 50)); addButton.setActionCommand("ADD_CP"); removeButton.setActionCommand("REMOVE_CP"); moveUpButton.setActionCommand("UP"); moveDownButton.setActionCommand("DOWN"); topButton.setActionCommand("TOP"); bottomButton.setActionCommand("BOTTOM"); descriptionArea.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); loadSettingsButton.setActionCommand("SETTINGS"); resourcesButton.setActionCommand("RESOURCES"); preferencesButton.setActionCommand("PREFERENCES"); aboutButton.setActionCommand("ABOUT"); aboutButton.setVisible(!ParameterSweepWizard.isFromMEME()); dBrowseButton.setName("btn_wizard_modelselection_dirbrowse"); browseButton.setName("btn_wizard_modelselection_browse"); pBrowseButton.setName("btn_wizard_modelselection_parambrowse"); modelDirectoryField.setName("fld_wizard_modelselection_moddirfld"); modelFileField.setName("fld_wizard_modelselection_modfilefld"); addButton.setName("btn_wizard_modelselection_add"); removeButton.setName("btn_wizard_modelselection_remove"); moveUpButton.setName("btn_wizard_modelselection_up"); moveDownButton.setName("btn_wizard_modelselection_down"); topButton.setName("btn_wizard_modelselection_top"); bottomButton.setName("btn_wizard_modelselection_bottom"); loadSettingsButton.setName("btn_wizard_modelselection_load"); resourcesButton.setName("btn_wizard_modelselection_resources"); preferencesButton.setName("btn_wizard_modelselection_preferences"); aboutButton.setName("btn_wizard_modelselection_about"); classPathList.setName("lst_wizard_modelselection_classpath"); ai.aitia.meme.utils.GUIUtils.addActionListener(this, browseButton, pBrowseButton, addButton, removeButton, modelFileField, moveUpButton, moveDownButton, loadSettingsButton, resourcesButton, preferencesButton, aboutButton, dBrowseButton, topButton, bottomButton); this.setLayout(new BorderLayout()); final JScrollPane sp = new JScrollPane(content); this.add(sp, BorderLayout.CENTER); }
From source file:ai.aitia.meme.paramsweep.gui.Page_Parameters.java
License:Open Source License
private void layoutGUI() { leftTop = FormsUtils.build("p ' p:g", "[DialogBorder]00|" + "11||" + "23||" + "44||" + "5_|" + "6_|" + "7_", text1, text2, runsLabel, runsField, new Separator("Define parameter space"), constDef, listDef, incrDef).getPanel();/*from ww w . j a va2s . co m*/ constDefPanel = FormsUtils.build("p ~ p:g p", "[DialogBorder]012 p", "Constant value: ", CellConstraints.TOP, constDefField, browseFileButton).getPanel(); enumConstPanel = FormsUtils .build("p ~ p:g", "[DialogBorder]01 p", "Constant value: ", CellConstraints.TOP, enumComboBox) .getPanel(); listDefPanel = FormsUtils.build("p ~ p:g", "[DialogBorder]01|" + "_1 f:p:g||" + "_2 p", "Value list: ", listDefScr, "(Separate values with spaces!)").getPanel(); incrDefPanel = FormsUtils.build("p ~ p:g", "[DialogBorder]01||" + "23||" + "45", "Start value: ", incrStartValueField, "End value: ", incrEndValueField, "Step: ", incrStepField).getPanel(); enumListPanel = FormsUtils.build("p ~ p", "[DialogBorder]01||" + "23||", leftEnumValuePane, RightEnumValuePane, addEnumButton, removeEnumButton).getPanel(); constDefPanel.setName("CONST"); listDefPanel.setName("LIST"); incrDefPanel.setName("INCREMENT"); enumListPanel.setName("ENUMLIST"); enumConstPanel.setName("ENUMCONST"); leftMiddle.add(constDefPanel, constDefPanel.getName()); leftMiddle.add(listDefPanel, listDefPanel.getName()); leftMiddle.add(incrDefPanel, incrDefPanel.getName()); leftMiddle.add(enumListPanel, enumListPanel.getName()); leftMiddle.add(enumConstPanel, enumConstPanel.getName()); leftBottom = FormsUtils.build("p:g p ~ p ~ p:g", "[DialogBorder]_01_ p", modifyButton, cancelButton) .getPanel(); // left leftFirst.add(leftTop, BorderLayout.NORTH); leftFirst.add(leftMiddle, BorderLayout.CENTER); leftFirst.add(leftBottom, BorderLayout.SOUTH); leftSecond.add(newParameterButton); left = FormsUtils.build("p", "0 f:p:g||" + "1 p", leftFirst, leftSecond).getPanel(); // right = FormsUtils.build("p:g ~ p ~", // "01|" + // "0_ f:p:g||" + // "22 p", // treeScr,FormsUtils.buttonStack(moveUpButton,moveDownButton,editButton).getPanel(), // numberOfRunsLabel).getPanel(); right = FormsUtils.build("p:g ~ p ~", "00||" + "12|" + "1_ f:p:g||", numberOfRunsLabel, treeScr, FormsUtils.buttonStack(moveUpButton, moveDownButton, editButton).getPanel()).getPanel(); content = FormsUtils.build("p p:g", "01 f:p:g", left, right).getPanel(); this.setLayout(new BorderLayout()); final JScrollPane sp = new JScrollPane(content); this.add(sp, BorderLayout.CENTER); outputTree.setName("tree_wizard_params"); runsField.setName("fld_wizard_params_runs"); constDef.setName("rbtn_wizard_params_const"); listDef.setName("rbtn_wizard_params_list"); incrDef.setName("rbtn_wizard_params_incr"); modifyButton.setName("btn_wizard_params_modify"); cancelButton.setName("btn_wizard_params_cancel"); incrStartValueField.setName("fld_wizard_params_incrstart"); incrEndValueField.setName("fld_wizard_params_incrend"); incrStepField.setName("fld_wizard_params_incrstep"); constDefField.setName("fld_wizard_params_constval"); moveUpButton.setName("btn_wizard_params_moveup"); moveDownButton.setName("btn_wizard_params_movedown"); editButton.setName("btn_wizard_params_edit"); listDefArea.setName("fld_wizard_params_paramlist"); }
From source file:ai.aitia.meme.paramsweep.gui.Page_ParametersV2.java
License:Open Source License
@SuppressWarnings("serial") private Container initContainer() { // left/*from w w w .j a va2 s . c o m*/ parameterList = new JList<AvailableParameter>(); parameterList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); new ListAction<AvailableParameter>(parameterList, new AbstractAction() { public void actionPerformed(final ActionEvent event) { final AvailableParameter selectedParameter = parameterList.getSelectedValue(); addParameterToTree(Collections.singletonList(selectedParameter), parameterTreeBranches.get(0)); enableDisableParameterCombinationButtons(); } }); parameterList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!parameterList.isSelectionEmpty()) { boolean success = true; if (editedNode != null) success = modify(); if (success) { cancelAllSelectionBut(parameterList); resetSettings(); enableDisableParameterCombinationButtons(); } else parameterList.clearSelection(); } } }); final JScrollPane parameterListPane = new JScrollPane(parameterList); parameterListPane.setBorder(BorderFactory.createTitledBorder(null, "Model parameters", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); parameterListPane.setPreferredSize(new Dimension(230, 300)); final JPanel parametersPanel = FormsUtils .build("p:g p", "[DialogBorder]00 f:p:g||" + "_1 p", parameterListPane, newParameterButton) .getPanel(); newParameterButton.setActionCommand("NEW_PARAMETER"); newParameterButtonCopy.setActionCommand("NEW_PARAMETER"); combinationsPanel = new JPanel(new GridLayout(0, 1, 5, 5)); combinationsScrPane = new JScrollPane(combinationsPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); combinationsScrPane.setBorder(null); combinationsScrPane.setPreferredSize(new Dimension(400, 500)); final JButton addNewBoxButton = new JButton("Add new combination"); addNewBoxButton.setActionCommand(ACTIONCOMMAND_ADD_BOX); final JPanel left = FormsUtils.build("p ~ f:p:g ~ p", "011 f:p:g ||" + "0_2 p", parametersPanel, combinationsScrPane, addNewBoxButton).getPanel(); left.setBorder(BorderFactory.createTitledBorder(null, "Specify parameter combinations", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); // right editedParameterText = new JLabel(ORIGINAL_TEXT); editedParameterText.setPreferredSize(new Dimension(250, 40)); runsField = new JTextField(); runsField.setActionCommand("RUNS_FIELD"); runsField.addFocusListener(this); if (PlatformSettings.getGUIControllerForPlatform().getRunOption() == RunOption.GLOBAL) runsField.setEnabled(true); constDef = new JRadioButton("Constant"); listDef = new JRadioButton("List"); incrDef = new JRadioButton("Increment"); final JPanel rightTop = FormsUtils.build("p ' p:g", "[DialogBorder]00||" + "12||" + "33||" + "44||" + "55", editedParameterText, runsLabel, runsField, constDef, listDef, incrDef).getPanel(); constDefField = new JTextField(); final JPanel constDefPanel = FormsUtils .build("p ~ p:g", "[DialogBorder]01 p", "Constant value: ", CellConstraints.TOP, constDefField) .getPanel(); listDefArea = new JTextArea(); final JScrollPane listDefScr = new JScrollPane(listDefArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel listDefPanel = FormsUtils.build("p ~ p:g", "[DialogBorder]01|" + "_1 f:p:g||" + "_2 p", "Value list: ", listDefScr, "(Separate values with spaces!)").getPanel(); incrStartValueField = new JTextField(); incrEndValueField = new JTextField(); incrStepField = new JTextField(); final JPanel incrDefPanel = FormsUtils.build("p ~ p:g", "[DialogBorder]01||" + "23||" + "45", "Start value: ", incrStartValueField, "End value: ", incrEndValueField, "Step: ", incrStepField) .getPanel(); enumDefBox = new JComboBox<Object>(new DefaultComboBoxModel<Object>()); final JPanel enumDefPanel = FormsUtils .build("p ~ p:g", "[DialogBorder]01 p", "Constant value:", CellConstraints.TOP, enumDefBox) .getPanel(); leftEnumValueList = new JList<Object>(new DefaultListModel<Object>()); rightEnumValueList = new JList<Object>(new DefaultListModel<Object>()); final JScrollPane leftEnumValuePane = new JScrollPane(leftEnumValueList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); final JScrollPane rightEnumValuePane = new JScrollPane(rightEnumValueList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); leftEnumValuePane.setPreferredSize(new Dimension(125, 100)); rightEnumValuePane.setPreferredSize(new Dimension(125, 100)); addEnumButton = new DefaultJButton(); addEnumButton.setOpaque(false); addEnumButton.setRolloverEnabled(true); addEnumButton.setIcon(PARAMETER_ADD_ICON); addEnumButton.setRolloverIcon(PARAMETER_ADD_ICON_RO); addEnumButton.setDisabledIcon(PARAMETER_ADD_ICON_DIS); addEnumButton.setBorder(null); addEnumButton.setBorderPainted(false); addEnumButton.setContentAreaFilled(false); addEnumButton.setFocusPainted(false); addEnumButton.setToolTipText("Add selected value"); addEnumButton.setActionCommand(ACTIONCOMMAND_ADD_ENUM); removeEnumButton = new DefaultJButton(); removeEnumButton.setOpaque(false); removeEnumButton.setRolloverEnabled(true); removeEnumButton.setIcon(PARAMETER_REMOVE_ICON); removeEnumButton.setRolloverIcon(PARAMETER_REMOVE_ICON_RO); removeEnumButton.setDisabledIcon(PARAMETER_REMOVE_ICON_DIS); removeEnumButton.setBorder(null); removeEnumButton.setBorderPainted(false); removeEnumButton.setContentAreaFilled(false); removeEnumButton.setFocusPainted(false); removeEnumButton.setToolTipText("Remove selected value"); removeEnumButton.setActionCommand(ACTIONCOMMAND_REMOVE_ENUM); final JPanel enumListPanel = FormsUtils .build("p:g ~ p ' p ~ p:g", "[DialogBorder]0011 f:p:g||" + "_23_ p||", leftEnumValuePane, rightEnumValuePane, removeEnumButton, addEnumButton) .getPanel(); leftEnumValueList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getComponent().isEnabled() && e.getClickCount() == 2) { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : leftEnumValueList.getSelectedValuesList()) model.addElement(element); } } }); rightEnumValueList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getComponent().isEnabled() && e.getClickCount() == 2) { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : rightEnumValueList.getSelectedValuesList()) model.removeElement(element); } } }); fileTextField = new JTextField(); fileTextField.addKeyListener(new KeyAdapter() { public void keyTyped(final KeyEvent e) { final char character = e.getKeyChar(); final File file = new File(Character.isISOControl(character) ? fileTextField.getText() : fileTextField.getText() + character); fileTextField.setToolTipText(file.getAbsolutePath()); } }); browseFileButton.setActionCommand(ACTIONCOMMAND_BROWSE); final JPanel fileDefPanel = FormsUtils .build("p ~ p:g ~p", "[DialogBorder]012", "File:", fileTextField, browseFileButton).getPanel(); constDefPanel.setName("CONST"); listDefPanel.setName("LIST"); incrDefPanel.setName("INCREMENT"); enumDefPanel.setName("ENUM"); enumListPanel.setName("ENUMLIST"); fileDefPanel.setName("FILE"); rightMiddle = new JPanel(new CardLayout()); rightMiddle.add(constDefPanel, constDefPanel.getName()); rightMiddle.add(listDefPanel, listDefPanel.getName()); rightMiddle.add(incrDefPanel, incrDefPanel.getName()); rightMiddle.add(enumDefPanel, enumDefPanel.getName()); rightMiddle.add(enumListPanel, enumListPanel.getName()); rightMiddle.add(fileDefPanel, fileDefPanel.getName()); modifyButton = new JButton("Modify"); cancelButton = new JButton("Cancel"); final JPanel rightBottom = FormsUtils .build("p:g p ~ p ~ p:g", "[DialogBorder]_01_ p", modifyButton, cancelButton).getPanel(); final JPanel right = new JPanel(new BorderLayout()); right.add(rightTop, BorderLayout.NORTH); right.add(rightMiddle, BorderLayout.CENTER); right.add(rightBottom, BorderLayout.SOUTH); right.setBorder(BorderFactory.createTitledBorder(null, "Parameter settings", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); // the whole paramsweep panel final JPanel content = FormsUtils.build("p:g p", "01 f:p:g", left, right).getPanel(); JPanel sweepPanel = new JPanel(); sweepPanel.setLayout(new BorderLayout()); final JScrollPane sp = new JScrollPane(content); sp.setBorder(null); sp.setViewportBorder(null); sweepPanel.add(sp, BorderLayout.CENTER); GUIUtils.createButtonGroup(constDef, listDef, incrDef); constDef.setSelected(true); constDef.setActionCommand("CONST"); listDef.setActionCommand("LIST"); incrDef.setActionCommand("INCREMENT"); constDefField.setActionCommand("CONST_FIELD"); incrStartValueField.setActionCommand("START_FIELD"); incrEndValueField.setActionCommand("END_FIELD"); incrStepField.setActionCommand("STEP_FIELD"); modifyButton.setActionCommand("EDIT"); cancelButton.setActionCommand("CANCEL"); listDefArea.setLineWrap(true); listDefArea.setWrapStyleWord(true); listDefScr.setPreferredSize(new Dimension(100, 200)); GUIUtils.addActionListener(this, modifyButton, cancelButton, constDef, listDef, incrDef, constDefField, incrStartValueField, incrEndValueField, incrStepField, addNewBoxButton, browseFileButton, runsField, newParameterButton, newParameterButtonCopy, addEnumButton, removeEnumButton); runsField.setName("fld_wizard_params_runs"); constDef.setName("rbtn_wizard_params_const"); listDef.setName("rbtn_wizard_params_list"); incrDef.setName("rbtn_wizard_params_incr"); modifyButton.setName("btn_wizard_params_modify"); cancelButton.setName("btn_wizard_params_cancel"); incrStartValueField.setName("fld_wizard_params_incrstart"); incrEndValueField.setName("fld_wizard_params_incrend"); incrStepField.setName("fld_wizard_params_incrstep"); constDefField.setName("fld_wizard_params_constval"); listDefArea.setName("fld_wizard_params_paramlist"); newParameterButton.setName("btn_wizard_params_newparameter"); enumDefBox.setName("cb_wizard_params_enum_const"); addEnumButton.setName("btn_wizard_params_add_enum_value"); removeEnumButton.setName("btn_wizard_params_remove_enum_value"); browseFileButton.setName("btn_wizard_params_browse"); fileTextField.setName("fld_wizard_params_file_const"); addNewBoxButton.setName("btn_wizard_params_newbox"); return sweepPanel; }
From source file:ai.aitia.meme.paramsweep.intellisweepPlugin.jgap.GASearchPanel.java
License:Open Source License
private void initSearchPanel(final GASearchPanelModel model) { model.addModelListener(new ModelListener() { //==================================================================================================== // methods //---------------------------------------------------------------------------------------------------- public void fitnessFunctionAdded() { fitnessFunctionList.removeAllItems(); final List<RecordableInfo> list = model.getFitnessFunctions(); for (final RecordableInfo fitnessFunction : list) { fitnessFunctionList.addItem(fitnessFunction); }//from w ww .j a v a 2s. co m } //---------------------------------------------------------------------------------------------------- public void fitnessFunctionsRemoved() { fitnessFunctionList.removeAllItems(); } //---------------------------------------------------------------------------------------------------- public void fitnessFunctionSelected(final RecordableInfo selectedFunction) { fitnessFunctionList.setSelectedItem(selectedFunction); } //---------------------------------------------------------------------------------------------------- public void parameterAdded() { final DefaultTreeModel treeModel = model.getChromosomeTree(); final DefaultMutableTreeNode root = (DefaultMutableTreeNode) treeModel.getRoot(); geneTree.expandPath(new TreePath(treeModel.getPathToRoot(root))); } //---------------------------------------------------------------------------------------------------- public void parametersRemoved() { parameterAdded(); // :) } }); // create the population parameters panel populationSizeField = new JSpinner( new SpinnerNumberModel(model.getPopulationSize(), 2, Integer.MAX_VALUE, 1)); populationSizeField.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { model.setPopulationSize((Integer) ((JSpinner) e.getSource()).getValue()); } }); populationRandomSeedField = new JTextField(String.valueOf(model.getPopulationRandomSeed())); populationRandomSeedField.setInputVerifier(new InputVerifier() { @Override public boolean verify(final JComponent input) { if (errorPopup != null) { errorPopup.hide(); errorPopup = null; } try { final int value = Integer.parseInt(populationRandomSeedField.getText()); model.setPopulationRandomSeed(value); return true; } catch (final NumberFormatException e) { final PopupFactory popupFactory = PopupFactory.getSharedInstance(); final Point locationOnScreen = populationRandomSeedField.getLocationOnScreen(); final JLabel message = new JLabel("Please specify an integer number!"); message.setBorder(new LineBorder(Color.RED, 2, true)); errorPopup = popupFactory.getPopup(populationRandomSeedField, message, locationOnScreen.x - 10, locationOnScreen.y - 30); errorPopup.show(); return false; } } }); final JPanel populationPanel = FormsUtils.build("p ~ f:p:g", "01 ||" + "23", "Size", populationSizeField, "Random seed", populationRandomSeedField).getPanel(); populationPanel.setBorder( BorderFactory.createTitledBorder(null, "Population", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); // create the stopping conditions panel numberOfGenerationsRadioButton = new JRadioButton("Number of generations"); numberOfGenerationsField = new JSpinner( new SpinnerNumberModel(model.getNumberOfGenerations(), 1, Integer.MAX_VALUE, 1)); numberOfGenerationsField.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { model.setNumberOfGenerations((Integer) ((JSpinner) e.getSource()).getValue()); } }); numberOfGenerationsRadioButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { if (numberOfGenerationsRadioButton.isSelected()) { numberOfGenerationsField.setEnabled(true); model.setFixNumberOfGenerations(true); } else numberOfGenerationsField.setEnabled(false); } }); fitnessLimitRadioButton = new JRadioButton("Fitness limit"); fitnessLimitField = new JTextField(String.valueOf(model.getFitnessLimitCriterion())); fitnessLimitField.setInputVerifier(new InputVerifier() { @Override public boolean verify(final JComponent input) { if (errorPopup != null) { errorPopup.hide(); errorPopup = null; } try { final double value = Double.parseDouble(fitnessLimitField.getText()); if (value < 0) throw new NumberFormatException(); model.setFitnessLimitCriterion(value); return true; } catch (final NumberFormatException e) { final PopupFactory popupFactory = PopupFactory.getSharedInstance(); final Point locationOnScreen = fitnessLimitField.getLocationOnScreen(); final JLabel message = new JLabel( "Please specify a non-negative (possibly floating point) number!"); message.setBorder(new LineBorder(Color.RED, 2, true)); errorPopup = popupFactory.getPopup(fitnessLimitField, message, locationOnScreen.x - 10, locationOnScreen.y - 30); errorPopup.show(); return false; } } }); fitnessLimitRadioButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { if (fitnessLimitRadioButton.isSelected()) { fitnessLimitField.setEnabled(true); model.setFixNumberOfGenerations(false); } else fitnessLimitField.setEnabled(false); } }); GUIUtils.createButtonGroup(numberOfGenerationsRadioButton, fitnessLimitRadioButton); if (model.getNumberOfGenerations() < 0) { fitnessLimitRadioButton.setSelected(true); numberOfGenerationsField.setEnabled(false); model.setFixNumberOfGenerations(false); } else { fitnessLimitField.setEnabled(false); numberOfGenerationsRadioButton.setSelected(true); model.setFixNumberOfGenerations(true); } final JPanel stoppingPanel = FormsUtils.build("p ~ f:p:g", "01 |" + "23", numberOfGenerationsRadioButton, numberOfGenerationsField, fitnessLimitRadioButton, fitnessLimitField).getPanel(); stoppingPanel.setBorder( BorderFactory.createTitledBorder(null, "Stopping", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); // create the fitness function panel fitnessMinimizeRadioButton = new JRadioButton("Minimize"); fitnessMaximizeRadioButton = new JRadioButton("Maximize"); GUIUtils.createButtonGroup(fitnessMinimizeRadioButton, fitnessMaximizeRadioButton); GUIUtils.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (fitnessMinimizeRadioButton.isSelected()) model.setFitnessFunctionDirection(FitnessFunctionDirection.MINIMIZE); else if (fitnessMaximizeRadioButton.isSelected()) model.setFitnessFunctionDirection(FitnessFunctionDirection.MAXIMIZE); } }, fitnessMinimizeRadioButton, fitnessMaximizeRadioButton); if (model.getFitnessFunctionDirection() == FitnessFunctionDirection.MINIMIZE) fitnessMinimizeRadioButton.setSelected(true); else fitnessMaximizeRadioButton.setSelected(true); final JPanel fitnessButtonsPanel = new JPanel(); fitnessButtonsPanel.add(fitnessMinimizeRadioButton); fitnessButtonsPanel.add(fitnessMaximizeRadioButton); fitnessFunctionList = new JComboBox<RecordableInfo>( model.getFitnessFunctions().toArray(new RecordableInfo[0])); fitnessFunctionList.setSelectedItem(model.getSelectedFitnessFunction()); fitnessFunctionList.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (ItemEvent.SELECTED == e.getStateChange()) model.setSelectedFitnessFunction((RecordableInfo) e.getItem()); } }); final JXLabel fitnessMessage = new JXLabel( "Please specify a function that always returns with non-negative value!"); fitnessMessage.setLineWrap(true); final JPanel fitnessPanel = FormsUtils.build("p ~ f:p:g", "00 ||" + "12 ||" + "33", fitnessButtonsPanel, "Fitness function", fitnessFunctionList, fitnessMessage).getPanel(); fitnessPanel.setBorder( BorderFactory.createTitledBorder(null, "Fitness", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); operatorSettingsPanel = new JPanel(new CardLayout()); operatorSettingsPanel.setBorder(BorderFactory.createTitledBorder(null, OPERATOR_SETTINGS_PANEL_TITLE_POSTFIX, TitledBorder.LEADING, TitledBorder.BELOW_TOP)); operatorSettingsPanel.add(new JLabel(""), OPERATOR_SETTINGS_PANEL_DEFAULT_PANEL); final List<IGASelectorConfigurator> selectionOperators = model.getSelectionOperators(); final List<IGASelectorConfigurator> selectedSelectionOperators = model.getSelectedSelectionOperators(); final CheckListModel selectorListModel = new CheckListModel(selectionOperators); selectorList = new CheckList(selectorListModel); selectorList.setBorder( BorderFactory.createTitledBorder(null, "Selection", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); selectorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int i = 0; for (final IGASelectorConfigurator selectionOperator : selectionOperators) { final JPanel settingspanel = selectionOperator.getSettingsPanel(); operatorSettingsPanel.add(settingspanel, selectionOperator.getName()); if (selectedSelectionOperators.contains(selectionOperator)) selectorList.setChecked(i, true); ++i; } selectorList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { final IGASelectorConfigurator operator = (IGASelectorConfigurator) selectorList.getSelectedValue(); showOperatorDetails(operatorSettingsPanel, operator); } }); selectorListModel.addListDataListener(new ListDataListener() { //==================================================================================================== // methods //---------------------------------------------------------------------------------------------------- @Override public void intervalRemoved(final ListDataEvent e) { } @Override public void intervalAdded(final ListDataEvent e) { } //---------------------------------------------------------------------------------------------------- @Override public void contentsChanged(final ListDataEvent e) { final IGASelectorConfigurator operator = (IGASelectorConfigurator) selectorList.getSelectedValue(); if (selectorList.getModel().getCheckedState(e.getIndex0())) model.setSelectedSelectionOperator(operator); else model.unsetSelectedSelectionOperator(operator); } }); final List<IGAOperatorConfigurator> geneticOperators = model.getGeneticOperators(); final List<IGAOperatorConfigurator> selectedGeneticOperators = model.getSelectedGeneticOperators(); final CheckListModel operatorListModel = new CheckListModel(geneticOperators); operatorList = new CheckList(operatorListModel); operatorList.setBorder(BorderFactory.createTitledBorder(null, "Genetic operators", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); operatorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); i = 0; for (final IGAOperatorConfigurator operator : geneticOperators) { final JPanel settingsPanel = operator.getSettingsPanel(); operatorSettingsPanel.add(settingsPanel, operator.getName()); if (selectedGeneticOperators.contains(operator)) operatorList.setChecked(i, true); ++i; } operatorList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { final IGAOperatorConfigurator operator = (IGAOperatorConfigurator) operatorList.getSelectedValue(); showOperatorDetails(operatorSettingsPanel, operator); } }); operatorListModel.addListDataListener(new ListDataListener() { //==================================================================================================== // methods //---------------------------------------------------------------------------------------------------- @Override public void intervalRemoved(final ListDataEvent e) { } @Override public void intervalAdded(final ListDataEvent e) { } //---------------------------------------------------------------------------------------------------- @Override public void contentsChanged(final ListDataEvent e) { final IGAOperatorConfigurator operator = (IGAOperatorConfigurator) operatorList.getSelectedValue(); if (operatorList.getModel().getCheckedState(e.getIndex0())) model.setSelectedGeneticOperator(operator); else model.unsetSelectedGeneticOperator(operator); } }); final JPanel gaSettingsPanel = FormsUtils.build("f:p:g", "0||" + "1||" + "2||" + "3||" + "4 f:p:g", populationPanel, stoppingPanel, fitnessPanel, selectorList, operatorList).getPanel(); // the chromosome panel final JScrollPane treeScrPane = new JScrollPane(); geneTree = new ListAsATree(model.getChromosomeTree()); geneTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); geneTree.setCellRenderer(new ChromosomeTreeRenderer()); geneTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { final TreePath selectionPath = geneTree.getSelectionPath(); boolean success = true; if (editedNode != null && (selectionPath == null || !editedNode.equals(selectionPath.getLastPathComponent()))) success = modify(); final DefaultTreeModel treeModel = model.getChromosomeTree(); if (success) { if (selectionPath != null) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectionPath .getLastPathComponent(); final ParameterOrGene userObj = (ParameterOrGene) node.getUserObject(); if (!node.equals(editedNode)) { if (!node.isRoot() && selectionPath.getPathCount() == treeModel.getPathToRoot(node).length) { editedNode = node; edit(userObj); } else { editedNode = null; geneTree.setSelectionPath(null); resetSettings(); enableDisableSettings(false); } } } else { editedNode = null; resetSettings(); enableDisableSettings(false); } } else geneTree.setSelectionPath(new TreePath(treeModel.getPathToRoot(editedNode))); } }); treeScrPane.setViewportView(geneTree); treeScrPane.setBorder(null); treeScrPane.setViewportBorder(null); numberLabel = new JLabel("<html><b>Number of genes:</b> 0</html>"); final JPanel treePanel = FormsUtils .build("~ f:p:g", "0||" + "1||" + "2 f:p:g", numberLabel, new Separator(""), treeScrPane) .getPanel(); treePanel.setBorder(BorderFactory.createTitledBorder("")); geneSettingsValuePanel = new JPanel(new CardLayout()); constantRButton = new JRadioButton("Constant"); geneRButton = new JRadioButton("Gene"); doubleGeneValueRangeRButton = new JRadioButton("Double value range"); intGeneValueRangeRButton = new JRadioButton("Integer value range"); listGeneValueRButton = new JRadioButton("Value list"); GUIUtils.createButtonGroup(constantRButton, geneRButton, doubleGeneValueRangeRButton, intGeneValueRangeRButton, listGeneValueRButton); constantField = new JTextField(); constantField.setActionCommand("CONST_FIELD"); final JPanel constantPanel = FormsUtils .build("p ~ p:g", "[DialogBorder]01 p", "Constant value", constantField).getPanel(); enumDefBox = new JComboBox<Object>(new DefaultComboBoxModel<Object>()); final JPanel enumDefPanel = FormsUtils.build("p ~ p:g", "[DialogBorder]01 p", "Constant value", enumDefBox) .getPanel(); leftEnumValueList = new JList<Object>(new DefaultListModel<Object>()); rightEnumValueList = new JList<Object>(new DefaultListModel<Object>()); final JScrollPane leftEnumValuePane = new JScrollPane(leftEnumValueList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); final JScrollPane rightEnumValuePane = new JScrollPane(rightEnumValueList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); leftEnumValuePane.setPreferredSize(new Dimension(125, 100)); //TODO: check rightEnumValuePane.setPreferredSize(new Dimension(125, 100)); //TODO: check addEnumButton = new DefaultJButton(); addEnumButton.setOpaque(false); addEnumButton.setRolloverEnabled(true); addEnumButton.setIcon(ENUM_ADD_ICON); addEnumButton.setRolloverIcon(ENUM_ADD_ICON_RO); addEnumButton.setDisabledIcon(ENUM_ADD_ICON_DIS); addEnumButton.setBorder(null); addEnumButton.setBorderPainted(false); addEnumButton.setContentAreaFilled(false); addEnumButton.setFocusPainted(false); addEnumButton.setToolTipText("Add selected value"); addEnumButton.setActionCommand("ADD_ENUM"); removeEnumButton = new DefaultJButton(); removeEnumButton.setOpaque(false); removeEnumButton.setRolloverEnabled(true); removeEnumButton.setIcon(ENUM_REMOVE_ICON); removeEnumButton.setRolloverIcon(ENUM_REMOVE_ICON_RO); removeEnumButton.setDisabledIcon(ENUM_REMOVE_ICON_DIS); removeEnumButton.setBorder(null); removeEnumButton.setBorderPainted(false); removeEnumButton.setContentAreaFilled(false); removeEnumButton.setFocusPainted(false); removeEnumButton.setToolTipText("Remove selected value"); removeEnumButton.setActionCommand("REMOVE_ENUM"); final JPanel enumListPanel = FormsUtils .build("p:g ~ p ' p ~ p:g", "[DialogBorder]0011 f:p:g||" + "_23_ p||", leftEnumValuePane, rightEnumValuePane, removeEnumButton, addEnumButton) .getPanel(); leftEnumValueList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getComponent().isEnabled() && e.getClickCount() == 2) { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : leftEnumValueList.getSelectedValuesList()) { model.addElement(element); } } } }); rightEnumValueList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getComponent().isEnabled() && e.getClickCount() == 2) { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : rightEnumValueList.getSelectedValuesList()) { model.removeElement(element); } } } }); fileTextField = new JTextField(); fileTextField.setActionCommand("FILE_FIELD"); fileTextField.addKeyListener(new KeyAdapter() { @Override public void keyTyped(final KeyEvent e) { final char character = e.getKeyChar(); final File file = new File(Character.isISOControl(character) ? fileTextField.getText() : fileTextField.getText() + character); fileTextField.setToolTipText(file.getAbsolutePath()); } }); fileBrowseButton = new JButton(FileSystemView.getFileSystemView().getSystemIcon(new File("."))); fileBrowseButton.setActionCommand("FILE_BROWSE"); final JPanel fileDefPanel = FormsUtils .build("p ~ p:g ' p", "[DialogBorder]012", "File", fileTextField, fileBrowseButton).getPanel(); intMinField = new JTextField(); intMinField.setActionCommand("INT_MIN"); intMaxField = new JTextField(); intMaxField.setActionCommand("INT_MAX"); doubleMinField = new JTextField(); doubleMinField.setActionCommand("D_MIN"); doubleMaxField = new JTextField(); doubleMaxField.setActionCommand("D_MAX"); valuesArea = new JTextArea(); valuesArea.setToolTipText("Please specify ' ' (space) separated values!"); valuesArea.setLineWrap(true); valuesArea.setWrapStyleWord(true); final JScrollPane valuesDefScr = new JScrollPane(valuesArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel doublePanel = FormsUtils.build("p ' f:p:g", "[DialogBorder]01 p ||" + "23 p", "Minimum value", doubleMinField, "Maximum value", doubleMaxField).getPanel(); final JPanel intPanel = FormsUtils.build("p ' f:p:g", "[DialogBorder]01 p ||" + "23 p", "Minimum value", intMinField, "Maximum value", intMaxField).getPanel(); final JPanel valuesPanel = FormsUtils .build("p ' p:g", "[DialogBorder]01 f:p:g", "Value list", CellConstraints.TOP, valuesDefScr) .getPanel(); final JPanel emptyPanel = new JPanel(); geneSettingsValuePanel.add(emptyPanel, "NULL"); geneSettingsValuePanel.add(constantPanel, PARAM_SETTINGS_CONSTANT_VALUE_PANEL); geneSettingsValuePanel.add(enumDefPanel, PARAM_SETTINGS_ENUM_VALUE_PANEL); geneSettingsValuePanel.add(fileDefPanel, PARAM_SETTINGS_FILE_VALUE_PANEL); geneSettingsValuePanel.add(doublePanel, GENE_SETTINGS_DOUBLE_RANGE_VALUE_PANEL); geneSettingsValuePanel.add(intPanel, GENE_SETTINGS_INT_RANGE_VALUE_PANEL); geneSettingsValuePanel.add(valuesPanel, GENE_SETTINGS_LIST_VALUE_PANEL); geneSettingsValuePanel.add(enumListPanel, GENE_SETTINGS_ENUM_LIST_PANEL); final ItemListener itemListener = new ItemListener() { @Override public void itemStateChanged(final ItemEvent _) { if (editedNode != null) { final CardLayout layout = (CardLayout) geneSettingsValuePanel.getLayout(); if (doubleGeneValueRangeRButton.isSelected()) layout.show(geneSettingsValuePanel, GENE_SETTINGS_DOUBLE_RANGE_VALUE_PANEL); else if (intGeneValueRangeRButton.isSelected()) layout.show(geneSettingsValuePanel, GENE_SETTINGS_INT_RANGE_VALUE_PANEL); else if (listGeneValueRButton.isSelected()) { final ParameterOrGene param = (ParameterOrGene) editedNode.getUserObject(); if (param.getInfo().isEnum() || param.getInfo() instanceof MasonChooserParameterInfo) { Object[] elements = null; if (param.getInfo().isEnum()) { @SuppressWarnings("unchecked") final Class<Enum<?>> type = (Class<Enum<?>>) param.getInfo().getJavaType(); elements = type.getEnumConstants(); } else { final MasonChooserParameterInfo chooserInfo = (MasonChooserParameterInfo) param .getInfo(); elements = chooserInfo.getValidStrings(); } final DefaultListModel<Object> leftEnumModel = (DefaultListModel<Object>) leftEnumValueList .getModel(); leftEnumModel.removeAllElements(); for (final Object object : elements) { leftEnumModel.addElement(object); } final DefaultListModel<Object> rightEnumModel = (DefaultListModel<Object>) rightEnumValueList .getModel(); rightEnumModel.removeAllElements(); if (param.isGene()) { for (final Object object : param.getGeneInfo().getValueRange()) { if (param.getInfo().isEnum()) { rightEnumModel.addElement(object); } else { final MasonChooserParameterInfo chooserInfo = (MasonChooserParameterInfo) param .getInfo(); rightEnumModel.addElement(chooserInfo.getValidStrings()[(Integer) object]); } } } layout.show(geneSettingsValuePanel, GENE_SETTINGS_ENUM_LIST_PANEL); } else { layout.show(geneSettingsValuePanel, GENE_SETTINGS_LIST_VALUE_PANEL); } } else if (constantRButton.isSelected()) { final ParameterOrGene param = (ParameterOrGene) editedNode.getUserObject(); if (param.getInfo().isEnum() || param.getInfo() instanceof MasonChooserParameterInfo) layout.show(geneSettingsValuePanel, PARAM_SETTINGS_ENUM_VALUE_PANEL); else if (param.getInfo().isFile()) layout.show(geneSettingsValuePanel, PARAM_SETTINGS_FILE_VALUE_PANEL); else layout.show(geneSettingsValuePanel, PARAM_SETTINGS_CONSTANT_VALUE_PANEL); } else if (geneRButton.isSelected()) { layout.show(geneSettingsValuePanel, "NULL"); } } else { resetSettings(); enableDisableSettings(false); } } }; constantRButton.addItemListener(itemListener); geneRButton.addItemListener(itemListener); doubleGeneValueRangeRButton.addItemListener(itemListener); intGeneValueRangeRButton.addItemListener(itemListener); listGeneValueRButton.addItemListener(itemListener); final JPanel selectPanel = FormsUtils.build("f:p:g", "0||" + "1||" + "2||" + "3||" + "4", constantRButton, geneRButton, doubleGeneValueRangeRButton, intGeneValueRangeRButton, listGeneValueRButton) .getPanel(); final JPanel buttonsPanel = new JPanel(); modifyButton = new JButton("Modify"); modifyButton.setActionCommand("EDIT"); cancelButton = new JButton("Cancel"); cancelButton.setActionCommand("CANCEL"); GUIUtils.addActionListener(new ActionListener() { //==================================================================================================== // methods //---------------------------------------------------------------------------------------------------- @Override public void actionPerformed(ActionEvent e) { final String cmd = e.getActionCommand(); if ("EDIT".equals(cmd)) edit(); else if ("CANCEL".equals(cmd)) cancel(); else if ("CONST_FIELD".equals(cmd) || "INT_MAX".equals(cmd) || "D_MAX".equals(cmd)) modifyButton.doClick(); else if ("INT_MIN".equals(cmd)) intMaxField.grabFocus(); else if ("D_MIN".equals(cmd)) doubleMaxField.grabFocus(); else if ("FILE_BROWSE".equals(cmd)) chooseFile(); else if ("ADD_ENUM".equals(cmd)) { addEnum(); } else if ("REMOVE_ENUM".equals(cmd)) { removeEnum(); } } //---------------------------------------------------------------------------------------------------- private void edit() { if (editedNode != null) geneTree.setSelectionPath(null); } //---------------------------------------------------------------------------------------------------- private void cancel() { resetSettings(); enableDisableSettings(false); editedNode = null; geneTree.setSelectionPath(null); } //---------------------------------------------------------------------------------------------------- private void chooseFile() { final JFileChooser fileDialog = new JFileChooser( !"".equals(fileTextField.getToolTipText()) ? fileTextField.getToolTipText() : ParameterSweepWizard.getLastDir().getPath()); if (!"".equals(fileTextField.getToolTipText())) fileDialog.setSelectedFile(new File(fileTextField.getToolTipText())); int dialogResult = fileDialog.showOpenDialog(GASearchPanel.this); if (dialogResult == JFileChooser.APPROVE_OPTION) { final File selectedFile = fileDialog.getSelectedFile(); if (selectedFile != null) { ParameterSweepWizard.setLastDir(selectedFile.getAbsoluteFile().getParentFile()); fileTextField.setText(selectedFile.getName()); fileTextField.setToolTipText(selectedFile.getAbsolutePath()); } } } //---------------------------------------------------------------------------------------------------- private void addEnum() { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : leftEnumValueList.getSelectedValuesList()) { model.addElement(element); } leftEnumValueList.clearSelection(); } //---------------------------------------------------------------------------------------------------- private void removeEnum() { final DefaultListModel<Object> model = (DefaultListModel<Object>) rightEnumValueList.getModel(); for (final Object element : rightEnumValueList.getSelectedValuesList()) { model.removeElement(element); } } }, modifyButton, cancelButton, constantField, fileTextField, intMinField, intMaxField, doubleMinField, doubleMaxField, fileBrowseButton, addEnumButton, removeEnumButton); buttonsPanel.add(modifyButton); buttonsPanel.add(cancelButton); final JPanel geneSetterPanel = FormsUtils .build("f:p:g", "0||" + "1 f:p:g||" + "2 p", selectPanel, geneSettingsValuePanel, buttonsPanel) .getPanel(); geneSetterPanel.setBorder(BorderFactory.createTitledBorder(null, "Gene/parameter settings", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); localNewParametersButton = new JButton("Add new parameters..."); localNewParametersButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if (remoteNewParametersButton != null) { remoteNewParametersButton.doClick(); model.addParametersToChromosomeTree(); updateNumberOfGenes(); } else { Utilities.userAlert(mainScrPane, "Sorry, this feature is not available."); } } }); localNewParametersButton .setVisible(PlatformSettings.getGUIControllerForPlatform().isNewParametersEnabled()); final JPanel rightTop = FormsUtils .build("f:p:g p ' p", "001 f:p:g||" + "_21 p", treePanel, geneSetterPanel, localNewParametersButton) .getPanel(); rightTop.setBorder( BorderFactory.createTitledBorder(null, "Chromosome", TitledBorder.LEADING, TitledBorder.BELOW_TOP)); final JPanel mainPanel = FormsUtils .build("p f:p:g", "01 f:p:g||" + "02 p", gaSettingsPanel, rightTop, operatorSettingsPanel) .getPanel(); setLayout(new BorderLayout()); mainScrPane = new JScrollPane(mainPanel); mainScrPane.setBorder(null); mainScrPane.setViewportBorder(null); add(mainScrPane, BorderLayout.CENTER); resetSettings(); enableDisableSettings(false); }
From source file:ai.aitia.meme.utils.FormsUtils.java
License:Open Source License
/** * Returns a DefaultFormBuilder containing the specified components and layout. * @param cols This parameter corresponds to the <code>encodedColumnSpecs</code> * parameter of FormLayout's ctor. Besides the encoding defined by FormLayout, * the following extensions are also available: the characters defined in the * global <code>{@link #gapLength}</code> variable (hereafter: gap-characters) * can be used to insert gap-columns. Gap columns must not appear in the * cell-specification (explained below) and they're automatically included in * column spans. //from w w w .ja v a2s . c om * Consecutive gap-characters are coalesced into 1 gap column by calculating * their cumulated pixel size. * @param rows A string describing general builder settings + cell-specification * + row/colum spans + row heights + row groups. See the examples. * The digits and underscores specify which component goes into which cell(s) * of the layout grid (cell-specification). There can be at most one character * for every (non-gap) column specified by <code>cols</code>. Rows must be * separated by the '|' character. Only underscores, digits and letters are * allowed in the cell-specification (space isn't). Underscore means that a * cell is empty. A digit/letter character refers to a component in the varargs * list: '0'..'9', 'A'..'Z', 'a'..'z' (in this order) denote the first 62 * components of the <code>args</code> list. Repeating the same digit specifies * the component's column span (and row span, if repeated in consecutive rows * in the same columns, like '3' in the example).<br> * After the cell-specification, but before the newline ('|') character * the row height and row grouping can also be specified. It must begin * with a space to separate it from the cell-specification. The row * height can be a gap-character (for constant heights only) or a string * that is interpreted by RowSpec.decodeSpecs(). If omitted, the height * spec. of the most recent row is inherited. Content rows inherit the * height of the previous content row, gap rows inherit the height of * the previous gap row. A row is a gap row if its cell-specification is * omitted.<br> * Row grouping forces equal heights to every member of the group. It * can be specified by "grp?" strings using any character in place of * '?' (except space and '|'. In the example 'grp1' uses '1'). Rows * using the same grouping character will be in the same group. * By default there're no groups. * <br> * General builder-settings can be specified at the beginning of the * string, enclosed in square brackets ([..]). (No space is allowed * after the closing ']'). This is intended for future extensions, too. * The list of available settings is described at the {@link Prop} * enumeration. Note that setting names are case-sensitive, and should * be separated by commas. * @param args List of components. Besides java.awt.Component objects, * the caller may use plain strings and instances of the {@link Separator} * class. Plain strings are used to create labels (with mnemonic-expansion). * Separator objects will create and add separators to the form. * Any of these objects may be followed optionally by a {@link CellConstraints}, * a {@link CellConstraints.Alignment} or a {@link CellInsets} object, * which overrides the cell's default alignment, can extend its row/column * span and adjust its insets.<br> * If the first element of <code>args</code> is a java.util.Map object, * it is treated as an additional mapping for gap-characters. This * overrides the default global mapping. Note that gap-characters can * help you to set up uniform spacing on your forms. For example, if * you use "-" as normal column-gap and "~" as normal row-gap, fine-tuning * the sizes of these gaps later is as easy as changing the mapping for "-" * and "~" — there's no need to update all the dlu sizes in all layouts. * @see * Example1: <pre> * build("6dlu, p, 6dlu, 50dlu, 6dlu", * "_0_1_ pref| 6dlu|" + * "_2_33 pref:grow(0.5) grp1||" + * "_4_33 grp1", * component0, component1, component2, component3, * component4, cellConstraintsForComponent4).getPanel() * </pre> * The same exaple with gap-characters: <pre> * build("~ p ~ 50dlu, 6dlu", * "01_ pref|~|" + * "233 pref:grow(0.5) grp1||" + * "433 grp1", * component0, component1, component2, component3, * component4, cellConstraintsForComponent4).getPanel() * </pre> * Example3 (only the second argument): <pre> * "[LineGapSize=6dlu, ParagraphGapSize=20dlu]_0_1||_2_3||_4_5" * </pre> * Note: this method can be used with no components and empty cell-specification, * too. In this case only a {@link DefaultFormBuilder} is created, configured * and returned. Its operations can then be used to append components to the form. */ @SuppressWarnings("unchecked") public static DefaultFormBuilder build(String cols, String rows, Object... args) { Context ctx = new Context(); // Parse column widths // int firstArg = 0; if (args.length > 0 && args[0] instanceof java.util.Map) { ctx.localGapSpec = (java.util.Map<Character, String>) args[0]; firstArg += 1; } StringBuilder colstmp = new StringBuilder(); ctx.contentCol = parseColumnWidths(colstmp, cols, ctx.localGapSpec, 0); // Parse the list of components (may include individual cell-constraints) // ctx.components = new ArrayList<Rec>(args.length); for (int i = firstArg; i < args.length; ++i) { Rec r = new Rec(args[i]); if (i + 1 < args.length) { if (args[i + 1] instanceof CellConstraints) { r.cc = (CellConstraints) args[++i]; r.useAlignment = true; } else if (args[i + 1] instanceof CellConstraints.Alignment) { CellConstraints.Alignment a = (CellConstraints.Alignment) args[++i]; if (a == CellConstraints.BOTTOM || a == CellConstraints.TOP) r.cc = new CellConstraints(1, 1, CellConstraints.DEFAULT, a); else if (a == CellConstraints.LEFT || a == CellConstraints.RIGHT) r.cc = new CellConstraints(1, 1, a, CellConstraints.DEFAULT); else if (a == CellConstraints.CENTER || a == CellConstraints.FILL) r.cc = new CellConstraints(1, 1, a, a); r.useAlignment = (r.cc != null); } else if (args[i + 1] instanceof CellInsets) { CellInsets ci = ((CellInsets) args[++i]); r.cc = ci.cc; r.useAlignment = ci.useAlignment; r.useInsets = true; //} //else if (args[i+1] == null) { // this would allow superfluous 'null' values // i += 1; } } ctx.components.add(r); } // Parse general settings (but don't apply yet) // EnumMap<Prop, Object> props = null; int i = rows.indexOf(']'); if (i >= 0) { String defaults = rows.substring(0, i); rows = rows.substring(++i); i = defaults.indexOf('['); ctx.input = defaults.substring(++i); props = Prop.parseGeneralSettings(ctx); } // Parse cell-specification, row heights and row groups // String cells[] = rows.split("\\|", -1); StringBuilder rowstmp = new StringBuilder(); java.util.HashMap<Character, int[]> rowGroups = new HashMap<Character, int[]>(); String lastContentRowHeight = "p", lastGapRowHeight = null; int rowcnt = 0; for (i = 0; i < cells.length; ++i) { rowcnt += 1; // See if it begins with a gap-character String g = (cells[i].length() > 0) ? getGap(cells[i].charAt(0), ctx.localGapSpec) : null; if (g != null) cells[i] = ' ' + cells[i]; int j = cells[i].indexOf(' '); boolean gapRow = (j == 0) || (cells[i].length() == 0); String rh = null; if (j >= 0) { String tmp[] = cells[i].substring(j + 1).split("\\s"); // expect height and grouping specifications cells[i] = cells[i].substring(0, j); ArrayList<String> gaps = new ArrayList<String>(); for (j = 0; j < tmp.length; ++j) { if (tmp[j].length() == 0) continue; if (tmp[j].length() == 4 && tmp[j].toLowerCase().startsWith("grp")) { Character groupch = tmp[j].charAt(3); rowGroups.put(groupch, appendIntArray(rowGroups.get(groupch), rowcnt)); } else { rh = tmp[j]; for (int k = 0, n = tmp[j].length(); k < n && addGap(gaps, getGap(tmp[j].charAt(k), ctx.localGapSpec)); ++k) ; } } if (!gaps.isEmpty()) { StringBuilder sb = new StringBuilder(); flushGaps(gaps, sb, false); rh = sb.substring(0, sb.length() - 1); } } if (rh == null) { if (gapRow && lastGapRowHeight == null) { ctx.b = new DefaultFormBuilder(new FormLayout(colstmp.toString(), "")); Prop.setBuilder(props, ctx); lastGapRowHeight = parseableRowSpec(ctx.b.getLineGapSpec()); } rh = gapRow ? lastGapRowHeight : lastContentRowHeight; } else { if (gapRow) lastGapRowHeight = rh; else lastContentRowHeight = rh; } if (i > 0) rowstmp.append(','); rowstmp.append(rh); } // Create builder // FormLayout fml = new FormLayout(colstmp.toString(), rowstmp.toString()); ctx.b = new DefaultFormBuilder(fml, debuggable()); // Apply builder settings (e.g. column groups) // Prop.setBuilder(props, ctx); props = null; // Set row groups // if (!rowGroups.isEmpty()) { int[][] tmp = new int[rowGroups.size()][]; // ??? i = 0; for (int[] a : rowGroups.values()) tmp[i++] = a; fml.setRowGroups(tmp); } rowGroups = null; JLabel lastLabel = null; java.util.HashSet<Character> done = new java.util.HashSet<Character>(ctx.components.size()); int h = cells.length; for (int y = 0; y < cells.length; ++y) { int w = cells[y].length(); int first = -1; for (int x = 0; x < w; ++x) { char ch = cells[y].charAt(x); if (ch == '_' || done.contains(ch)) continue; int idx = intValue(ch); Rec rec; try { rec = ctx.components.get(idx); } catch (IndexOutOfBoundsException e) { throw new IndexOutOfBoundsException( String.format("build() cells=\"%s\" ch=%c rows=\"%s\"", cells[y], ch, rows)); } CellConstraints cc = (rec.cc == null) ? new CellConstraints() : (CellConstraints) rec.cc.clone(); int sx = cc.gridWidth, sy = cc.gridHeight; // span x, span y while (x + sx < w && cells[y].charAt(x + sx) == ch) sx += 1; while (y + sy < h && ((x < cells[y + sy].length() && cells[y + sy].charAt(x) == ch) || (cells[y + sy].length() == 0 && y + sy + 1 < h && x < cells[y + sy + 1].length() && cells[y + sy + 1].charAt(x) == ch))) { sy += 1; } int colSpan = ctx.contentCol[x + sx - 1] - ctx.contentCol[x] + 1; ctx.b.setBounds(ctx.contentCol[x] + 1, ctx.b.getRow(), colSpan, sy); ctx.b.setLeadingColumnOffset(first & ctx.contentCol[x]); // 0 vagy x (itt nem kell a +1) first = 0; x += (sx - 1); Object comp = ctx.components.get(idx).component; if (comp instanceof Component) { ctx.b.append((Component) comp, colSpan); if (comp instanceof JLabel) lastLabel = (JLabel) comp; else { if (lastLabel != null) lastLabel.setLabelFor((Component) comp); lastLabel = null; } } else if (comp instanceof Separator) { comp = ctx.b.appendSeparator(comp.toString()); lastLabel = null; } else { comp = lastLabel = ctx.b.getComponentFactory().createLabel(comp.toString()); ctx.b.append(lastLabel, colSpan); } if (rec.useAlignment || rec.useInsets) { CellConstraints cc2 = fml.getConstraints((Component) comp); cc2.insets = cc.insets; cc2.hAlign = cc.hAlign; cc2.vAlign = cc.vAlign; fml.setConstraints((Component) comp, cc2); } done.add(ch); } lastLabel = null; ctx.b.nextLine(); } return ctx.b; }
From source file:ai.aitia.meme.viewmanager.Page_Columns.java
License:Open Source License
private void layoutGUI() { final JPanel panel = new JPanel(new BorderLayout()); this.setLayout(new BorderLayout()); this.add(new DraggableViewport(panel)); panel.setBorder(Borders.DIALOG_BORDER); panel.add(FormsUtils.build("pref - min:grow - 30px", "012 min|~|3|=", filterLabel, new TAWrapper(jFilterTextArea), jFilterEEButton, // 0-2 new Separator("Columns of the view table") // 3 ).getPanel(), BorderLayout.NORTH); Box box = new Box(BoxLayout.Y_AXIS); box.add(FormsUtils.build("f:80dlu:g - pref", "01 f:min:g|-", getJTableScrollPane(), FormsUtils .buttonStack(jMoveUpButton, jMoveDownButton, FormsUtils.BS_UNRELATED, jRemoveButton, jEditButton) .getPanel()).getPanel());/*from ww w. jav a2s. c o m*/ // Use different preferred size for docked and floating conditions JScrollPane jScriptScrollPane = new JScrollPane(jScriptTextArea) /*{ private static final long serialVersionUID = 1L; public Dimension getPreferredSize() { if (SwingUtilities.getRoot(this) == SwingUtilities.getRoot(panel)) { return new Dimension(100, 24); // docked } return new Dimension(100, Sizes.dialogUnitYAsPixel(120, this)); // floating } }*/; MEMEApp.getLF().makeTransparent(jScriptScrollPane); // Ezt nem szabad bekapcsolni mert akkor sajnos rosszul szamolja a meretet // es a JScrollPane-ben a fugg.scrollbar letakarhatja a listaelemek veget. // Ezen esetleg a LookAndFeel.makeTransparent() tud segiteni. //tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); java.awt.Component columnProps = FormsUtils.titledPanel(" Column properties ", FormsUtils.build("- d:g ~~ f:max(120dlu;pref)", "01|%|02|~|03 f:m:g", // Left side #0 FormsUtils.build("pref ' 25dlu:g ' 30px", "011 p|~|" + "233||" + "444||" + "555||" + "666||" + "777||" + "889 f:d:g", "&Column name:", jColNameTextField, // 0-1 "Aggregative operation:", jAggregateCombo, // 2-3 FormsUtils.build("l:d:g'r:m'20dlu", "012", jSplittedCheckBox, jNamingDelimiter, jSplittedDelimTextField).getPanel(), // 4 jHiddenCheckBox, CellConstraints.LEFT, // 5 jForceAggregateCheckBox, // 6 FormsUtils.build("l:m:g = r:m'22px'22px'22px'22px'p", "0123456 p", jScriptCheckBox, jResultTypeLabel, jBooleanDataTypeButton, jIntDataTypeButton, jRealDataTypeButton, jStringDataTypeButton, jHelpButton).getPanel(), // 7 jScriptScrollPane, new CellInsets(0, 20, 0, 0), // 8 jScriptEEButton, CellConstraints.TOP // 9 ).getPanel(), // Right side #1,2,3 FormsUtils.build("0:g, fill:max(40dlu;pref) % fill:max(40dlu;pref), 0:g", "[ColGroups=24]" + "_01_ p", jAddButton, jCancelButton).getPanel(), "Available parameters:", jParListTabbedPane)) .getPanel(); /*boolean useToolbar = false; if (useToolbar) { JToolBar tb = new JToolBar("Column properties", JToolBar.HORIZONTAL); tb.add(columnProps); columnProps = tb; }*/ box.add(columnProps); panel.add(box, BorderLayout.CENTER); }
From source file:anl.verdi.plot.anim.MultiPlotAnimation.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); separator1 = compFactory.createSeparator("Select Plots"); scrollPane1 = new JScrollPane(); plotList = new CheckBoxList(); panel1 = new JPanel(); label1 = new JLabel(); startSpinner = new JSpinner(); startLbl = new JLabel(); label2 = new JLabel(); endSpinner = new JSpinner(); endLbl = new JLabel(); panel2 = new JPanel(); gifChk = new JCheckBox(); gifFileLbl = new JLabel(); gifFileBtn = new JButton(); separator2 = compFactory.createSeparator(""); CellConstraints cc = new CellConstraints(); //======== this ======== // 2014//from www .j av a 2s. com ColumnSpec[] aColumnSpec = ColumnSpec.decodeSpecs("default:grow"); RowSpec aRowSpec = new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5); RowSpec bRowSpec = new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5); setLayout(new FormLayout(aColumnSpec, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, aRowSpec, FormFactory.RELATED_GAP_ROWSPEC, bRowSpec, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // setLayout(new FormLayout( // ColumnSpec.decodeSpecs("default:grow"), // new RowSpec[] { // FormFactory.DEFAULT_ROWSPEC, // FormFactory.RELATED_GAP_ROWSPEC, // new RowSpec(RowSpec.TOP, Sizes.dluY(84), 0.5), // FormFactory.RELATED_GAP_ROWSPEC, // new RowSpec(RowSpec.FILL, Sizes.PREFERRED, 0.5), // FormFactory.RELATED_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC, // FormFactory.LINE_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC // })); add(separator1, cc.xy(1, 1)); //======== scrollPane1 ======== { scrollPane1.setViewportView(plotList); } add(scrollPane1, cc.xy(1, 3)); //======== panel1 ======== { // 2014 ColumnSpec[] dColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu)"); ColumnSpec[] eColumnSpec = ColumnSpec.decodeSpecs("max(pref;40dlu):grow"); panel1.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, dColumnSpec[0], FormFactory.UNRELATED_GAP_COLSPEC, eColumnSpec[0] }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // panel1.setLayout(new FormLayout( // new ColumnSpec[] { // new ColumnSpec(Sizes.dluX(71)), // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // new ColumnSpec("max(pref;40dlu)"), // FormFactory.UNRELATED_GAP_COLSPEC, // new ColumnSpec("max(pref;40dlu):grow") // }, // new RowSpec[] { // FormFactory.DEFAULT_ROWSPEC, // FormFactory.LINE_GAP_ROWSPEC, // FormFactory.DEFAULT_ROWSPEC // })); //---- label1 ---- label1.setText("Starting Time Step:"); panel1.add(label1, cc.xy(1, 1)); panel1.add(startSpinner, cc.xy(3, 1)); //---- startLbl ---- startLbl.setFont(new Font("Tahoma", Font.BOLD, 11)); panel1.add(startLbl, cc.xy(5, 1)); //---- label2 ---- label2.setText("Ending Time Step:"); panel1.add(label2, cc.xy(1, 3)); panel1.add(endSpinner, cc.xy(3, 3)); //---- endLbl ---- endLbl.setFont(new Font("Tahoma", Font.BOLD, 11)); panel1.add(endLbl, cc.xy(5, 3)); } add(panel1, cc.xywh(1, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.TOP)); //======== panel2 ======== { // 2014 ColumnSpec fColumnSpec = new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW); RowSpec[] fRowSpec = RowSpec.decodeSpecs("default"); panel2.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, fColumnSpec, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, fRowSpec)); // panel2.setLayout(new FormLayout( // new ColumnSpec[] { // FormFactory.DEFAULT_COLSPEC, // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), // FormFactory.LABEL_COMPONENT_GAP_COLSPEC, // FormFactory.DEFAULT_COLSPEC // }, // RowSpec.decodeSpecs("default"))); //---- gifChk ---- gifChk.setText("Make Animated GIF(s)"); panel2.add(gifChk, cc.xy(1, 1)); panel2.add(gifFileLbl, cc.xy(3, 1)); //---- gifFileBtn ---- gifFileBtn.setText("..."); gifFileBtn.setMaximumSize(new Dimension(23, 23)); gifFileBtn.setMinimumSize(new Dimension(23, 23)); gifFileBtn.setPreferredSize(new Dimension(23, 23)); gifFileBtn.setEnabled(false); panel2.add(gifFileBtn, cc.xy(5, 1)); } add(panel2, cc.xy(1, 7)); add(separator2, cc.xy(1, 9)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:au.gov.nla.atplugin.multiplecomponentidentifiers.panel.ResourceBasicInfoPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license panel2 = new JPanel(); label_resourcesTitle = new JLabel(); scrollPane2 = new JScrollPane(); resourcesTitle = ATBasicComponentFactory .createTextArea(detailsModel.getModel(ArchDescription.PROPERTYNAME_TITLE), false); tagApplicatorPanel = new JPanel(); insertInlineTag = ATBasicComponentFactory .createUnboundComboBox(InLineTagsUtils.getInLineTagList(InLineTagsUtils.TITLE)); panel38 = new JPanel(); panel35 = new JPanel(); label_resourcesDateExpression = new JLabel(); resourcesDateExpression = ATBasicComponentFactory .createTextField(detailsModel.getModel(ArchDescription.PROPERTYNAME_DATE_EXPRESSION), false); Date1Label1 = new JLabel(); label_resourcesDateBegin = new JLabel(); resourcesDateBegin = ATBasicComponentFactory.createIntegerField(detailsModel, ArchDescription.PROPERTYNAME_DATE_BEGIN); label_resourcesDateEnd = new JLabel(); resourcesDateEnd = ATBasicComponentFactory.createIntegerField(detailsModel, ArchDescription.PROPERTYNAME_DATE_END); BulkDatesLabel = new JLabel(); label_resourcesBulkDateBegin = new JLabel(); resourcesBulkDateBegin = ATBasicComponentFactory.createIntegerField(detailsModel, Resources.PROPERTYNAME_BULK_DATE_BEGIN); label_resourcesBulkDateEnd = new JLabel(); resourcesBulkDateEnd = ATBasicComponentFactory.createIntegerField(detailsModel, Resources.PROPERTYNAME_BULK_DATE_END); panel3 = new JPanel(); label_resourcesLanguageCode = new JLabel(); resourcesLanguageCode = ATBasicComponentFactory.createComboBox(detailsModel, Resources.PROPERTYNAME_LANGUAGE_CODE, Resources.class); panel37 = new JPanel(); panel20 = new JPanel(); ExtentLabel = new JLabel(); panel21 = new JPanel(); label_resourcesExtentNumber = new JLabel(); resourcesExtentNumber = ATBasicComponentFactory.createDoubleField(detailsModel, Resources.PROPERTYNAME_EXTENT_NUMBER); extentType = ATBasicComponentFactory.createComboBox(detailsModel, Resources.PROPERTYNAME_EXTENT_TYPE, Resources.class); label_resourcesExtentDescription = new JLabel(); scrollPane422 = new JScrollPane(); containerSummary = ATBasicComponentFactory .createTextArea(detailsModel.getModel(Resources.PROPERTYNAME_CONTAINER_SUMMARY), false); label_resourcesLanguageNote = new JLabel(); scrollPane423 = new JScrollPane(); resourcesLanguageNote = ATBasicComponentFactory .createTextArea(detailsModel.getModel(Resources.PROPERTYNAME_REPOSITORY_PROCESSING_NOTE), false); panel6 = new JPanel(); label_agreementReceived2 = new JLabel(); repositoryName = new JTextField(); changeRepositoryButton = new JButton(); separator2 = new JSeparator(); panel13 = new JPanel(); panel12 = new JPanel(); label_resourceIdentifier1 = new JLabel(); resourceIdentifier1 = ATBasicComponentFactory .createTextField(detailsModel.getModel(Resources.PROPERTYNAME_RESOURCE_IDENTIFIER_1)); resourceIdentifier2 = ATBasicComponentFactory .createTextField(detailsModel.getModel(Resources.PROPERTYNAME_RESOURCE_IDENTIFIER_2)); resourceIdentifier3 = ATBasicComponentFactory .createTextField(detailsModel.getModel(Resources.PROPERTYNAME_RESOURCE_IDENTIFIER_3)); resourceIdentifier4 = ATBasicComponentFactory .createTextField(detailsModel.getModel(Resources.PROPERTYNAME_RESOURCE_IDENTIFIER_4)); panel19 = new JPanel(); label_resourcesLevel = new JLabel(); resourcesLevel = ATBasicComponentFactory.createComboBox(detailsModel, Resources.PROPERTYNAME_LEVEL, Resources.class); label_otherLevel = new JLabel(); resourcesOtherLevel = ATBasicComponentFactory .createTextField(detailsModel.getModel(Resources.PROPERTYNAME_OTHER_LEVEL), false); label_repositoryName5 = new JLabel(); scrollPane9 = new JScrollPane(); identifiersTable = new DomainSortableTable(); panel23 = new JPanel(); addIdentifier = new JButton(); removeIdentifier = new JButton(); label1 = new JLabel(); scrollPane6 = new JScrollPane(); instancesTable = new DomainSortableTable(ArchDescriptionInstances.class, ArchDescriptionInstances.PROPERTYNAME_INSTANCE_TYPE); panel29 = new JPanel(); addInstanceButton = new JButton(); removeInstanceButton = new JButton(); restrictionsApply = ATBasicComponentFactory.createCheckBox(detailsModel, ArchDescription.PROPERTYNAME_RESTRICTIONS_APPLY, Resources.class); OtherAccessionsLabel = new JLabel(); scrollPane4 = new JScrollPane(); accessionsTable = new DomainSortableTable(); CellConstraints cc = new CellConstraints(); //======== this ======== setBackground(new Color(200, 205, 232)); setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("left:max(default;300px):grow") }, RowSpec.decodeSpecs("default"))); //======== panel2 ======== {//from www . ja va 2 s . co m panel2.setBackground(new Color(200, 205, 232)); panel2.setLayout(new FormLayout("default:grow", "fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow, fill:default:grow")); //---- label_resourcesTitle ---- label_resourcesTitle.setText("Title"); label_resourcesTitle.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesTitle, Resources.class, Resources.PROPERTYNAME_TITLE); panel2.add(label_resourcesTitle, cc.xy(1, 1)); //======== scrollPane2 ======== { //---- resourcesTitle ---- resourcesTitle.setRows(4); resourcesTitle.setLineWrap(true); resourcesTitle.setWrapStyleWord(true); resourcesTitle.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane2.setViewportView(resourcesTitle); } panel2.add(scrollPane2, cc.xy(1, 2)); //======== tagApplicatorPanel ======== { tagApplicatorPanel.setOpaque(false); tagApplicatorPanel .setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- insertInlineTag ---- insertInlineTag.setOpaque(false); insertInlineTag.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); insertInlineTag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { insertInlineTagActionPerformed(); } }); tagApplicatorPanel.add(insertInlineTag, cc.xy(1, 1)); } panel2.add(tagApplicatorPanel, cc.xy(1, 3)); //======== panel38 ======== { panel38.setBorder(new BevelBorder(BevelBorder.LOWERED)); panel38.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel38.setBackground(new Color(182, 187, 212)); panel38.setLayout(new FormLayout("60px:grow", "fill:default:grow")); //======== panel35 ======== { panel35.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.setOpaque(false); panel35.setBorder(Borders.DLU2_BORDER); panel35.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label_resourcesDateExpression ---- label_resourcesDateExpression.setText("Date Expression"); label_resourcesDateExpression.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateExpression, Resources.class, Resources.PROPERTYNAME_DATE_EXPRESSION); panel35.add(label_resourcesDateExpression, cc.xywh(2, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- resourcesDateExpression ---- resourcesDateExpression.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateExpression, new CellConstraints(4, 1, 5, 1, CellConstraints.DEFAULT, CellConstraints.TOP, new Insets(0, 0, 0, 5))); //---- Date1Label1 ---- Date1Label1.setText("Inclusive Dates"); Date1Label1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(Date1Label1, new CellConstraints(2, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); //---- label_resourcesDateBegin ---- label_resourcesDateBegin.setText("Begin"); label_resourcesDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateBegin, Resources.class, Resources.PROPERTYNAME_DATE_BEGIN); panel35.add(label_resourcesDateBegin, cc.xy(4, 3)); //---- resourcesDateBegin ---- resourcesDateBegin.setColumns(4); resourcesDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateBegin, cc.xywh(6, 3, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- label_resourcesDateEnd ---- label_resourcesDateEnd.setText("End"); label_resourcesDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateEnd, Resources.class, Resources.PROPERTYNAME_DATE_END); panel35.add(label_resourcesDateEnd, cc.xy(8, 3)); //---- resourcesDateEnd ---- resourcesDateEnd.setColumns(4); resourcesDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateEnd, new CellConstraints(10, 3, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); //---- BulkDatesLabel ---- BulkDatesLabel.setText("Bulk Dates"); BulkDatesLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(BulkDatesLabel, new CellConstraints(2, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); //---- label_resourcesBulkDateBegin ---- label_resourcesBulkDateBegin.setText("Begin"); label_resourcesBulkDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesBulkDateBegin, Resources.class, Resources.PROPERTYNAME_BULK_DATE_BEGIN); panel35.add(label_resourcesBulkDateBegin, cc.xy(4, 5)); //---- resourcesBulkDateBegin ---- resourcesBulkDateBegin.setColumns(4); resourcesBulkDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesBulkDateBegin, cc.xywh(6, 5, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- label_resourcesBulkDateEnd ---- label_resourcesBulkDateEnd.setText("End"); label_resourcesBulkDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesBulkDateEnd, Resources.class, Resources.PROPERTYNAME_BULK_DATE_END); panel35.add(label_resourcesBulkDateEnd, cc.xy(8, 5)); //---- resourcesBulkDateEnd ---- resourcesBulkDateEnd.setColumns(4); resourcesBulkDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesBulkDateEnd, new CellConstraints(10, 5, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); } panel38.add(panel35, cc.xy(1, 1)); } panel2.add(panel38, cc.xy(1, 4)); //======== panel3 ======== { panel3.setBackground(new Color(200, 205, 232)); panel3.setLayout( new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("200px") }, RowSpec.decodeSpecs("fill:default:grow"))); //---- label_resourcesLanguageCode ---- label_resourcesLanguageCode.setText("Language"); label_resourcesLanguageCode.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLanguageCode, Resources.class, Resources.PROPERTYNAME_LANGUAGE_CODE); panel3.add(label_resourcesLanguageCode, cc.xy(1, 1)); //---- resourcesLanguageCode ---- resourcesLanguageCode.setMaximumSize(new Dimension(50, 27)); resourcesLanguageCode.setOpaque(false); resourcesLanguageCode.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel3.add(resourcesLanguageCode, cc.xywh(2, 1, 2, 1)); } panel2.add(panel3, cc.xy(1, 5)); //======== panel37 ======== { panel37.setBorder(new BevelBorder(BevelBorder.LOWERED)); panel37.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel37.setBackground(new Color(182, 187, 212)); panel37.setLayout(new FormLayout("60px:grow", "fill:default:grow")); //======== panel20 ======== { panel20.setOpaque(false); panel20.setBorder(Borders.DLU2_BORDER); panel20.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.UNRELATED_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) })); //---- ExtentLabel ---- ExtentLabel.setText("Extent"); ExtentLabel.setForeground(new Color(0, 0, 102)); ExtentLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel20.add(ExtentLabel, cc.xywh(1, 1, 2, 1)); //======== panel21 ======== { panel21.setOpaque(false); panel21.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- label_resourcesExtentNumber ---- label_resourcesExtentNumber.setText("Extent"); label_resourcesExtentNumber.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesExtentNumber, Resources.class, Resources.PROPERTYNAME_EXTENT_NUMBER); panel21.add(label_resourcesExtentNumber, cc.xywh(1, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- resourcesExtentNumber ---- resourcesExtentNumber.setColumns(4); resourcesExtentNumber.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel21.add(resourcesExtentNumber, cc.xywh(3, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- extentType ---- extentType.setOpaque(false); extentType.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel21.add(extentType, new CellConstraints(5, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT, new Insets(0, 5, 5, 5))); } panel20.add(panel21, cc.xy(2, 3)); //---- label_resourcesExtentDescription ---- label_resourcesExtentDescription.setText("Container Summary"); label_resourcesExtentDescription.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesExtentDescription, Resources.class, Resources.PROPERTYNAME_CONTAINER_SUMMARY); panel20.add(label_resourcesExtentDescription, cc.xy(2, 5)); //======== scrollPane422 ======== { scrollPane422.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane422.setOpaque(false); scrollPane422.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- containerSummary ---- containerSummary.setRows(4); containerSummary.setWrapStyleWord(true); containerSummary.setLineWrap(true); containerSummary.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane422.setViewportView(containerSummary); } panel20.add(scrollPane422, new CellConstraints(1, 7, 2, 1, CellConstraints.DEFAULT, CellConstraints.FILL, new Insets(0, 15, 5, 5))); } panel37.add(panel20, cc.xywh(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); } panel2.add(panel37, cc.xy(1, 6)); //---- label_resourcesLanguageNote ---- label_resourcesLanguageNote.setText("Repository Processing Note"); label_resourcesLanguageNote.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLanguageNote, Resources.class, Resources.PROPERTYNAME_REPOSITORY_PROCESSING_NOTE); panel2.add(label_resourcesLanguageNote, cc.xy(1, 7)); //======== scrollPane423 ======== { scrollPane423.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane423.setOpaque(false); scrollPane423.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- resourcesLanguageNote ---- resourcesLanguageNote.setRows(4); resourcesLanguageNote.setLineWrap(true); resourcesLanguageNote.setWrapStyleWord(true); resourcesLanguageNote.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane423.setViewportView(resourcesLanguageNote); } panel2.add(scrollPane423, cc.xy(1, 8)); //======== panel6 ======== { panel6.setOpaque(false); panel6.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel6.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- label_agreementReceived2 ---- label_agreementReceived2.setText("Repository:"); label_agreementReceived2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_agreementReceived2, Resources.class, Resources.PROPERTYNAME_REPOSITORY); panel6.add(label_agreementReceived2, cc.xy(1, 1)); //---- repositoryName ---- repositoryName.setEditable(false); repositoryName.setOpaque(false); repositoryName.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); repositoryName.setBorder(null); panel6.add(repositoryName, cc.xy(3, 1)); //---- changeRepositoryButton ---- changeRepositoryButton.setText("Change"); changeRepositoryButton.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); changeRepositoryButton.setOpaque(false); changeRepositoryButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { changeRepositoryButtonActionPerformed(); } }); panel6.add(changeRepositoryButton, cc.xywh(5, 1, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); } panel2.add(panel6, cc.xy(1, 9)); } add(panel2, cc.xy(1, 1)); //---- separator2 ---- separator2.setForeground(new Color(147, 131, 86)); separator2.setOrientation(SwingConstants.VERTICAL); add(separator2, cc.xy(3, 1)); //======== panel13 ======== { panel13.setOpaque(false); panel13.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel13.setBorder(Borders.DLU2_BORDER); panel13.setLayout(new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.CENTER, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC })); //======== panel12 ======== { panel12.setBackground(new Color(231, 188, 251)); panel12.setOpaque(false); panel12.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel12.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); ((FormLayout) panel12.getLayout()).setColumnGroups(new int[][] { { 3, 5, 7, 9 } }); //---- label_resourceIdentifier1 ---- label_resourceIdentifier1.setText("Resource ID"); label_resourceIdentifier1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourceIdentifier1, Resources.class, Resources.PROPERTYNAME_RESOURCE_IDENTIFIER); panel12.add(label_resourceIdentifier1, cc.xy(1, 1)); //---- resourceIdentifier1 ---- resourceIdentifier1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel12.add(resourceIdentifier1, cc.xy(3, 1)); //---- resourceIdentifier2 ---- resourceIdentifier2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel12.add(resourceIdentifier2, cc.xy(5, 1)); //---- resourceIdentifier3 ---- resourceIdentifier3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel12.add(resourceIdentifier3, cc.xy(7, 1)); //---- resourceIdentifier4 ---- resourceIdentifier4.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel12.add(resourceIdentifier4, cc.xy(9, 1)); } panel13.add(panel12, cc.xy(1, 1)); //======== panel19 ======== { panel19.setOpaque(false); panel19.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel19.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), new ColumnSpec(Sizes.DLUX3), new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- label_resourcesLevel ---- label_resourcesLevel.setText("Level"); label_resourcesLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLevel, Resources.class, Resources.PROPERTYNAME_LEVEL); panel19.add(label_resourcesLevel, cc.xywh(1, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- resourcesLevel ---- resourcesLevel.setOpaque(false); resourcesLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); resourcesLevel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resourcesLevelActionPerformed(); } }); panel19.add(resourcesLevel, cc.xywh(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- label_otherLevel ---- label_otherLevel.setText("Other Level"); label_otherLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_otherLevel, Resources.class, Resources.PROPERTYNAME_OTHER_LEVEL); panel19.add(label_otherLevel, cc.xy(5, 1)); //---- resourcesOtherLevel ---- resourcesOtherLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel19.add(resourcesOtherLevel, new CellConstraints(7, 1, 3, 1, CellConstraints.FILL, CellConstraints.TOP, new Insets(0, 0, 0, 5))); } panel13.add(panel19, cc.xy(1, 3)); //---- label_repositoryName5 ---- label_repositoryName5.setText("Identifiers"); label_repositoryName5.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel13.add(label_repositoryName5, cc.xy(1, 5)); //======== scrollPane9 ======== { scrollPane9.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane9.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane9.setPreferredSize(new Dimension(200, 104)); //---- identifiersTable ---- identifiersTable.setPreferredScrollableViewportSize(new Dimension(200, 100)); identifiersTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { identifiersMouseClicked(e); } }); scrollPane9.setViewportView(identifiersTable); } panel13.add(scrollPane9, cc.xywh(1, 7, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //======== panel23 ======== { panel23.setBackground(new Color(231, 188, 251)); panel23.setOpaque(false); panel23.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel23.setMinimumSize(new Dimension(100, 29)); panel23.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- addIdentifier ---- addIdentifier.setText("Add Identifier"); addIdentifier.setOpaque(false); addIdentifier.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); addIdentifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addIdentifierActionPerformed(); } }); panel23.add(addIdentifier, cc.xy(1, 1)); //---- removeIdentifier ---- removeIdentifier.setText("Remove Identifier"); removeIdentifier.setOpaque(false); removeIdentifier.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); removeIdentifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeIdentifierActionPerformed(); } }); panel23.add(removeIdentifier, cc.xy(3, 1)); } panel13.add(panel23, cc.xywh(1, 9, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); //---- label1 ---- label1.setText("Instances"); label1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label1, Resources.class, ResourcesComponents.PROPERTYNAME_INSTANCES); panel13.add(label1, cc.xy(1, 11)); //======== scrollPane6 ======== { scrollPane6.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane6.setOpaque(false); scrollPane6.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- instancesTable ---- instancesTable.setPreferredScrollableViewportSize(new Dimension(200, 75)); instancesTable.setRowHeight(20); instancesTable.setFocusable(false); instancesTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { instancesTableMouseClicked(e); } }); scrollPane6.setViewportView(instancesTable); } panel13.add(scrollPane6, cc.xywh(1, 13, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //======== panel29 ======== { panel29.setBackground(new Color(231, 188, 251)); panel29.setOpaque(false); panel29.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel29.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, RowSpec.decodeSpecs("default"))); //---- addInstanceButton ---- addInstanceButton.setText("Add Instance"); addInstanceButton.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); addInstanceButton.setOpaque(false); addInstanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addInstanceButtonActionPerformed(); } }); panel29.add(addInstanceButton, cc.xy(1, 1)); //---- removeInstanceButton ---- removeInstanceButton.setText("Remove Instance"); removeInstanceButton.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); removeInstanceButton.setOpaque(false); removeInstanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeInstanceButtonActionPerformed(); } }); panel29.add(removeInstanceButton, cc.xy(3, 1)); } panel13.add(panel29, cc.xywh(1, 15, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); //---- restrictionsApply ---- restrictionsApply.setText("Restrictions Apply"); restrictionsApply.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); restrictionsApply.setOpaque(false); restrictionsApply.setText( ATFieldInfo.getLabel(Resources.class, ArchDescription.PROPERTYNAME_RESTRICTIONS_APPLY)); panel13.add(restrictionsApply, cc.xy(1, 17)); //---- OtherAccessionsLabel ---- OtherAccessionsLabel.setText("Accessions linked to this Resource ID:"); OtherAccessionsLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel13.add(OtherAccessionsLabel, cc.xy(1, 19)); //======== scrollPane4 ======== { scrollPane4.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane4.setPreferredSize(new Dimension(300, 100)); scrollPane4.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- accessionsTable ---- accessionsTable.setPreferredScrollableViewportSize(new Dimension(300, 100)); accessionsTable.setFocusable(false); scrollPane4.setViewportView(accessionsTable); } panel13.add(scrollPane4, cc.xywh(1, 21, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); } add(panel13, cc.xywh(5, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:au.gov.nla.atplugin.multiplecomponentidentifiers.panel.ResourceComponentBasicInfoPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license panel7 = new JPanel(); label_resourcesTitle = new JLabel(); scrollPane42 = new JScrollPane(); resourcesTitle = ATBasicComponentFactory .createTextArea(detailsModel.getModel(ArchDescription.PROPERTYNAME_TITLE), false); tagApplicatorPanel = new JPanel(); insertInlineTag = ATBasicComponentFactory .createUnboundComboBox(InLineTagsUtils.getInLineTagList(InLineTagsUtils.TITLE)); panel38 = new JPanel(); panel35 = new JPanel(); label_resourcesDateExpression = new JLabel(); resourcesDateExpression = ATBasicComponentFactory .createTextField(detailsModel.getModel(ArchDescription.PROPERTYNAME_DATE_EXPRESSION), false); Date1Label1 = new JLabel(); label_resourcesDateBegin = new JLabel(); resourcesDateBegin = ATBasicComponentFactory.createIntegerField(detailsModel, ArchDescription.PROPERTYNAME_DATE_BEGIN); label_resourcesDateEnd = new JLabel(); resourcesDateEnd = ATBasicComponentFactory.createIntegerField(detailsModel, ArchDescription.PROPERTYNAME_DATE_END); BulkDatesLabel = new JLabel(); label_resourcesBulkDateBegin = new JLabel(); resourcesBulkDateBegin = ATBasicComponentFactory.createIntegerField(detailsModel, Resources.PROPERTYNAME_BULK_DATE_BEGIN); label_resourcesBulkDateEnd = new JLabel(); resourcesBulkDateEnd = ATBasicComponentFactory.createIntegerField(detailsModel, Resources.PROPERTYNAME_BULK_DATE_END); panel9 = new JPanel(); label_resourcesLanguageCode2 = new JLabel(); resourcesLanguageCode = ATBasicComponentFactory.createComboBox(detailsModel, ResourcesComponents.PROPERTYNAME_LANGUAGE_CODE, ResourcesComponents.class); panel5 = new JPanel(); panel20 = new JPanel(); ExtentLabel = new JLabel(); panel21 = new JPanel(); label_resourcesExtentNumber = new JLabel(); resourcesExtentNumber = ATBasicComponentFactory.createDoubleField(detailsModel, Resources.PROPERTYNAME_EXTENT_NUMBER); extentType = ATBasicComponentFactory.createComboBox(detailsModel, Resources.PROPERTYNAME_EXTENT_TYPE, Resources.class); label_resourcesExtentDescription = new JLabel(); scrollPane422 = new JScrollPane(); containerSummary = ATBasicComponentFactory .createTextArea(detailsModel.getModel(Resources.PROPERTYNAME_CONTAINER_SUMMARY), false); panel23 = new JPanel(); label_resourcesLanguageNote2 = new JLabel(); scrollPane423 = new JScrollPane(); resourcesLanguageNote = ATBasicComponentFactory.createTextArea( detailsModel.getModel(ResourcesComponents.PROPERTYNAME_REPOSITORY_PROCESSING_NOTE), false); separator2 = new JSeparator(); panel10 = new JPanel(); panel3 = new JPanel(); label_resourcesLevel = new JLabel(); resourcesLevel = ATBasicComponentFactory.createComboBox(detailsModel, ResourcesComponents.PROPERTYNAME_LEVEL, ResourcesComponents.class); label3 = new JLabel(); resourcesDateBegin2 = ATBasicComponentFactory .createTextField(detailsModel.getModel(ResourcesComponents.PROPERTYNAME_PERSISTENT_ID)); label_otherLevel = new JLabel(); resourcesOtherLevel = ATBasicComponentFactory .createTextField(detailsModel.getModel(ResourcesComponents.PROPERTYNAME_OTHER_LEVEL), false); label_repositoryName5 = new JLabel(); scrollPane9 = new JScrollPane(); identifiersTable = new DomainSortableTable(); panel25 = new JPanel(); addIdentifier = new JButton(); removeIdentifier = new JButton(); label1 = new JLabel(); scrollPane4 = new JScrollPane(); instancesTable = new DomainSortableTable(ArchDescriptionInstances.class, ArchDescriptionInstances.PROPERTYNAME_INSTANCE_TYPE); panel24 = new JPanel(); addInstanceButton = new JButton(); removeInstanceButton = new JButton(); panel4 = new JPanel(); restrictionsApply2 = ATBasicComponentFactory.createCheckBox(detailsModel, ResourcesComponents.PROPERTYNAME_INTERNAL_ONLY, ResourcesComponents.class); resourcesRestrictionsApply = ATBasicComponentFactory.createCheckBox(detailsModel, ArchDescription.PROPERTYNAME_RESTRICTIONS_APPLY, ResourcesComponents.class); CellConstraints cc = new CellConstraints(); //======== this ======== setBackground(new Color(200, 205, 232)); setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, 0.5), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("max(default;350px):grow") }, RowSpec.decodeSpecs("default"))); //======== panel7 ======== {/*from ww w .j av a 2s. c o m*/ panel7.setOpaque(false); panel7.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel7.setBorder(Borders.DLU2_BORDER); panel7.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC }, new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) })); //---- label_resourcesTitle ---- label_resourcesTitle.setText("Title"); label_resourcesTitle.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesTitle, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_TITLE); panel7.add(label_resourcesTitle, cc.xy(1, 1)); //======== scrollPane42 ======== { scrollPane42.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane42.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- resourcesTitle ---- resourcesTitle.setRows(4); resourcesTitle.setLineWrap(true); resourcesTitle.setWrapStyleWord(true); resourcesTitle.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane42.setViewportView(resourcesTitle); } panel7.add(scrollPane42, cc.xywh(1, 3, 2, 1)); //======== tagApplicatorPanel ======== { tagApplicatorPanel.setOpaque(false); tagApplicatorPanel .setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- insertInlineTag ---- insertInlineTag.setOpaque(false); insertInlineTag.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); insertInlineTag.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { insertInlineTagActionPerformed(); } }); tagApplicatorPanel.add(insertInlineTag, cc.xy(1, 1)); } panel7.add(tagApplicatorPanel, cc.xywh(1, 5, 2, 1)); //======== panel38 ======== { panel38.setBorder(new BevelBorder(BevelBorder.LOWERED)); panel38.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel38.setBackground(new Color(182, 187, 212)); panel38.setLayout(new FormLayout("60px:grow", "fill:default:grow")); //======== panel35 ======== { panel35.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.setOpaque(false); panel35.setBorder(Borders.DLU2_BORDER); panel35.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label_resourcesDateExpression ---- label_resourcesDateExpression.setText("Date Expression"); label_resourcesDateExpression.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateExpression, Resources.class, Resources.PROPERTYNAME_DATE_EXPRESSION); panel35.add(label_resourcesDateExpression, cc.xywh(2, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- resourcesDateExpression ---- resourcesDateExpression.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateExpression, new CellConstraints(4, 1, 5, 1, CellConstraints.DEFAULT, CellConstraints.TOP, new Insets(0, 0, 0, 5))); //---- Date1Label1 ---- Date1Label1.setText("Inclusive Dates"); Date1Label1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(Date1Label1, new CellConstraints(2, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); //---- label_resourcesDateBegin ---- label_resourcesDateBegin.setText("Begin"); label_resourcesDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateBegin, Resources.class, Resources.PROPERTYNAME_DATE_BEGIN); panel35.add(label_resourcesDateBegin, cc.xy(4, 3)); //---- resourcesDateBegin ---- resourcesDateBegin.setColumns(4); resourcesDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateBegin, cc.xywh(6, 3, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- label_resourcesDateEnd ---- label_resourcesDateEnd.setText("End"); label_resourcesDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesDateEnd, Resources.class, Resources.PROPERTYNAME_DATE_END); panel35.add(label_resourcesDateEnd, cc.xy(8, 3)); //---- resourcesDateEnd ---- resourcesDateEnd.setColumns(4); resourcesDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesDateEnd, new CellConstraints(10, 3, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); //---- BulkDatesLabel ---- BulkDatesLabel.setText("Bulk Dates"); BulkDatesLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(BulkDatesLabel, new CellConstraints(2, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 5, 0, 0))); //---- label_resourcesBulkDateBegin ---- label_resourcesBulkDateBegin.setText("Begin"); label_resourcesBulkDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesBulkDateBegin, Resources.class, Resources.PROPERTYNAME_BULK_DATE_BEGIN); panel35.add(label_resourcesBulkDateBegin, cc.xy(4, 5)); //---- resourcesBulkDateBegin ---- resourcesBulkDateBegin.setColumns(4); resourcesBulkDateBegin.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesBulkDateBegin, cc.xywh(6, 5, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- label_resourcesBulkDateEnd ---- label_resourcesBulkDateEnd.setText("End"); label_resourcesBulkDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesBulkDateEnd, Resources.class, Resources.PROPERTYNAME_BULK_DATE_END); panel35.add(label_resourcesBulkDateEnd, cc.xy(8, 5)); //---- resourcesBulkDateEnd ---- resourcesBulkDateEnd.setColumns(4); resourcesBulkDateEnd.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel35.add(resourcesBulkDateEnd, new CellConstraints(10, 5, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT, new Insets(0, 0, 0, 5))); } panel38.add(panel35, cc.xy(1, 1)); } panel7.add(panel38, cc.xywh(1, 7, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //======== panel9 ======== { panel9.setOpaque(false); panel9.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("left:min(default;200px)") }, RowSpec.decodeSpecs("default"))); //---- label_resourcesLanguageCode2 ---- label_resourcesLanguageCode2.setText("Lanaguage"); label_resourcesLanguageCode2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLanguageCode2, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_LANGUAGE_CODE); panel9.add(label_resourcesLanguageCode2, cc.xy(1, 1)); //---- resourcesLanguageCode ---- resourcesLanguageCode.setMaximumSize(new Dimension(150, 32767)); resourcesLanguageCode.setOpaque(false); resourcesLanguageCode.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel9.add(resourcesLanguageCode, cc.xywh(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); } panel7.add(panel9, cc.xy(1, 9)); //======== panel5 ======== { panel5.setBackground(new Color(182, 187, 212)); panel5.setBorder(new BevelBorder(BevelBorder.LOWERED)); panel5.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel5.setLayout(new FormLayout("default:grow", "fill:default:grow")); //======== panel20 ======== { panel20.setOpaque(false); panel20.setBorder(Borders.DLU2_BORDER); panel20.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.UNRELATED_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) })); //---- ExtentLabel ---- ExtentLabel.setText("Extent"); ExtentLabel.setForeground(new Color(0, 0, 102)); ExtentLabel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel20.add(ExtentLabel, cc.xywh(1, 1, 2, 1)); //======== panel21 ======== { panel21.setOpaque(false); panel21.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- label_resourcesExtentNumber ---- label_resourcesExtentNumber.setText("Extent"); label_resourcesExtentNumber.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesExtentNumber, Resources.class, Resources.PROPERTYNAME_EXTENT_NUMBER); panel21.add(label_resourcesExtentNumber, cc.xywh(1, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- resourcesExtentNumber ---- resourcesExtentNumber.setColumns(4); resourcesExtentNumber.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel21.add(resourcesExtentNumber, cc.xywh(3, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- extentType ---- extentType.setOpaque(false); extentType.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel21.add(extentType, new CellConstraints(5, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT, new Insets(0, 5, 5, 5))); } panel20.add(panel21, cc.xy(2, 3)); //---- label_resourcesExtentDescription ---- label_resourcesExtentDescription.setText("Container Summary"); label_resourcesExtentDescription.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesExtentDescription, Resources.class, Resources.PROPERTYNAME_CONTAINER_SUMMARY); panel20.add(label_resourcesExtentDescription, cc.xy(2, 5)); //======== scrollPane422 ======== { scrollPane422.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane422.setOpaque(false); scrollPane422.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- containerSummary ---- containerSummary.setRows(4); containerSummary.setWrapStyleWord(true); containerSummary.setLineWrap(true); containerSummary.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane422.setViewportView(containerSummary); } panel20.add(scrollPane422, new CellConstraints(1, 7, 2, 1, CellConstraints.DEFAULT, CellConstraints.FILL, new Insets(0, 15, 5, 5))); } panel5.add(panel20, cc.xywh(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); } panel7.add(panel5, cc.xy(1, 11)); //======== panel23 ======== { panel23.setOpaque(false); panel23.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel23.setLayout(new FormLayout(ColumnSpec.decodeSpecs("default:grow"), new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) })); //---- label_resourcesLanguageNote2 ---- label_resourcesLanguageNote2.setText("Repository Processing Note"); label_resourcesLanguageNote2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLanguageNote2, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_REPOSITORY_PROCESSING_NOTE); panel23.add(label_resourcesLanguageNote2, new CellConstraints(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); //======== scrollPane423 ======== { scrollPane423.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane423.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- resourcesLanguageNote ---- resourcesLanguageNote.setRows(4); resourcesLanguageNote.setWrapStyleWord(true); resourcesLanguageNote.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane423.setViewportView(resourcesLanguageNote); } panel23.add(scrollPane423, new CellConstraints(1, 3, 1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT, new Insets(0, 10, 0, 0))); } panel7.add(panel23, cc.xy(1, 13)); } add(panel7, cc.xywh(1, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- separator2 ---- separator2.setForeground(new Color(147, 131, 86)); separator2.setOrientation(SwingConstants.VERTICAL); add(separator2, cc.xywh(3, 1, 1, 1, CellConstraints.FILL, CellConstraints.FILL)); //======== panel10 ======== { panel10.setOpaque(false); panel10.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel10.setBorder(Borders.DLU2_BORDER); panel10.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormFactory.LABEL_COMPONENT_GAP_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //======== panel3 ======== { panel3.setOpaque(false); panel3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel3.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.MIN_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.RIGHT, Sizes.DEFAULT, FormSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); //---- label_resourcesLevel ---- label_resourcesLevel.setText("Level"); label_resourcesLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_resourcesLevel, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_LEVEL); panel3.add(label_resourcesLevel, cc.xywh(1, 1, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- resourcesLevel ---- resourcesLevel.setOpaque(false); resourcesLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); resourcesLevel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resourcesLevelActionPerformed(); } }); panel3.add(resourcesLevel, cc.xywh(3, 1, 1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); //---- label3 ---- label3.setText("Persistent ID"); label3.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label3, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_PERSISTENT_ID); panel3.add(label3, cc.xy(1, 3)); //---- resourcesDateBegin2 ---- resourcesDateBegin2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); resourcesDateBegin2.setEditable(false); resourcesDateBegin2.setOpaque(false); panel3.add(resourcesDateBegin2, cc.xywh(3, 3, 3, 1)); //---- label_otherLevel ---- label_otherLevel.setText("Other Level"); label_otherLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); ATFieldInfo.assignLabelInfo(label_otherLevel, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_OTHER_LEVEL); panel3.add(label_otherLevel, cc.xywh(1, 5, 1, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); //---- resourcesOtherLevel ---- resourcesOtherLevel.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel3.add(resourcesOtherLevel, cc.xywh(3, 5, 3, 1)); } panel10.add(panel3, cc.xywh(1, 1, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //---- label_repositoryName5 ---- label_repositoryName5.setText("Identifiers"); label_repositoryName5.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel10.add(label_repositoryName5, cc.xy(1, 3)); //======== scrollPane9 ======== { scrollPane9.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane9.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); scrollPane9.setPreferredSize(new Dimension(200, 104)); //---- identifiersTable ---- identifiersTable.setPreferredScrollableViewportSize(new Dimension(200, 100)); identifiersTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { identifiersMouseClicked(e); } }); scrollPane9.setViewportView(identifiersTable); } panel10.add(scrollPane9, cc.xywh(1, 5, 1, 1, CellConstraints.DEFAULT, CellConstraints.FILL)); //======== panel25 ======== { panel25.setBackground(new Color(231, 188, 251)); panel25.setOpaque(false); panel25.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel25.setMinimumSize(new Dimension(100, 29)); panel25.setLayout( new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- addIdentifier ---- addIdentifier.setText("Add Identifier"); addIdentifier.setOpaque(false); addIdentifier.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); addIdentifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addIdentifierActionPerformed(); } }); panel25.add(addIdentifier, cc.xy(1, 1)); //---- removeIdentifier ---- removeIdentifier.setText("Remove Identifier"); removeIdentifier.setOpaque(false); removeIdentifier.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); removeIdentifier.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeIdentifierActionPerformed(); } }); panel25.add(removeIdentifier, cc.xy(3, 1)); } panel10.add(panel25, cc.xywh(1, 7, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); //---- label1 ---- label1.setText("Instances"); label1.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); label1.setBackground(new Color(238, 238, 238)); ATFieldInfo.assignLabelInfo(label1, ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_INSTANCES); panel10.add(label1, cc.xywh(1, 9, 2, 1)); //======== scrollPane4 ======== { scrollPane4.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane4.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); //---- instancesTable ---- instancesTable.setPreferredScrollableViewportSize(new Dimension(200, 75)); instancesTable.setRowHeight(20); instancesTable.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { instancesTableMouseClicked(e); } }); scrollPane4.setViewportView(instancesTable); } panel10.add(scrollPane4, cc.xy(1, 11)); //======== panel24 ======== { panel24.setBackground(new Color(231, 188, 251)); panel24.setOpaque(false); panel24.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); panel24.setMinimumSize(new Dimension(100, 29)); panel24.setLayout( new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- addInstanceButton ---- addInstanceButton.setBackground(new Color(231, 188, 251)); addInstanceButton.setText("Add Instance"); addInstanceButton.setOpaque(false); addInstanceButton.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); addInstanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addInstanceButtonActionPerformed(); } }); panel24.add(addInstanceButton, cc.xy(1, 1)); //---- removeInstanceButton ---- removeInstanceButton.setBackground(new Color(231, 188, 251)); removeInstanceButton.setText("Remove Instance"); removeInstanceButton.setOpaque(false); removeInstanceButton.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); removeInstanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeInstanceButtonActionPerformed(); } }); panel24.add(removeInstanceButton, cc.xy(3, 1)); } panel10.add(panel24, cc.xywh(1, 13, 1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT)); //======== panel4 ======== { panel4.setOpaque(false); panel4.setLayout( new FormLayout( new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default"))); //---- restrictionsApply2 ---- restrictionsApply2.setBackground(new Color(231, 188, 251)); restrictionsApply2.setText("Internal Only"); restrictionsApply2.setOpaque(false); restrictionsApply2.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); restrictionsApply2.setText(ATFieldInfo.getLabel(ResourcesComponents.class, ResourcesComponents.PROPERTYNAME_INTERNAL_ONLY)); panel4.add(restrictionsApply2, cc.xy(1, 1)); //---- resourcesRestrictionsApply ---- resourcesRestrictionsApply.setBackground(new Color(231, 188, 251)); resourcesRestrictionsApply.setText("Restrictions Apply"); resourcesRestrictionsApply.setOpaque(false); resourcesRestrictionsApply.setFont(new Font("Trebuchet MS", Font.PLAIN, 13)); resourcesRestrictionsApply.setText(ATFieldInfo.getLabel(ResourcesComponents.class, ArchDescription.PROPERTYNAME_RESTRICTIONS_APPLY)); panel4.add(resourcesRestrictionsApply, cc.xy(3, 1)); } panel10.add(panel4, cc.xy(1, 15)); } add(panel10, cc.xywh(5, 1, 1, 1, CellConstraints.FILL, CellConstraints.FILL)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:calendarexportplugin.CalendarSettingsTab.java
License:Open Source License
public JPanel createSettingsPanel() { final EnhancedPanelBuilder pb = new EnhancedPanelBuilder( FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode() + "," + FormFactory.RELATED_GAP_COLSPEC.encode() + ",default:grow," + FormFactory.RELATED_GAP_COLSPEC.encode() + "," + FormFactory.PREF_COLSPEC.encode()); CellConstraints cc = new CellConstraints(); mCategorie = new JTextField(mSettings.getCategory()); String[] reservedValues = { mLocalizer.msg("Busy", "Busy"), mLocalizer.msg("Free", "Free") }; mShowTime = new JComboBox(reservedValues); if (mSettings.isShowBusy()) { mShowTime.setSelectedIndex(0);/* w ww . ja v a 2s .com*/ } else if (mSettings.isShowFree()) { mShowTime.setSelectedIndex(1); } String[] classificationValues = { mLocalizer.msg("Public", "Public"), mLocalizer.msg("Private", "Private"), mLocalizer.msg("Confidential", "Confidential") }; mClassification = new JComboBox(classificationValues); if (mSettings.isClassificationPublic()) { mClassification.setSelectedIndex(0); } else if (mSettings.isClassificationPrivate()) { mClassification.setSelectedIndex(1); } else if (mSettings.isClassificationConfidential()) { mClassification.setSelectedIndex(2); } mNulltime = new JCheckBox(mLocalizer.msg("nullTime", "Set length to 0 Minutes")); if (mSettings.getNullTime()) { mNulltime.setSelected(true); } pb.addRow(); pb.addLabel(mLocalizer.msg("Categorie", "Categorie") + ':', cc.xy(2, pb.getRow())); pb.add(mCategorie, cc.xyw(4, pb.getRow(), pb.getColumnCount() - 3)); pb.addRow(); pb.addLabel(mLocalizer.msg("ShowTime", "Show Time as") + ':', cc.xy(2, pb.getRow())); pb.add(mShowTime, cc.xyw(4, pb.getRow(), pb.getColumnCount() - 3)); pb.addRow(); pb.addLabel(mLocalizer.msg("Classification", "Classification") + ':', cc.xy(2, pb.getRow())); pb.add(mClassification, cc.xyw(4, pb.getRow(), pb.getColumnCount() - 3)); mUseAlarm = new JCheckBox(mLocalizer.msg("reminder", "Use reminder")); pb.addRow(); pb.add(mUseAlarm, cc.xy(2, pb.getRow())); SpinnerModel model = new SpinnerNumberModel(0, 0, 1440, 1); mAlarmMinutes = new JSpinner(model); JPanel panel = new JPanel(new BorderLayout()); panel.add(mAlarmMinutes, BorderLayout.WEST); final JLabel label = new JLabel(mLocalizer.msg("minutesBefore", "Minutes before start.")); label.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); panel.add(label, BorderLayout.CENTER); mUseAlarm.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { mAlarmMinutes.setEnabled(mUseAlarm.isSelected()); label.setEnabled(mUseAlarm.isSelected()); } }); if (mSettings.getUseAlarm()) { mUseAlarm.setSelected(true); } try { mAlarmMinutes.setValue(mSettings.getAlarmMinutes()); } catch (Exception e) { // empty } mAlarmMinutes.setEnabled(mUseAlarm.isSelected()); label.setEnabled(mUseAlarm.isSelected()); pb.add(panel, cc.xyw(4, pb.getRow(), 2)); pb.addRow(); pb.add(mNulltime, cc.xyw(2, pb.getRow(), 4)); mMarkItems = new JCheckBox(mLocalizer.msg("markItems", "Mark items when exported")); if (mSettings.getMarkItems()) { mMarkItems.setSelected(true); } pb.addRow(); pb.add(mMarkItems, cc.xyw(2, pb.getRow(), 4)); pb.addParagraph(mLocalizer.msg("interface", "Interface")); mExporterList = new SelectableItemList(mPlugin.getExporterFactory().getActiveExporters(), mPlugin.getExporterFactory().getAllExporters()); pb.addRow("120"); pb.add(mExporterList, cc.xyw(2, pb.getRow(), 3)); final JButton settings = new JButton(Localizer.getLocalization(Localizer.I18N_SETTINGS)); settings.setEnabled(false); mExporterList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { Object[] ob = mExporterList.getListSelection(); if ((ob.length == 1) && (((ExporterIf) ob[0]).hasSettingsDialog())) { settings.setEnabled(true); } else { settings.setEnabled(false); } } }); settings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object[] ob = mExporterList.getListSelection(); if (ob.length == 1) { ((ExporterIf) ob[0]).showSettingsDialog(mSettings); } } }); pb.add(settings, cc.xy(6, pb.getRow(), CellConstraints.RIGHT, CellConstraints.TOP)); pb.addParagraph(mLocalizer.msg("formattings", "Formattings")); JButton extended = new JButton(mLocalizer.msg("formattings", "Formattings")); extended.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { showExtendedDialog(pb.getPanel()); } }); pb.addRow(); pb.add(extended, cc.xy(2, pb.getRow())); return pb.getPanel(); }