@Override
protected void initAndAddOtherComponentsInMainPanel() {
// hidden components
hiddenNxEntryNameViewer = new Label();
hiddenDefaultValueViewer = new StringButton();
hiddenDefaultValueViewer.setDisplayDataInButton(true);
// view part
viewPanel = new JPanel(new BorderLayout());
nxEntryNameTitle = new JLabel("Current Value:");
nxEntryNameTitle.setBorder(new EmptyBorder(0, 0, 0, 5));
nxEntryNameDisplayer = new JLabel();
viewPanel.add(nxEntryNameTitle, BorderLayout.WEST);
viewPanel.add(nxEntryNameDisplayer, BorderLayout.CENTER);
// edit part
editPanel = new JPanel(new GridBagLayout());
nxEntryNameEditor = new JComboBox(MODEL_POSSIBLE_VALUES);
nxEntryNameEditor.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
nxEntryNameDisplayer.setText((String) nxEntryNameEditor.getSelectedItem());
}
});
setDefaultValueButton = new JButton("Default");
setDefaultValueButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hiddenDefaultValueViewer.execute();
updateSelectedValue(true);
}
});
GridBagConstraints comboConstraints = new GridBagConstraints();
comboConstraints.fill = GridBagConstraints.BOTH;
comboConstraints.gridx = 0;
comboConstraints.gridy = 0;
comboConstraints.weightx = 1;
comboConstraints.weighty = 1;
comboConstraints.insets = new Insets(0, 0, 0, 5);
editPanel.add(nxEntryNameEditor, comboConstraints);
GridBagConstraints defaultButtonConstraints = new GridBagConstraints();
defaultButtonConstraints.fill = GridBagConstraints.VERTICAL;
defaultButtonConstraints.gridx = 1;
defaultButtonConstraints.gridy = 0;
defaultButtonConstraints.weightx = 0;
defaultButtonConstraints.weighty = 1;
editPanel.add(setDefaultValueButton, defaultButtonConstraints);
// buttons
buttonPanel = new JPanel(new GridBagLayout());
closeButton.setText("Cancel");
okButton = new StringButton() {
@Override
public void actionPerformed(EventObject event) {
setParameter((String) nxEntryNameEditor.getSelectedItem());
super.actionPerformed(event);
close();