Made the config selector a combo box with buttons to control add, rename
and remove.
This commit is contained in:
parent
dc737e2289
commit
25c5dfec49
@ -11,17 +11,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.ListDataEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
|
||||||
import javax.swing.event.ListSelectionEvent;
|
|
||||||
import javax.swing.event.ListSelectionListener;
|
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
import javax.swing.table.TableColumnModel;
|
import javax.swing.table.TableColumnModel;
|
||||||
|
|
||||||
@ -45,12 +42,12 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
|
|
||||||
private final JTable configurationTable;
|
private final JTable configurationTable;
|
||||||
final MotorConfigurationTableModel configurationTableModel;
|
final MotorConfigurationTableModel configurationTableModel;
|
||||||
|
final FlightConfigurationModel flightConfigurationModel;
|
||||||
|
|
||||||
|
private final JButton renameConfButton, removeConfButton;
|
||||||
private final JButton newConfButton, removeConfButton;
|
|
||||||
private final JButton selectMotorButton, removeMotorButton;
|
private final JButton selectMotorButton, removeMotorButton;
|
||||||
|
|
||||||
private String currentID = null;
|
String currentID = null;
|
||||||
private MotorMount currentMount = null;
|
private MotorMount currentMount = null;
|
||||||
|
|
||||||
static final Translator trans = Application.getTranslator();
|
static final Translator trans = Application.getTranslator();
|
||||||
@ -59,6 +56,8 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
//// Edit motor configurations
|
//// Edit motor configurations
|
||||||
super(parent, trans.get("edtmotorconfdlg.title.Editmotorconf"));
|
super(parent, trans.get("edtmotorconfdlg.title.Editmotorconf"));
|
||||||
|
|
||||||
|
currentID = rocket.getDefaultConfiguration().getMotorConfigurationID();
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
||||||
else
|
else
|
||||||
@ -70,9 +69,47 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout("fill, wrap 5"));
|
JPanel panel = new JPanel(new MigLayout("fill, wrap 5"));
|
||||||
|
|
||||||
|
JLabel label = new JLabel("Selected Configuration: ");
|
||||||
|
panel.add(label,"gapbottom para");
|
||||||
|
|
||||||
|
flightConfigurationModel = new FlightConfigurationModel(rocket.getDefaultConfiguration());
|
||||||
|
JComboBox configSelector = new JComboBox(flightConfigurationModel);
|
||||||
|
|
||||||
|
panel.add(configSelector,"gapright para");
|
||||||
|
|
||||||
|
JButton newConfButton = new JButton(trans.get("edtmotorconfdlg.but.Newconfiguration"));
|
||||||
|
newConfButton.addActionListener( new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
FlightConfigurationDialog.this.addConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add(newConfButton);
|
||||||
|
|
||||||
|
renameConfButton = new JButton("Rename Configuration");
|
||||||
|
renameConfButton.addActionListener( new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
new RenameConfigDialog( rocket, FlightConfigurationDialog.this).setVisible(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(renameConfButton);
|
||||||
|
|
||||||
|
//// Remove configuration
|
||||||
|
removeConfButton = new JButton(trans.get("edtmotorconfdlg.but.Removeconfiguration"));
|
||||||
|
removeConfButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
removeConfiguration();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(removeConfButton,"wrap");
|
||||||
|
|
||||||
//// Motor mount selection
|
//// Motor mount selection
|
||||||
//// <html><b>Motor mounts:</b>
|
//// <html><b>Motor mounts:</b>
|
||||||
JLabel label = new JLabel(trans.get("edtmotorconfdlg.lbl.Motormounts"));
|
label = new JLabel(trans.get("edtmotorconfdlg.lbl.Motormounts"));
|
||||||
panel.add(label, "gapbottom para");
|
panel.add(label, "gapbottom para");
|
||||||
|
|
||||||
//// Motor selection
|
//// Motor selection
|
||||||
@ -115,7 +152,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
if (e.getClickCount() == 1) {
|
if (e.getClickCount() == 1) {
|
||||||
|
|
||||||
// Single click updates selection
|
// Single click updates selection
|
||||||
updateEnabled();
|
updateButtonState();
|
||||||
|
|
||||||
} else if (e.getClickCount() == 2) {
|
} else if (e.getClickCount() == 2) {
|
||||||
|
|
||||||
@ -130,34 +167,6 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
scroll = new JScrollPane(configurationTable);
|
scroll = new JScrollPane(configurationTable);
|
||||||
panel.add(scroll, "span 4, w 500lp, h 150lp, grow");
|
panel.add(scroll, "span 4, w 500lp, h 150lp, grow");
|
||||||
|
|
||||||
//// New configuration
|
|
||||||
newConfButton = new JButton(trans.get("edtmotorconfdlg.but.Newconfiguration"));
|
|
||||||
newConfButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
String id = rocket.newMotorConfigurationID();
|
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(id);
|
|
||||||
configurationTableModel.fireTableDataChanged();
|
|
||||||
updateEnabled();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel.add(newConfButton, "skip, sizegroup button");
|
|
||||||
|
|
||||||
//// Remove configuration
|
|
||||||
removeConfButton = new JButton(trans.get("edtmotorconfdlg.but.Removeconfiguration"));
|
|
||||||
removeConfButton.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (currentID == null)
|
|
||||||
return;
|
|
||||||
rocket.removeMotorConfigurationID(currentID);
|
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(null);
|
|
||||||
configurationTableModel.fireTableDataChanged();
|
|
||||||
updateEnabled();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel.add(removeConfButton, "sizegroup button");
|
|
||||||
|
|
||||||
//// Select motor
|
//// Select motor
|
||||||
selectMotorButton = new JButton(trans.get("edtmotorconfdlg.but.Selectmotor"));
|
selectMotorButton = new JButton(trans.get("edtmotorconfdlg.but.Selectmotor"));
|
||||||
selectMotorButton.addActionListener(new ActionListener() {
|
selectMotorButton.addActionListener(new ActionListener() {
|
||||||
@ -192,7 +201,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
this.validate();
|
this.validate();
|
||||||
this.pack();
|
this.pack();
|
||||||
|
|
||||||
updateEnabled();
|
updateButtonState();
|
||||||
|
|
||||||
this.setLocationByPlatform(true);
|
this.setLocationByPlatform(true);
|
||||||
GUIUtil.setDisposableDialogOptions(this, close);
|
GUIUtil.setDisposableDialogOptions(this, close);
|
||||||
@ -222,42 +231,44 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
return list.toArray(new MotorMount[0]);
|
return list.toArray(new MotorMount[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void selectConfiguration( String id ) {
|
||||||
void updateConfigurationName( String newName ) {
|
currentID = id;
|
||||||
|
|
||||||
int row = configurationTable.getSelectedRow();
|
|
||||||
String currentID = findID( row );
|
|
||||||
rocket.setMotorConfigurationName(currentID, newName);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateEnabled() {
|
|
||||||
int column = configurationTable.getSelectedColumn();
|
|
||||||
int row = configurationTable.getSelectedRow();
|
|
||||||
|
|
||||||
if (column < 0 || row < 0) {
|
|
||||||
currentID = null;
|
|
||||||
currentMount = null;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
currentID = findID(row);
|
|
||||||
if (column == 0) {
|
|
||||||
currentMount = null;
|
|
||||||
} else {
|
|
||||||
currentMount = findMount(column);
|
|
||||||
}
|
|
||||||
rocket.getDefaultConfiguration().setMotorConfigurationID(currentID);
|
rocket.getDefaultConfiguration().setMotorConfigurationID(currentID);
|
||||||
|
configurationTableModel.fireTableDataChanged();
|
||||||
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addConfiguration() {
|
||||||
|
currentID = rocket.newMotorConfigurationID();
|
||||||
|
rocket.getDefaultConfiguration().setMotorConfigurationID(currentID);
|
||||||
|
configurationTableModel.fireTableDataChanged();
|
||||||
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeConfigurationName( String newName ) {
|
||||||
|
rocket.setMotorConfigurationName(currentID, newName);
|
||||||
|
configurationTableModel.fireTableDataChanged();
|
||||||
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeConfiguration() {
|
||||||
|
if (currentID == null)
|
||||||
|
return;
|
||||||
|
rocket.removeMotorConfigurationID(currentID);
|
||||||
|
rocket.getDefaultConfiguration().setMotorConfigurationID(null);
|
||||||
|
configurationTableModel.fireTableDataChanged();
|
||||||
|
flightConfigurationModel.fireContentsUpdated();
|
||||||
|
updateButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateButtonState() {
|
||||||
removeConfButton.setEnabled(currentID != null);
|
removeConfButton.setEnabled(currentID != null);
|
||||||
|
renameConfButton.setEnabled(currentID != null);
|
||||||
selectMotorButton.setEnabled(currentMount != null && currentID != null);
|
selectMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||||
removeMotorButton.setEnabled(currentMount != null && currentID != null);
|
removeMotorButton.setEnabled(currentMount != null && currentID != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void selectMotor() {
|
private void selectMotor() {
|
||||||
if (currentID == null || currentMount == null)
|
if (currentID == null || currentMount == null)
|
||||||
return;
|
return;
|
||||||
@ -275,7 +286,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
|
|
||||||
int row = configurationTable.getSelectedRow();
|
int row = configurationTable.getSelectedRow();
|
||||||
configurationTableModel.fireTableRowsUpdated(row, row);
|
configurationTableModel.fireTableRowsUpdated(row, row);
|
||||||
updateEnabled();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -287,7 +298,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
|
|
||||||
int row = configurationTable.getSelectedRow();
|
int row = configurationTable.getSelectedRow();
|
||||||
configurationTableModel.fireTableRowsUpdated(row, row);
|
configurationTableModel.fireTableRowsUpdated(row, row);
|
||||||
updateEnabled();
|
updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -303,7 +314,7 @@ public class FlightConfigurationDialog extends JDialog {
|
|||||||
for (MotorMount m : mounts) {
|
for (MotorMount m : mounts) {
|
||||||
if (m.isMotorMount())
|
if (m.isMotorMount())
|
||||||
count--;
|
count--;
|
||||||
if (count <= 0) {
|
if (count < 0) {
|
||||||
mount = m;
|
mount = m;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,95 @@
|
|||||||
|
package net.sf.openrocket.gui.dialogs.flightconfiguration;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.swing.DefaultComboBoxModel;
|
||||||
|
|
||||||
|
import net.sf.openrocket.rocketcomponent.Configuration;
|
||||||
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
|
|
||||||
|
public class FlightConfigurationModel extends DefaultComboBoxModel {
|
||||||
|
|
||||||
|
private final Configuration config;
|
||||||
|
private final Rocket rocket;
|
||||||
|
|
||||||
|
private Map<String, ID> map = new HashMap<String, ID>();
|
||||||
|
|
||||||
|
public FlightConfigurationModel(Configuration config) {
|
||||||
|
this.config = config;
|
||||||
|
this.rocket = config.getRocket();
|
||||||
|
}
|
||||||
|
|
||||||
|
void fireContentsUpdated() {
|
||||||
|
fireContentsChanged(this, 0, rocket.getMotorConfigurationIDs().length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(int index) {
|
||||||
|
String[] ids = rocket.getMotorConfigurationIDs();
|
||||||
|
if (index < 0 || index >= ids.length)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return get(ids[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSize() {
|
||||||
|
return rocket.getMotorConfigurationIDs().length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getSelectedItem() {
|
||||||
|
return get(config.getMotorConfigurationID());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedItem(Object item) {
|
||||||
|
if (item == null) {
|
||||||
|
// Clear selection - huh?
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!(item instanceof ID)) {
|
||||||
|
throw new IllegalArgumentException("MotorConfigurationModel item="+item);
|
||||||
|
}
|
||||||
|
|
||||||
|
ID idObject = (ID) item;
|
||||||
|
config.setMotorConfigurationID(idObject.getID());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The ID class is an adapter, that contains the actual configuration ID,
|
||||||
|
* but gives the configuration description as its String representation.
|
||||||
|
* The get(id) method retrieves ID objects and caches them for reuse.
|
||||||
|
*/
|
||||||
|
|
||||||
|
private ID get(String id) {
|
||||||
|
ID idObject = map.get(id);
|
||||||
|
if (idObject != null)
|
||||||
|
return idObject;
|
||||||
|
|
||||||
|
idObject = new ID(id);
|
||||||
|
map.put(id, idObject);
|
||||||
|
return idObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private class ID {
|
||||||
|
private final String id;
|
||||||
|
|
||||||
|
public ID(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return rocket.getMotorConfigurationNameOrDescription(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -24,22 +24,15 @@ class MotorConfigurationTableModel extends AbstractTableModel {
|
|||||||
this.flightConfigurationDialog = flightConfigurationDialog;
|
this.flightConfigurationDialog = flightConfigurationDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
|
||||||
return columnIndex == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
|
||||||
if ( columnIndex == 0 ) {
|
|
||||||
// Set description:
|
|
||||||
flightConfigurationDialog.updateConfigurationName( (String) aValue );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
int count = 1;
|
int count = 2;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRowCount() {
|
||||||
|
int count = 0;
|
||||||
for (MotorMount m : this.flightConfigurationDialog.mounts) {
|
for (MotorMount m : this.flightConfigurationDialog.mounts) {
|
||||||
if (m.isMotorMount())
|
if (m.isMotorMount())
|
||||||
count++;
|
count++;
|
||||||
@ -47,21 +40,21 @@ class MotorConfigurationTableModel extends AbstractTableModel {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRowCount() {
|
|
||||||
return this.flightConfigurationDialog.rocket.getMotorConfigurationIDs().length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getValueAt(int row, int column) {
|
public Object getValueAt(int row, int column) {
|
||||||
|
|
||||||
String id = this.flightConfigurationDialog.findID(row);
|
String id = this.flightConfigurationDialog.currentID;
|
||||||
|
|
||||||
if (column == 0) {
|
if (column == 0) {
|
||||||
return this.flightConfigurationDialog.rocket.getMotorConfigurationNameOrDescription(id);
|
MotorMount mount = this.flightConfigurationDialog.findMount(row);
|
||||||
|
String name = mount.toString();
|
||||||
|
int count = mount.getMotorCount();
|
||||||
|
if (count > 1) {
|
||||||
|
name = name + " (" + Chars.TIMES + count + ")";
|
||||||
}
|
}
|
||||||
|
return name;
|
||||||
MotorMount mount = this.flightConfigurationDialog.findMount(column);
|
} else {
|
||||||
|
MotorMount mount = this.flightConfigurationDialog.findMount(row);
|
||||||
Motor motor = mount.getMotor(id);
|
Motor motor = mount.getMotor(id);
|
||||||
if (motor == null)
|
if (motor == null)
|
||||||
//// None
|
//// None
|
||||||
@ -74,22 +67,17 @@ class MotorConfigurationTableModel extends AbstractTableModel {
|
|||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColumnName(int column) {
|
public String getColumnName(int column) {
|
||||||
if (column == 0) {
|
if (column == 0) {
|
||||||
//// Configuration name
|
return "Motor Mount";
|
||||||
return FlightConfigurationDialog.trans.get("edtmotorconfdlg.lbl.Configname");
|
} else {
|
||||||
}
|
return "Motor";
|
||||||
|
}
|
||||||
MotorMount mount = this.flightConfigurationDialog.findMount(column);
|
|
||||||
String name = mount.toString();
|
|
||||||
int count = mount.getMotorCount();
|
|
||||||
if (count > 1) {
|
|
||||||
name = name + " (" + Chars.TIMES + count + ")";
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -70,6 +70,6 @@ class MotorMountTableModel extends AbstractTableModel {
|
|||||||
|
|
||||||
this.flightConfigurationDialog.mounts[row].setMotorMount((Boolean) value);
|
this.flightConfigurationDialog.mounts[row].setMotorMount((Boolean) value);
|
||||||
this.flightConfigurationDialog.configurationTableModel.fireTableStructureChanged();
|
this.flightConfigurationDialog.configurationTableModel.fireTableStructureChanged();
|
||||||
this.flightConfigurationDialog.updateEnabled();
|
this.flightConfigurationDialog.updateButtonState();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package net.sf.openrocket.gui.dialogs.flightconfiguration;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
import net.sf.openrocket.rocketcomponent.Configuration;
|
||||||
|
import net.sf.openrocket.rocketcomponent.Rocket;
|
||||||
|
|
||||||
|
public class RenameConfigDialog extends JDialog {
|
||||||
|
|
||||||
|
RenameConfigDialog( final Rocket rocket, final FlightConfigurationDialog parent ) {
|
||||||
|
super(parent);
|
||||||
|
super.setModal(true);
|
||||||
|
final Configuration config = rocket.getDefaultConfiguration();
|
||||||
|
|
||||||
|
JPanel panel = new JPanel(new MigLayout("fill"));
|
||||||
|
|
||||||
|
final JTextArea textbox = new JTextArea( config.getMotorConfigurationDescription() );
|
||||||
|
panel.add(textbox, "span, w 200lp, wrap");
|
||||||
|
|
||||||
|
JButton okButton = new JButton("Ok");
|
||||||
|
okButton.addActionListener( new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
parent.changeConfigurationName(textbox.getText());
|
||||||
|
RenameConfigDialog.this.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add( okButton );
|
||||||
|
|
||||||
|
JButton defaultButton = new JButton("Reset to default");
|
||||||
|
defaultButton.addActionListener( new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
parent.changeConfigurationName(null);
|
||||||
|
RenameConfigDialog.this.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add( defaultButton );
|
||||||
|
|
||||||
|
JButton cancel = new JButton("Cancel");
|
||||||
|
cancel.addActionListener( new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
RenameConfigDialog.this.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.add( cancel );
|
||||||
|
|
||||||
|
this.setContentPane(panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user