Revision: 15164
http://gate.svn.sourceforge.net/gate/?rev=15164&view=rev
Author: markagreenwood
Date: 2012-01-21 15:30:10 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
removed the rest of the SlugGUI code and added some deprecated hints to suggest
that you should use the getInstance methods rather than the constructors
Modified Paths:
--------------
gate/trunk/src/gate/Main.java
gate/trunk/src/gate/gui/MainFrame.java
Modified: gate/trunk/src/gate/Main.java
===================================================================
--- gate/trunk/src/gate/Main.java 2012-01-21 15:28:43 UTC (rev 15163)
+++ gate/trunk/src/gate/Main.java 2012-01-21 15:30:10 UTC (rev 15164)
@@ -180,7 +180,7 @@
applyUserPreferences();
//all the defaults tables have been updated; build the GUI
- frame = new MainFrame(gc);
+ frame = MainFrame.getInstance(gc);
if(DEBUG) Out.prln("constructing GUI");
// run the GUI
Modified: gate/trunk/src/gate/gui/MainFrame.java
===================================================================
--- gate/trunk/src/gate/gui/MainFrame.java 2012-01-21 15:28:43 UTC (rev
15163)
+++ gate/trunk/src/gate/gui/MainFrame.java 2012-01-21 15:30:10 UTC (rev
15164)
@@ -264,7 +264,7 @@
protected static XJFileChooser fileChooser;
- static private MainFrame instance;
+ private static MainFrame instance;
protected OptionsDialog optionsDialog;
@@ -319,9 +319,13 @@
}
static public MainFrame getInstance() {
- if(instance == null) instance = new MainFrame();
- return instance;
+ return getInstance(null);
}
+
+ static synchronized public MainFrame getInstance(GraphicsConfiguration gc) {
+ if(instance == null) instance = new MainFrame(gc);
+ return instance;
+ }
/**
* Get the file chooser.
@@ -430,24 +434,37 @@
}
}// protected void select(ResourceHandle handle)
+ /**
+ * @deprecated use {@link #getInstance()} instead
+ */
+ @Deprecated
public MainFrame() {
this(null);
}
+
+ /**
+ * @deprecated use {@link #getInstance(GraphicsConfiguration)} instead
+ */
+ @Deprecated
+ public MainFrame(boolean isSlugGUI, GraphicsConfiguration gc) {
+ this(gc);
+ }
- public MainFrame(GraphicsConfiguration gc) {
- this(false, gc);
- } // MainFrame
-
/**
* Construct the frame.
- * @param isShellSlacGIU true for embedded uses of GATE where a simpler GUI
- * should be displayed.
* @param gc graphics configuration used,
* see {@link javax.swing.JFrame#JFrame(java.awt.GraphicsConfiguration)}
+ * @deprecated use {@link #getInstance(GraphicsConfiguration)} instead
*/
- public MainFrame(boolean isShellSlacGIU, GraphicsConfiguration gc) {
+ @Deprecated
+ public MainFrame(GraphicsConfiguration gc) {
super(gc);
+
+ // TODO we really don't need this here as it is done getInstance() but for
+ // now we need it here in case people are calling the deprecated
+ // constructors instead
instance = this;
+
// set the WM class
try {
Toolkit xToolkit = Toolkit.getDefaultToolkit();
@@ -456,8 +473,9 @@
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, "GATE Developer");
} catch(Exception e) {
- // ignore
- log.warn("Could not set WM Class", e);
+ // this happens every time on Windows so hide the exception unless we are
+ // debugging something
+ log.debug("Could not set WM Class", e);
}
guiRoots.add(this);
@@ -479,23 +497,20 @@
dialog = null;
}
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
- initLocalData(isShellSlacGIU);
- initGuiComponents(isShellSlacGIU);
- initListeners(isShellSlacGIU);
+ initLocalData();
+ initGuiComponents();
+ initListeners();
} // MainFrame(boolean simple)
- protected void initLocalData(boolean isShellSlacGIU) {
+ protected void initLocalData() {
resourcesTreeRoot = new DefaultMutableTreeNode("GATE", true);
applicationsRoot = new DefaultMutableTreeNode("Applications", true);
- if(isShellSlacGIU) {
- languageResourcesRoot = new DefaultMutableTreeNode("Documents", true);
- }
- else {
- languageResourcesRoot =
+
+ languageResourcesRoot =
new DefaultMutableTreeNode("Language Resources", true);
- } // if
+
processingResourcesRoot =
- new DefaultMutableTreeNode("Processing Resources", true);
+ new DefaultMutableTreeNode("Processing Resources", true);
datastoresRoot = new DefaultMutableTreeNode("Datastores", true);
resourcesTreeRoot.add(applicationsRoot);
resourcesTreeRoot.add(languageResourcesRoot);
@@ -505,7 +520,7 @@
resourcesTreeModel = new ResourcesTreeModel(resourcesTreeRoot, true);
}
- protected void initGuiComponents(boolean isShellSlacGUI) {
+ protected void initGuiComponents() {
this.getContentPane().setLayout(new BorderLayout());
Integer width =
Gate.getUserConfig().getInt(GateConstants.MAIN_FRAME_WIDTH);
@@ -1187,7 +1202,7 @@
this.getContentPane().add(toolbar, BorderLayout.NORTH);
}
- protected void initListeners(boolean isShellSlacGIU) {
+ protected void initListeners() {
Gate.getCreoleRegister().addCreoleListener(this);
resourcesTree.addKeyListener(new KeyAdapter() {
@@ -1586,27 +1601,6 @@
}
});
- if(isShellSlacGIU) {
- mainSplit.setDividerSize(0);
- mainSplit.getTopComponent().setVisible(false);
- mainSplit.getTopComponent().addComponentListener(new ComponentAdapter() {
- public void componentHidden(ComponentEvent e) {
- }
-
- public void componentMoved(ComponentEvent e) {
- mainSplit.setDividerLocation(0);
- }
-
- public void componentResized(ComponentEvent e) {
- mainSplit.setDividerLocation(0);
- }
-
- public void componentShown(ComponentEvent e) {
- mainSplit.setDividerLocation(0);
- }
- });
- } // if
-
// blink the messages tab when new information is displayed
logArea.getDocument().addDocumentListener(
new javax.swing.event.DocumentListener() {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs