Thread: [Jsmooth-cvs] jsmooth/src/net/charabia/jsmoothgen/application/gui Main.java, 1.8, 1.9 MasterPanel.j
Status: Beta
Brought to you by:
reyes
From: Rodrigo R. <re...@us...> - 2007-05-27 09:15:55
|
Update of /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14961/src/net/charabia/jsmoothgen/application/gui Modified Files: Main.java MasterPanel.java Log Message: adds support for the splash screen in the jsmooth application Index: Main.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/Main.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Main.java 13 May 2007 20:06:25 -0000 1.8 --- Main.java 27 May 2007 09:15:48 -0000 1.9 *************** *** 47,58 **** private Main() { ! Splash splash = new Splash(this, "/icons/splash.png", false); ! splash.setVersion(VERSION); ! splash.show(); m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); getContentPane().setLayout(new BorderLayout()); m_panel = new MasterPanel(); getContentPane().add(BorderLayout.CENTER, m_panel); --- 47,63 ---- private Main() { ! setupSplash(this); ! ! setSplashProgress(3, 100); m_projectFileChooser.addChoosableFileFilter(new SimpleFileFilter("jsmooth", "JSmooth Project Files")); + setSplashProgress(6, 100); + getContentPane().setLayout(new BorderLayout()); m_panel = new MasterPanel(); + + setSplashProgress(90, 100); + getContentPane().add(BorderLayout.CENTER, m_panel); *************** *** 60,63 **** --- 65,70 ---- setupToolBar(); + setSplashProgress(95, 100); + addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) *************** *** 69,73 **** setTitle("Untitled"); loadWindowSettings(); ! splash.dispose(); } --- 76,83 ---- setTitle("Untitled"); loadWindowSettings(); ! ! setSplashProgress(100, 100); ! ! closeSplash(); } *************** *** 137,140 **** --- 147,155 ---- + public java.io.File getProjectFile() + { + return m_panel.getProjectFile(); + } + private final Icon ICON_NEW = new javax.swing.ImageIcon(getClass().getResource("/icons/stock_new.png")); public final Action NEW = new AbstractAction(local("NEW"), ICON_NEW) { *************** *** 161,166 **** } ! // if (openDirect(m_projectFileChooser.getSelectedFile())) ! // m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); } } --- 176,181 ---- } ! // if (openDirect(m_projectFileChooser.getSelectedFile())) ! // m_recentMenuManager.add(m_projectFileChooser.getSelectedFile().getAbsolutePath()); } } *************** *** 332,338 **** --- 347,393 ---- } + static Splash s_splashWindow = null; + + static private void setupSplash(Frame parent) + { + jsmooth.SplashWindow spw = null; + if (jsmooth.Native.isAvailable()) + spw = jsmooth.Native.getSplashWindow(); + + if (spw == null) + { + s_splashWindow = new Splash(parent, "/icons/splash.png", false); + s_splashWindow.setVersion(VERSION); + s_splashWindow.show(); + } + } + + static public Object setSplashProgress(int cur, int max) + { + if (s_splashWindow == null) + { + System.out.println("setSplashProgress... " + cur + "/" + max); + jsmooth.SplashWindow spw = null; + if (jsmooth.Native.isAvailable()) + spw = jsmooth.Native.getSplashWindow(); + + if (spw != null) + { + spw.setProgress(cur, max); + } + } + return null; + } + + static private void closeSplash() + { + if (s_splashWindow != null) + s_splashWindow.dispose(); + } + public static void main(String args[]) { System.out.println("Running JSmooth..."); + try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); *************** *** 355,358 **** --- 410,414 ---- } + closeSplash(); Main.MAIN.setVisible(true); } Index: MasterPanel.java =================================================================== RCS file: /cvsroot/jsmooth/jsmooth/src/net/charabia/jsmoothgen/application/gui/MasterPanel.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MasterPanel.java 7 Apr 2007 10:47:33 -0000 1.4 --- MasterPanel.java 27 May 2007 09:15:48 -0000 1.5 *************** *** 35,41 **** public class MasterPanel extends JPanel { ! private JButtonBar m_leftBar = new JButtonBar(JButtonBar.VERTICAL); ! private ButtonGroup m_leftGroup = new ButtonGroup(); ! private JPanel m_mainpanel = new JPanel(); private JScrollBar m_mainpanelVBar; private JScrollPane m_scrollpane; --- 35,41 ---- public class MasterPanel extends JPanel { ! private JButtonBar m_leftBar; ! private ButtonGroup m_leftGroup; ! private JPanel m_mainpanel; private JScrollBar m_mainpanelVBar; private JScrollPane m_scrollpane; *************** *** 48,99 **** private java.io.File m_modelLocation = null; ! private EditorPool m_edPool = new EditorPool(); private String m_currentPanelName = ""; ! private Object[] m_skelElements = { ! new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), ! new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() ! }; ! private Object[] m_execElements = { ! "GUI_LABEL_EXECUTABLE_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , ! new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , ! new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() ! }; ! private Object[] m_appElements = { ! "GUI_LABEL_APPLICATION_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.MainClass(), ! new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), ! "GUI_LABEL_EMBEDDEDJAR_SETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), ! new net.charabia.jsmoothgen.application.gui.editors.ClassPath() ! }; ! private Object[] m_jvmSelElements = { ! "GUI_LABEL_JAVA_VERSION", ! new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), ! new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), ! "GUI_LABEL_BUNDLEDJRE", ! new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), ! new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() ! }; ! private Object[] m_jvmCfgElements = { ! "GUI_LABEL_MEMORYSETTINGS", ! new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), ! new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), ! new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() ! }; ! private Object[] m_jsInfo = { ! new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() ! }; public MasterPanel() { setLayout(new BorderLayout()); add(BorderLayout.WEST, m_scrollpane = new JScrollPane(m_leftBar)); --- 48,171 ---- private java.io.File m_modelLocation = null; ! private EditorPool m_edPool; // = new EditorPool(); private String m_currentPanelName = ""; ! private Object[] m_skelElements, m_execElements, m_appElements, m_jvmSelElements, m_jvmCfgElements, m_jsInfo; ! // private Object[] m_skelElements = { ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), ! // new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() ! // // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() ! // }; ! // private Object[] m_execElements = { ! // "GUI_LABEL_EXECUTABLE_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , ! // new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , ! // new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() ! // }; ! // private Object[] m_appElements = { ! // "GUI_LABEL_APPLICATION_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.MainClass(), ! // new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), ! // "GUI_LABEL_EMBEDDEDJAR_SETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), ! // new net.charabia.jsmoothgen.application.gui.editors.ClassPath() ! // }; ! // private Object[] m_jvmSelElements = { ! // "GUI_LABEL_JAVA_VERSION", ! // new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), ! // new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), ! // "GUI_LABEL_BUNDLEDJRE", ! // new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), ! // new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() ! // }; ! // private Object[] m_jvmCfgElements = { ! // "GUI_LABEL_MEMORYSETTINGS", ! // new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), ! // new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), ! // new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() ! // }; ! ! // private Object[] m_jsInfo = { ! // new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() ! // }; public MasterPanel() { + Main.setSplashProgress(10,100); + + // m_edPool = new EditorPool(); + Main.setSplashProgress(12,100); + m_leftBar = new JButtonBar(JButtonBar.VERTICAL); + m_leftGroup = new ButtonGroup(); + m_mainpanel = new JPanel(); + + Main.setSplashProgress(15,100); + + m_skelElements = new Object[] { + new net.charabia.jsmoothgen.application.gui.editors.SkeletonChooser(), + Main.setSplashProgress(18,100), + new net.charabia.jsmoothgen.application.gui.editors.SkeletonPropertiesEditor() + // new net.charabia.jsmoothgen.application.gui.editors.SkeletonProperties() + }; + Main.setSplashProgress(20,100); + + m_execElements = new Object[] { + "GUI_LABEL_EXECUTABLE_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.ExecutableName() , + Main.setSplashProgress(25,100), + new net.charabia.jsmoothgen.application.gui.editors.ExecutableIcon() , + Main.setSplashProgress(30,100), + new net.charabia.jsmoothgen.application.gui.editors.CurrentDirectory() + }; + Main.setSplashProgress(40,100); + + m_appElements = new Object[] { + "GUI_LABEL_APPLICATION_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.MainClass(), + Main.setSplashProgress(35,100), + new net.charabia.jsmoothgen.application.gui.editors.ApplicationArguments(), + Main.setSplashProgress(40,100), + "GUI_LABEL_EMBEDDEDJAR_SETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.EmbeddedJar(), + Main.setSplashProgress(45,100), + new net.charabia.jsmoothgen.application.gui.editors.ClassPath() + }; + Main.setSplashProgress(50,100); + + m_jvmSelElements = new Object[] { + "GUI_LABEL_JAVA_VERSION", + new net.charabia.jsmoothgen.application.gui.editors.MinVersion(), + Main.setSplashProgress(55,100), + new net.charabia.jsmoothgen.application.gui.editors.MaxVersion(), + Main.setSplashProgress(60,100), + "GUI_LABEL_BUNDLEDJRE", + new net.charabia.jsmoothgen.application.gui.editors.JVMBundle(), + Main.setSplashProgress(65,100), + new net.charabia.jsmoothgen.application.gui.editors.JVMSearchSequence() + }; + Main.setSplashProgress(70,100); + + m_jvmCfgElements = new Object[] { + "GUI_LABEL_MEMORYSETTINGS", + new net.charabia.jsmoothgen.application.gui.editors.MaxMemoryHeap(), + Main.setSplashProgress(75,100), + new net.charabia.jsmoothgen.application.gui.editors.InitialMemoryHeap(), + Main.setSplashProgress(80,100), + new net.charabia.jsmoothgen.application.gui.editors.JavaProperties() + }; + Main.setSplashProgress(85,100); + + m_jsInfo = new Object[] { + new net.charabia.jsmoothgen.application.gui.editors.JSmoothInfo() + }; + + Main.setSplashProgress(90,100); + setLayout(new BorderLayout()); add(BorderLayout.WEST, m_scrollpane = new JScrollPane(m_leftBar)); *************** *** 105,108 **** --- 177,181 ---- m_mainpanel.setLayout(new RiverLayout()); + Main.setSplashProgress(92,100); addAction("Welcome", "/icons/stock_form-properties.png", m_jsInfo); addAction("Skeleton", "/icons/stock_new-template.png", m_skelElements); *************** *** 111,115 **** addAction("JVM Selection", "/icons/stock_search.png", m_jvmSelElements); addAction("JVM Configuration", "/icons/stock_form-properties.png", m_jvmCfgElements); ! setupPanel(m_jsInfo); } --- 184,189 ---- addAction("JVM Selection", "/icons/stock_search.png", m_jvmSelElements); addAction("JVM Configuration", "/icons/stock_form-properties.png", m_jvmCfgElements); ! Main.setSplashProgress(94,100); ! setupPanel(m_jsInfo); } *************** *** 157,164 **** JPanel pgroup = null; ! for (int i=0; i<els.length; i++) { ! if (els[i] instanceof Editor) { // Editor ed = m_edPool.getInstance(els[i]); --- 231,244 ---- JPanel pgroup = null; ! Main.setSplashProgress(50,100); for (int i=0; i<els.length; i++) { ! Main.setSplashProgress(55+(i*3),100); ! ! if (els[i] == null) ! { ! // to nothing... ! } ! else if (els[i] instanceof Editor) { // Editor ed = m_edPool.getInstance(els[i]); *************** *** 344,349 **** m_model.normalizePaths(m_modelLocation.getParentFile(), true); JSmoothModelPersistency.save(m_modelLocation, m_model); ! // System.out.println("saving model " + m_model); ! // fireModelChanged(); return true; } catch (java.io.IOException iox) --- 424,429 ---- m_model.normalizePaths(m_modelLocation.getParentFile(), true); JSmoothModelPersistency.save(m_modelLocation, m_model); ! System.out.println("saving model " + m_model); ! fireModelChanged(); return true; } catch (java.io.IOException iox) *************** *** 423,427 **** m_modelLocation = prjfile; } - public JSmoothModelBean getModel() --- 503,506 ---- |