refs #14
Fixed AboutDialog Deactivated CustomTabPaneUI Changed default Font for the UI.
This commit is contained in:
parent
0ee348e2b6
commit
3fd2e505a8
@ -38,21 +38,18 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.event.MenuEvent;
|
||||
import javax.swing.event.MenuListener;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class EvAClient implements RemoteStateListener, Serializable {
|
||||
public class EvAClient implements RemoteStateListener {
|
||||
|
||||
/**
|
||||
* Generated serial version identifier.
|
||||
*/
|
||||
private static final long serialVersionUID = 8232856334379977970L;
|
||||
private final int splashScreenTime = 2500;
|
||||
private final int maxWindowMenuLength = 30;
|
||||
private boolean clientInited = false;
|
||||
private JExtDesktopPaneToolBar desktopToolBar;
|
||||
private JDesktopPane desktopPane;
|
||||
@ -67,6 +64,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
private transient JExtMenu menuSelHosts;
|
||||
private transient JExtMenu menuModule;
|
||||
private transient JExtMenu menuOptions;
|
||||
private JPanel statusBar;
|
||||
private transient JProgressBar progressBar;
|
||||
|
||||
// Option
|
||||
@ -234,7 +232,6 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
|
||||
// preload some classes (into system cache) in a parallel thread
|
||||
preloadClasses();
|
||||
|
||||
|
||||
withGUI = !noGui;
|
||||
withTreeView = showTreeView;
|
||||
@ -360,6 +357,22 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
+ this.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set UI Font for all controls.
|
||||
*
|
||||
* @param fontResource The FontUIResource for the controls
|
||||
*/
|
||||
private static void setUIFont(javax.swing.plaf.FontUIResource fontResource) {
|
||||
java.util.Enumeration keys = UIManager.getDefaults().keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
Object key = keys.nextElement();
|
||||
Object value = UIManager.get(key);
|
||||
if (value != null && value instanceof javax.swing.plaf.FontUIResource) {
|
||||
UIManager.put(key, fontResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets given hostname and tries to load GOParamsters from given file if non
|
||||
@ -369,6 +382,8 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
useDefaultModule = EvAInfo.propDefaultModule();
|
||||
this.parentWindow = parent;
|
||||
|
||||
setUIFont(new javax.swing.plaf.FontUIResource(Font.SANS_SERIF, 0, 11));
|
||||
|
||||
if (useDefaultModule != null) {
|
||||
useDefaultModule = useDefaultModule.trim();
|
||||
if (useDefaultModule.length() < 1) {
|
||||
@ -381,13 +396,14 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
|
||||
/* Set Look and Feel */
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
||||
} catch (Exception ex) {
|
||||
LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
|
||||
}
|
||||
|
||||
/* Create main frame with GridBagLayout */
|
||||
mainFrame = new JFrame(EvAInfo.productName);
|
||||
mainFrame = new JFrame(EvAInfo.productName);
|
||||
mainFrame.setLayout(new GridBagLayout());
|
||||
mainFrame.setMinimumSize(new Dimension(800, 600));
|
||||
|
||||
@ -465,12 +481,15 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
gbConstraints.gridheight = GridBagConstraints.RELATIVE;
|
||||
mainFrame.add(horizontalSplit, gbConstraints);
|
||||
|
||||
/* StatusBar of the main frame */
|
||||
statusBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||
statusBar.add(new JLabel("Progress"));
|
||||
|
||||
/* Create ProgressBar and add it to the bottom */
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setBorder(new TitledBorder("Progress"));
|
||||
progressBar.setValue(0);
|
||||
progressBar.setStringPainted(true);
|
||||
/* Create ProgressBar and add it to the status bar */
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setValue(0);
|
||||
progressBar.setStringPainted(true);
|
||||
statusBar.add(progressBar);
|
||||
|
||||
gbConstraints.gridx = 0;
|
||||
gbConstraints.gridy = 2;
|
||||
@ -478,8 +497,8 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
gbConstraints.weighty = 0.0;
|
||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||
gbConstraints.anchor = GridBagConstraints.PAGE_END;
|
||||
mainFrame.add(progressBar, gbConstraints);
|
||||
|
||||
mainFrame.add(statusBar, gbConstraints);
|
||||
|
||||
mainFrame.pack();
|
||||
mainFrame.setVisible(true);
|
||||
}
|
||||
@ -498,6 +517,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
buildMenu();
|
||||
mainFrame.addWindowListener(new WindowAdapter() {
|
||||
|
||||
@Override
|
||||
public void windowClosing(final WindowEvent event) {
|
||||
EvAClient.this.close();
|
||||
}
|
||||
@ -517,10 +537,7 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
LOGGER.log(Level.INFO, "Class path is: {0}", System.getProperty("java.class.path", "."));
|
||||
|
||||
if (!(configurationPane.isVisible())) {
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
//evaFrame.setLocation((int) ((screenSize.width - evaFrame.getWidth()) / 2), (int) ((screenSize.height - evaFrame.getHeight()) / 2.5));
|
||||
configurationPane.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
if (!(mainFrame.isVisible())) {
|
||||
@ -575,22 +592,22 @@ public class EvAClient implements RemoteStateListener, Serializable {
|
||||
public static void main(String[] args) {
|
||||
/*============================COPIED FROM SYSBIO==============================*/
|
||||
// Properties for Mac OS X support.
|
||||
if ((System.getProperty("mrj.version") != null)
|
||||
|| (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1)) {
|
||||
/*
|
||||
* Note: the xDock name property must be set before parsing
|
||||
* command-line arguments! See above!
|
||||
*/
|
||||
System.setProperty("com.apple.mrj.application.apple.menu.about.name", EvAInfo.productName);
|
||||
|
||||
System.setProperty("apple.awt.graphics.EnableQ2DX", "true");
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
System.setProperty("com.apple.macos.smallTabs", "true");
|
||||
System.setProperty("com.apple.macos.useScreenMenuBar", "true");
|
||||
|
||||
System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
|
||||
System.setProperty("com.apple.mrj.application.live-resize", "true");
|
||||
}
|
||||
if ((System.getProperty("mrj.version") != null)
|
||||
|| (System.getProperty("os.name").toLowerCase().indexOf("mac") != -1)) {
|
||||
/*
|
||||
* Note: the xDock name property must be set before parsing
|
||||
* command-line arguments! See above!
|
||||
*/
|
||||
System.setProperty("com.apple.mrj.application.apple.menu.about.name", EvAInfo.productName);
|
||||
|
||||
System.setProperty("apple.awt.graphics.EnableQ2DX", "true");
|
||||
System.setProperty("apple.laf.useScreenMenuBar", "true");
|
||||
System.setProperty("com.apple.macos.smallTabs", "true");
|
||||
System.setProperty("com.apple.macos.useScreenMenuBar", "true");
|
||||
|
||||
System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
|
||||
System.setProperty("com.apple.mrj.application.live-resize", "true");
|
||||
}
|
||||
/*==========================================================================*/
|
||||
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
*/
|
||||
package eva2.gui;
|
||||
|
||||
import com.sun.javaws.ui.JavawsSysRun;
|
||||
import eva2.EvAInfo;
|
||||
import eva2.tools.BasicResourceLoader;
|
||||
import java.awt.*;
|
||||
|
@ -4,29 +4,16 @@ package eva2.gui;
|
||||
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 272
|
||||
* $ $Date: 2007-11-21 18:06:36 +0100 (Wed, 21 Nov 2007) $ $Author: mkron $
|
||||
*/
|
||||
/*
|
||||
* ==========================================================================* IMPORTS
|
||||
*==========================================================================
|
||||
*/
|
||||
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTabbedPane;
|
||||
|
||||
import eva2.server.go.InterfaceNotifyOnInformers;
|
||||
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.logging.Level;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.TabbedPaneUI;
|
||||
import javax.swing.plaf.basic.BasicButtonUI;
|
||||
|
||||
/**
|
||||
@ -62,7 +49,7 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
|
||||
|
||||
tabbedPane = new JTabbedPane();
|
||||
tabbedPane.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
|
||||
tabbedPane.setUI(new eva2.gui.utils.CustomTabbedPaneUI());
|
||||
//tabbedPane.setUI(new eva2.gui.utils.CustomTabbedPaneUI());
|
||||
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
import javax.swing.*;
|
||||
@ -61,10 +62,11 @@ public class GOEPanel extends JPanel implements ItemListener {
|
||||
/**
|
||||
* Creates the GUI editor component
|
||||
*/
|
||||
// private Vector<String> m_ClassesLongName;
|
||||
private GenericObjectEditor genericObjectEditor = null;
|
||||
private boolean withComboBoxToolTips = true; // should tool tips for the combo box be created?
|
||||
private int tipMaxLen = 100; // maximum length of tool tip
|
||||
|
||||
private HashMap<String, String> classNameMap;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -312,15 +314,19 @@ public class GOEPanel extends JPanel implements ItemListener {
|
||||
*
|
||||
*/
|
||||
protected void updateClassType() {
|
||||
Vector<String> classesLongNames;
|
||||
List<String> classesLongNames;
|
||||
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
||||
if (Proxy.isProxyClass(genericObjectEditor.getClassType())) {
|
||||
classesLongNames = new Vector<String>(GenericObjectEditor.getClassesFromProperties(((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) genericObjectEditor.getValue()))).getOriginalClass().getName(), null));
|
||||
classesLongNames = GenericObjectEditor.getClassesFromProperties(((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) genericObjectEditor.getValue()))).getOriginalClass().getName(), null);
|
||||
} else {
|
||||
classesLongNames = new Vector<String>(GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances));
|
||||
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
||||
}
|
||||
if (classesLongNames.size() > 1) {
|
||||
objectChooser.setModel(new DefaultComboBoxModel(classesLongNames));
|
||||
classNameMap = new HashMap<String, String>();
|
||||
for (String className : classesLongNames) {
|
||||
classNameMap.put(EVAHELP.cutClassName(className), className);
|
||||
}
|
||||
objectChooser.setModel(new DefaultComboBoxModel(classNameMap.keySet().toArray()));
|
||||
if (withComboBoxToolTips) {
|
||||
objectChooser.setRenderer(new ToolTipComboBoxRenderer(collectComboToolTips(instances, tipMaxLen)));
|
||||
}
|
||||
@ -364,9 +370,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
||||
*/ (genericObjectEditor.getValue().getClass().getName());
|
||||
boolean found = false;
|
||||
for (int i = 0; i < comboBoxModel.getSize(); i++) {
|
||||
if (TRACE) {
|
||||
System.out.println("in updateChooser: looking at " + (String) comboBoxModel.getElementAt(i));
|
||||
}
|
||||
if (objectName.equals((String) comboBoxModel.getElementAt(i))) {
|
||||
found = true;
|
||||
break;
|
||||
@ -396,11 +399,13 @@ public class GOEPanel extends JPanel implements ItemListener {
|
||||
*
|
||||
* @param e a value of type 'ItemEvent'
|
||||
*/
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
String className;
|
||||
|
||||
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
||||
className = (String) objectChooser.getSelectedItem();
|
||||
className = classNameMap.get(className);
|
||||
try {
|
||||
Object n = (Object) Class.forName(className).newInstance();
|
||||
genericObjectEditor.setValue(n);
|
||||
|
@ -12,6 +12,7 @@ package eva2.gui;
|
||||
/*==========================================================================*
|
||||
* IMPORTS
|
||||
*==========================================================================*/
|
||||
import java.awt.Font;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.KeyStroke;
|
||||
|
Loading…
x
Reference in New Issue
Block a user