Rename to ComponentPresetEditor
This commit is contained in:
parent
90ebc01268
commit
a6eda10fcc
@ -45,7 +45,7 @@ import java.util.List;
|
|||||||
* A UI for editing component presets. Currently this is a standalone application - run the main within this class.
|
* A UI for editing component presets. Currently this is a standalone application - run the main within this class.
|
||||||
* TODO: Full I18n TODO: Save As .csv
|
* TODO: Full I18n TODO: Save As .csv
|
||||||
*/
|
*/
|
||||||
public class ComponentPresetPanel extends JPanel implements PresetResultListener {
|
public class ComponentPresetEditor extends JPanel implements PresetResultListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The logger.
|
* The logger.
|
||||||
@ -92,7 +92,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
*
|
*
|
||||||
* @param frame the parent window
|
* @param frame the parent window
|
||||||
*/
|
*/
|
||||||
public ComponentPresetPanel(final JFrame frame) {
|
public ComponentPresetEditor(final JFrame frame) {
|
||||||
setLayout(new MigLayout("", "[82.00px, grow][168.00px, grow][84px, grow][117.00px, grow][][222px]",
|
setLayout(new MigLayout("", "[82.00px, grow][168.00px, grow][84px, grow][117.00px, grow][][222px]",
|
||||||
"[346.00px, grow][29px]"));
|
"[346.00px, grow][29px]"));
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
JTable target = (JTable) e.getSource();
|
JTable target = (JTable) e.getSource();
|
||||||
if (target.getSelectedColumn() == 4) {
|
if (target.getSelectedColumn() == 4) {
|
||||||
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ComponentPresetPanel.this,
|
if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ComponentPresetEditor.this,
|
||||||
"Do you want to delete this preset?",
|
"Do you want to delete this preset?",
|
||||||
"Confirm Delete", JOptionPane.YES_OPTION,
|
"Confirm Delete", JOptionPane.YES_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE)) {
|
JOptionPane.QUESTION_MESSAGE)) {
|
||||||
@ -132,7 +132,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
if (e.getClickCount() == 2) {
|
if (e.getClickCount() == 2) {
|
||||||
int row = target.getSelectedRow();
|
int row = target.getSelectedRow();
|
||||||
editingSelected = true;
|
editingSelected = true;
|
||||||
new PresetEditorDialog(ComponentPresetPanel.this, (ComponentPreset) model.getAssociatedObject(row)).setVisible(true);
|
new PresetEditorDialog(ComponentPresetEditor.this, (ComponentPreset) model.getAssociatedObject(row)).setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent arg0) {
|
public void mouseClicked(MouseEvent arg0) {
|
||||||
editingSelected = false;
|
editingSelected = false;
|
||||||
new PresetEditorDialog(ComponentPresetPanel.this).setVisible(true);
|
new PresetEditorDialog(ComponentPresetEditor.this).setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(addBtn, "cell 0 1,alignx left,aligny top");
|
add(addBtn, "cell 0 1,alignx left,aligny top");
|
||||||
@ -261,7 +261,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
try {
|
try {
|
||||||
Application.setPreferences(new SwingPreferences());
|
Application.setPreferences(new SwingPreferences());
|
||||||
JFrame dialog = new JFrame();
|
JFrame dialog = new JFrame();
|
||||||
dialog.getContentPane().add(new ComponentPresetPanel(dialog));
|
dialog.getContentPane().add(new ComponentPresetEditor(dialog));
|
||||||
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||||
dialog.pack();
|
dialog.pack();
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
@ -338,7 +338,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
chooser.setCurrentDirectory(((SwingPreferences) Application.getPreferences()).getDefaultDirectory());
|
chooser.setCurrentDirectory(((SwingPreferences) Application.getPreferences()).getDefaultDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
int option = chooser.showOpenDialog(ComponentPresetPanel.this);
|
int option = chooser.showOpenDialog(ComponentPresetEditor.this);
|
||||||
if (option != JFileChooser.APPROVE_OPTION) {
|
if (option != JFileChooser.APPROVE_OPTION) {
|
||||||
openedFile = null;
|
openedFile = null;
|
||||||
log.user("User decided not to open, option=" + option);
|
log.user("User decided not to open, option=" + option);
|
||||||
@ -374,7 +374,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
JOptionPane.showMessageDialog(ComponentPresetPanel.this, "Unable to open OpenRocket component file: " +
|
JOptionPane.showMessageDialog(ComponentPresetEditor.this, "Unable to open OpenRocket component file: " +
|
||||||
file.getName() + " Invalid format. " + e.getMessage());
|
file.getName() + " Invalid format. " + e.getMessage());
|
||||||
openedFile = null;
|
openedFile = null;
|
||||||
return false;
|
return false;
|
||||||
@ -387,7 +387,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
return saveAsORC();
|
return saveAsORC();
|
||||||
}
|
}
|
||||||
catch (Exception e1) {
|
catch (Exception e1) {
|
||||||
JOptionPane.showMessageDialog(ComponentPresetPanel.this, e1.getLocalizedMessage(),
|
JOptionPane.showMessageDialog(ComponentPresetEditor.this, e1.getLocalizedMessage(),
|
||||||
"Error saving ORC file.", JOptionPane.ERROR_MESSAGE);
|
"Error saving ORC file.", JOptionPane.ERROR_MESSAGE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -415,7 +415,7 @@ public class ComponentPresetPanel extends JPanel implements PresetResultListener
|
|||||||
chooser.setCurrentDirectory(((SwingPreferences) Application.getPreferences()).getDefaultDirectory());
|
chooser.setCurrentDirectory(((SwingPreferences) Application.getPreferences()).getDefaultDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
int option = chooser.showSaveDialog(ComponentPresetPanel.this);
|
int option = chooser.showSaveDialog(ComponentPresetEditor.this);
|
||||||
if (option != JFileChooser.APPROVE_OPTION) {
|
if (option != JFileChooser.APPROVE_OPTION) {
|
||||||
log.user("User decided not to save, option=" + option);
|
log.user("User decided not to save, option=" + option);
|
||||||
return false;
|
return false;
|
Loading…
x
Reference in New Issue
Block a user