More cleanup and UI fixes.
This commit is contained in:
@@ -57,6 +57,7 @@ public class EvAComAdapter {
|
||||
* @return
|
||||
*/
|
||||
public String[] getModuleNameList() {
|
||||
System.exit(1);
|
||||
System.out.println("SAYYYYY WHAAAAAT?");
|
||||
String[] list = getLocalMainAdapter().getModuleNameList();
|
||||
LOGGER.info("List of modules available:");
|
||||
|
@@ -208,9 +208,7 @@ public class Main extends JFrame implements OptimizationStateListener {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.comAdapter = EvAComAdapter.getInstance();
|
||||
|
||||
splashScreenTime = 2500;
|
||||
SwingUtilities.invokeLater(initRunnable = new Runnable() {
|
||||
|
||||
@@ -569,7 +567,7 @@ public class Main extends JFrame implements OptimizationStateListener {
|
||||
Integer[] unknownArgs = StringTools.parseArguments(args, keys, arities, values, true);
|
||||
|
||||
if (unknownArgs.length > 0) {
|
||||
System.err.println("Unrecognized command line options: ");
|
||||
LOGGER.warning("Unrecognized command line options: ");
|
||||
for (Integer unknownArg : unknownArgs) {
|
||||
System.err.println(" " + args[unknownArg]);
|
||||
}
|
||||
|
@@ -27,7 +27,6 @@ public class PropertyDialog extends JDialog {
|
||||
public PropertyDialog(PropertyEditor editor, String title, int x, int y) {
|
||||
super();
|
||||
setTitle(getFrameNameFromEditor(editor));
|
||||
//super(getFrameNameFromEditor(editor)); // that was the long class name !!
|
||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
||||
setDefaultCloseOperation(HIDE_ON_CLOSE);
|
||||
|
@@ -31,10 +31,7 @@ public class PropertyPanel extends JPanel {
|
||||
propertyEditor = editor;
|
||||
|
||||
textLabel = new JLabel();
|
||||
|
||||
add(textLabel, gbConstraints);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void showDialog(int initX, int initY) {
|
||||
@@ -65,13 +62,14 @@ public class PropertyPanel extends JPanel {
|
||||
*/
|
||||
@Override
|
||||
public void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
Insets i = textLabel.getInsets();
|
||||
Rectangle box = new Rectangle(i.left, i.top,
|
||||
getSize().width - i.left - i.right,
|
||||
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().height - i.bottom - i.top);
|
||||
getSize().height - i.bottom - i.top);*/
|
||||
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
|
||||
* propertysheet?).
|
||||
*
|
||||
* @param evt a value of type 'PropertyChangeEvent'
|
||||
*/
|
||||
synchronized boolean wasModified(int propIndex, Object value, boolean followDependencies) {
|
||||
if (!updateValue(propIndex, value)) {
|
||||
@@ -1065,14 +1064,19 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
||||
} else if (value instanceof PropertyPanel) {
|
||||
component = new JPanel();
|
||||
component.setLayout(new GridBagLayout());
|
||||
component.setOpaque(false);
|
||||
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||
gbConstraints.gridx = 0;
|
||||
gbConstraints.gridy = 0;
|
||||
gbConstraints.weightx = 1.0;
|
||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
component.add((PropertyPanel) value, gbConstraints);
|
||||
JButton dialogButton = new JButton("...");
|
||||
dialogButton.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, Color.LIGHT_GRAY));
|
||||
final JButton dialogButton = new JButton("...");
|
||||
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() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent event) {
|
||||
@@ -1082,7 +1086,7 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
|
||||
});
|
||||
gbConstraints = new GridBagConstraints();
|
||||
gbConstraints.weighty = 1.0;
|
||||
gbConstraints.fill = GridBagConstraints.VERTICAL;
|
||||
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||
gbConstraints.anchor = GridBagConstraints.LINE_END;
|
||||
gbConstraints.gridy = 0;
|
||||
gbConstraints.gridx = 1;
|
||||
|
@@ -31,45 +31,7 @@ public class BigStringEditor implements PropertyEditor {
|
||||
BigStringEditor editor = new BigStringEditor();
|
||||
|
||||
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) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
|
@@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
||||
|
||||
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 backupObject;
|
||||
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
@@ -29,7 +29,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
* respectively
|
||||
*/
|
||||
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.
|
||||
String typeOptions = EvAInfo.getProperty(className);
|
||||
@@ -48,7 +48,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
}
|
||||
classes.add(current);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
Class<?>[] classArray;
|
||||
classArray = ReflectPackage.getAssignableClasses(className, true, true);
|
||||
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);
|
||||
} else {
|
||||
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
|
||||
Field f = clazz.getDeclaredField("hideFromGOE");
|
||||
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;
|
||||
}
|
||||
} 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
|
||||
* 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) {
|
||||
logger.log(Level.FINER, e.getMessage(), e);
|
||||
LOGGER.log(Level.FINER, e.getMessage(), 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());
|
||||
} 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;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
}
|
||||
return orig;
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
try {
|
||||
bi = Introspector.getBeanInfo(cls);
|
||||
} 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;
|
||||
}
|
||||
PropertyDescriptor[] props = bi.getPropertyDescriptors();
|
||||
@@ -266,7 +266,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
*/
|
||||
public void setDefaultValue() {
|
||||
if (classType == null) {
|
||||
logger.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
||||
LOGGER.log(Level.WARNING, "No ClassType set up for GenericObjectEditor!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
public void setValue(Object o) {
|
||||
|
||||
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;
|
||||
}
|
||||
if (!classType.isAssignableFrom(o.getClass())) {
|
||||
@@ -383,10 +383,11 @@ public class GenericObjectEditor implements PropertyEditor {
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (methods[i].getName().equalsIgnoreCase("getName")) {
|
||||
getNameMethod = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IntrospectionException ex) {
|
||||
System.err.println("PropertySheetPanel.setTarget(): Couldn't introspect");
|
||||
LOGGER.log(Level.WARNING, "Could not introspect PropertySheetPanel", ex);
|
||||
return;
|
||||
}
|
||||
if (getNameMethod >= 0) {
|
||||
|
Reference in New Issue
Block a user