More cleanup and UI fixes.
This commit is contained in:
@@ -57,6 +57,7 @@ public class EvAComAdapter {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String[] getModuleNameList() {
|
public String[] getModuleNameList() {
|
||||||
|
System.exit(1);
|
||||||
System.out.println("SAYYYYY WHAAAAAT?");
|
System.out.println("SAYYYYY WHAAAAAT?");
|
||||||
String[] list = getLocalMainAdapter().getModuleNameList();
|
String[] list = getLocalMainAdapter().getModuleNameList();
|
||||||
LOGGER.info("List of modules available:");
|
LOGGER.info("List of modules available:");
|
||||||
|
@@ -208,9 +208,7 @@ public class Main extends JFrame implements OptimizationStateListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.comAdapter = EvAComAdapter.getInstance();
|
this.comAdapter = EvAComAdapter.getInstance();
|
||||||
|
|
||||||
splashScreenTime = 2500;
|
splashScreenTime = 2500;
|
||||||
SwingUtilities.invokeLater(initRunnable = new Runnable() {
|
SwingUtilities.invokeLater(initRunnable = new Runnable() {
|
||||||
|
|
||||||
@@ -560,7 +558,7 @@ public class Main extends JFrame implements OptimizationStateListener {
|
|||||||
|
|
||||||
/* Available command-line parameters */
|
/* Available command-line parameters */
|
||||||
String[] keys = new String[]{
|
String[] keys = new String[]{
|
||||||
"--help", "--autorun", "--nosplash", "--nogui", "--params", "--treeView"
|
"--help", "--autorun", "--nosplash", "--nogui", "--params", "--treeView"
|
||||||
};
|
};
|
||||||
/* Number of arguments per parameter */
|
/* Number of arguments per parameter */
|
||||||
int[] arities = new int[]{0, 0, 0, 0, 1, 0};
|
int[] arities = new int[]{0, 0, 0, 0, 1, 0};
|
||||||
@@ -569,7 +567,7 @@ public class Main extends JFrame implements OptimizationStateListener {
|
|||||||
Integer[] unknownArgs = StringTools.parseArguments(args, keys, arities, values, true);
|
Integer[] unknownArgs = StringTools.parseArguments(args, keys, arities, values, true);
|
||||||
|
|
||||||
if (unknownArgs.length > 0) {
|
if (unknownArgs.length > 0) {
|
||||||
System.err.println("Unrecognized command line options: ");
|
LOGGER.warning("Unrecognized command line options: ");
|
||||||
for (Integer unknownArg : unknownArgs) {
|
for (Integer unknownArg : unknownArgs) {
|
||||||
System.err.println(" " + args[unknownArg]);
|
System.err.println(" " + args[unknownArg]);
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,6 @@ public class PropertyDialog extends JDialog {
|
|||||||
public PropertyDialog(PropertyEditor editor, String title, int x, int y) {
|
public PropertyDialog(PropertyEditor editor, String title, int x, int y) {
|
||||||
super();
|
super();
|
||||||
setTitle(getFrameNameFromEditor(editor));
|
setTitle(getFrameNameFromEditor(editor));
|
||||||
//super(getFrameNameFromEditor(editor)); // that was the long class name !!
|
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
||||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||||
|
@@ -31,10 +31,7 @@ public class PropertyPanel extends JPanel {
|
|||||||
propertyEditor = editor;
|
propertyEditor = editor;
|
||||||
|
|
||||||
textLabel = new JLabel();
|
textLabel = new JLabel();
|
||||||
|
|
||||||
add(textLabel, gbConstraints);
|
add(textLabel, gbConstraints);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialog(int initX, int initY) {
|
public void showDialog(int initX, int initY) {
|
||||||
@@ -65,13 +62,14 @@ public class PropertyPanel extends JPanel {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
Insets i = textLabel.getInsets();
|
Insets i = textLabel.getInsets();
|
||||||
Rectangle box = new Rectangle(i.left, i.top,
|
Rectangle box = new Rectangle(i.left, i.top,
|
||||||
getSize().width - i.left - i.right,
|
getSize().width - i.left - i.right,
|
||||||
getSize().height - i.top - i.bottom);
|
getSize().height - i.top - i.bottom);
|
||||||
g.clearRect(i.left, i.top,
|
/*g.clearRect(i.left, i.top,
|
||||||
getSize().width - i.right - i.left,
|
getSize().width - i.right - i.left,
|
||||||
getSize().height - i.bottom - i.top);
|
getSize().height - i.bottom - i.top);*/
|
||||||
propertyEditor.paintValue(g, box);
|
propertyEditor.paintValue(g, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -829,7 +829,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
|||||||
* Updates the propertysheet when a value has been changed (from outside the
|
* Updates the propertysheet when a value has been changed (from outside the
|
||||||
* propertysheet?).
|
* propertysheet?).
|
||||||
*
|
*
|
||||||
* @param evt a value of type 'PropertyChangeEvent'
|
|
||||||
*/
|
*/
|
||||||
synchronized boolean wasModified(int propIndex, Object value, boolean followDependencies) {
|
synchronized boolean wasModified(int propIndex, Object value, boolean followDependencies) {
|
||||||
if (!updateValue(propIndex, value)) {
|
if (!updateValue(propIndex, value)) {
|
||||||
@@ -1065,14 +1064,19 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
|||||||
} else if (value instanceof PropertyPanel) {
|
} else if (value instanceof PropertyPanel) {
|
||||||
component = new JPanel();
|
component = new JPanel();
|
||||||
component.setLayout(new GridBagLayout());
|
component.setLayout(new GridBagLayout());
|
||||||
|
component.setOpaque(false);
|
||||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||||
gbConstraints.gridx = 0;
|
gbConstraints.gridx = 0;
|
||||||
gbConstraints.gridy = 0;
|
gbConstraints.gridy = 0;
|
||||||
gbConstraints.weightx = 1.0;
|
gbConstraints.weightx = 1.0;
|
||||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
component.add((PropertyPanel) value, gbConstraints);
|
component.add((PropertyPanel) value, gbConstraints);
|
||||||
JButton dialogButton = new JButton("...");
|
final JButton dialogButton = new JButton("...");
|
||||||
dialogButton.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, Color.LIGHT_GRAY));
|
dialogButton.setFocusPainted(false);
|
||||||
|
dialogButton.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
|
||||||
|
dialogButton.setBorderPainted(false);
|
||||||
|
//dialogButton.setContentAreaFilled(false);
|
||||||
|
dialogButton.setBackground(Color.LIGHT_GRAY);
|
||||||
dialogButton.addActionListener(new ActionListener() {
|
dialogButton.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
@@ -1082,7 +1086,7 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
|||||||
});
|
});
|
||||||
gbConstraints = new GridBagConstraints();
|
gbConstraints = new GridBagConstraints();
|
||||||
gbConstraints.weighty = 1.0;
|
gbConstraints.weighty = 1.0;
|
||||||
gbConstraints.fill = GridBagConstraints.VERTICAL;
|
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||||
gbConstraints.anchor = GridBagConstraints.LINE_END;
|
gbConstraints.anchor = GridBagConstraints.LINE_END;
|
||||||
gbConstraints.gridy = 0;
|
gbConstraints.gridy = 0;
|
||||||
gbConstraints.gridx = 1;
|
gbConstraints.gridx = 1;
|
||||||
|
@@ -31,45 +31,7 @@ public class BigStringEditor implements PropertyEditor {
|
|||||||
BigStringEditor editor = new BigStringEditor();
|
BigStringEditor editor = new BigStringEditor();
|
||||||
|
|
||||||
PropertyDialog dialog = new PropertyDialog(editor, file, 50, 50);
|
PropertyDialog dialog = new PropertyDialog(editor, file, 50, 50);
|
||||||
//frame.setSize(200, 200);
|
|
||||||
dialog.addWindowListener(new WindowListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowOpened(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowClosing(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowClosed(WindowEvent e) {
|
|
||||||
isFinished = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowIconified(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowDeiconified(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowActivated(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void windowDeactivated(WindowEvent e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
while (isFinished == false) {
|
while (isFinished == false) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
|
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
public class GenericObjectEditor implements PropertyEditor {
|
public class GenericObjectEditor implements PropertyEditor {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(GenericObjectEditor.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(GenericObjectEditor.class.getName());
|
||||||
private Object object;
|
private Object object;
|
||||||
private Object backupObject;
|
private Object backupObject;
|
||||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||||
@@ -29,7 +29,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
* respectively
|
* respectively
|
||||||
*/
|
*/
|
||||||
public static ArrayList<String> getClassesFromProperties(String className, ArrayList<Class<?>> instances) {
|
public static ArrayList<String> getClassesFromProperties(String className, ArrayList<Class<?>> instances) {
|
||||||
logger.log(Level.FINEST, "Requesting className: {0}", className);
|
LOGGER.log(Level.FINEST, "Requesting className: {0}", className);
|
||||||
|
|
||||||
// Try to read the predefined classes from the props file.
|
// Try to read the predefined classes from the props file.
|
||||||
String typeOptions = EvAInfo.getProperty(className);
|
String typeOptions = EvAInfo.getProperty(className);
|
||||||
@@ -48,7 +48,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
classes.add(current);
|
classes.add(current);
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.log(Level.WARNING,
|
LOGGER.log(Level.WARNING,
|
||||||
String.format("Requesting className: %1$s, Couldn't load: %2%s", className, current), ex);
|
String.format("Requesting className: %1$s, Couldn't load: %2%s", className, current), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +71,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
Class<?>[] classArray;
|
Class<?>[] classArray;
|
||||||
classArray = ReflectPackage.getAssignableClasses(className, true, true);
|
classArray = ReflectPackage.getAssignableClasses(className, true, true);
|
||||||
if (classArray == null) {
|
if (classArray == null) {
|
||||||
logger.log(Level.WARNING, String.format("No assignable classes found in property file or on classpath: %1$s for %2$s", EvAInfo.propertyFile, className));
|
LOGGER.log(Level.WARNING, String.format("No assignable classes found in property file or on classpath: %1$s for %2$s", EvAInfo.propertyFile, className));
|
||||||
classes.add(className);
|
classes.add(className);
|
||||||
} else {
|
} else {
|
||||||
for (Class<?> clazz : classArray) {
|
for (Class<?> clazz : classArray) {
|
||||||
@@ -80,7 +80,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
// a field allowing a class to indicate it doesnt want to be displayed
|
// a field allowing a class to indicate it doesnt want to be displayed
|
||||||
Field f = clazz.getDeclaredField("hideFromGOE");
|
Field f = clazz.getDeclaredField("hideFromGOE");
|
||||||
if (f.getBoolean(clazz) == true) {
|
if (f.getBoolean(clazz) == true) {
|
||||||
logger.log(Level.FINEST, "Class {0} wants to be hidden from GOE.", clazz);
|
LOGGER.log(Level.FINEST, "Class {0} wants to be hidden from GOE.", clazz);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
@@ -88,11 +88,11 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
* We are just logging this exception here. It is expected that most classes do
|
* We are just logging this exception here. It is expected that most classes do
|
||||||
* not have this field.
|
* not have this field.
|
||||||
*/
|
*/
|
||||||
logger.log(Level.FINER, String.format("%1$s does not have a hideFromGOE field", clazz.toString()), e);
|
LOGGER.log(Level.FINER, String.format("%1$s does not have a hideFromGOE field", clazz.toString()), e);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.log(Level.FINER, e.getMessage(), e);
|
LOGGER.log(Level.FINER, e.getMessage(), e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
logger.log(Level.FINER, e.getMessage(), e);
|
LOGGER.log(Level.FINER, e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
classes.add(clazz.getName());
|
classes.add(clazz.getName());
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) {
|
||||||
logger.log(Level.WARNING, String.format("GOE warning: Class %1$s has no default constructor", clazz.getName()), e);
|
LOGGER.log(Level.WARNING, String.format("GOE warning: Class %1$s has no default constructor", clazz.getName()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.WARNING, String.format("Couldn't set expert property for %1$s/%2$s", cls.getName(), property), e);
|
LOGGER.log(Level.WARNING, String.format("Couldn't set expert property for %1$s/%2$s", cls.getName(), property), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,10 +168,10 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.log(Level.WARNING, "Property {0} not found", property);
|
LOGGER.log(Level.WARNING, "Property {0} not found", property);
|
||||||
return false;
|
return false;
|
||||||
} catch (IntrospectionException e) {
|
} catch (IntrospectionException e) {
|
||||||
logger.log(Level.WARNING, String.format("Couldn't set hide property for %1$s/%2$s", cls.getName(), property), e);
|
LOGGER.log(Level.WARNING, String.format("Couldn't set hide property for %1$s/%2$s", cls.getName(), property), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
return orig;
|
return orig;
|
||||||
} catch (IntrospectionException e) {
|
} catch (IntrospectionException e) {
|
||||||
logger.log(Level.WARNING, String.format("Couldn't hide all properties for %1$s/all", cls.getName()), e);
|
LOGGER.log(Level.WARNING, String.format("Couldn't hide all properties for %1$s/all", cls.getName()), e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
try {
|
try {
|
||||||
bi = Introspector.getBeanInfo(cls);
|
bi = Introspector.getBeanInfo(cls);
|
||||||
} catch (IntrospectionException e) {
|
} catch (IntrospectionException e) {
|
||||||
logger.log(Level.WARNING, String.format("Error on introspection of %1$s", cls.getName()), e);
|
LOGGER.log(Level.WARNING, String.format("Error on introspection of %1$s", cls.getName()), e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PropertyDescriptor[] props = bi.getPropertyDescriptors();
|
PropertyDescriptor[] props = bi.getPropertyDescriptors();
|
||||||
@@ -266,7 +266,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
*/
|
*/
|
||||||
public void setDefaultValue() {
|
public void setDefaultValue() {
|
||||||
if (classType == null) {
|
if (classType == null) {
|
||||||
logger.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
LOGGER.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
public void setValue(Object o) {
|
public void setValue(Object o) {
|
||||||
|
|
||||||
if (o == null || classType == null) {
|
if (o == null || classType == null) {
|
||||||
logger.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
LOGGER.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!classType.isAssignableFrom(o.getClass())) {
|
if (!classType.isAssignableFrom(o.getClass())) {
|
||||||
@@ -383,10 +383,11 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
for (int i = 0; i < methods.length; i++) {
|
for (int i = 0; i < methods.length; i++) {
|
||||||
if (methods[i].getName().equalsIgnoreCase("getName")) {
|
if (methods[i].getName().equalsIgnoreCase("getName")) {
|
||||||
getNameMethod = i;
|
getNameMethod = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IntrospectionException ex) {
|
} catch (IntrospectionException ex) {
|
||||||
System.err.println("PropertySheetPanel.setTarget(): Couldn't introspect");
|
LOGGER.log(Level.WARNING, "Could not introspect PropertySheetPanel", ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (getNameMethod >= 0) {
|
if (getNameMethod >= 0) {
|
||||||
|
Reference in New Issue
Block a user