[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui Toolbar.java, 1.10, 1.11 GUI.java, 1.131
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2013-05-31 08:01:05
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11090/src/net/sourceforge/bprocessor/gui Modified Files: Toolbar.java GUI.java Log Message: Cleaning up Index: Toolbar.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/Toolbar.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Toolbar.java 14 Sep 2009 16:22:52 -0000 1.10 --- Toolbar.java 31 May 2013 08:01:03 -0000 1.11 *************** *** 39,42 **** --- 39,43 ---- ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); toolBar = new JToolBar(); + toolBar.setFloatable(false); add(toolBar); content = new LinkedList(); Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** GUI.java 15 May 2013 06:44:14 -0000 1.131 --- GUI.java 31 May 2013 08:01:03 -0000 1.132 *************** *** 20,27 **** import java.io.File; import java.util.Collection; - import java.util.HashSet; import java.util.LinkedList; import java.util.List; - import java.util.Set; import javax.swing.AbstractAction; --- 20,25 ---- *************** *** 82,88 **** /** */ private static final long serialVersionUID = 1L; ! private static final boolean IMPORT = false; ! private boolean isMac; --- 80,86 ---- /** */ private static final long serialVersionUID = 1L; ! private static final boolean IMPORT = false; ! private boolean isMac; *************** *** 92,100 **** /** The instance */ private static GUI instance; ! /** Presented */ private boolean presented = false; ! ! /** The main split pane */ private JSplitPane splitPaneLeftRight; --- 90,98 ---- /** The instance */ private static GUI instance; ! /** Presented */ private boolean presented = false; ! ! /** The main split pane */ private JSplitPane splitPaneLeftRight; *************** *** 102,109 **** /** The middle/right split pane */ private JSplitPane splitPaneMiddleRight; ! private Box controlPanels; private List<Component> panels; ! /** The splash */ private SplashWindow plash; --- 100,107 ---- /** The middle/right split pane */ private JSplitPane splitPaneMiddleRight; ! private Box controlPanels; private List<Component> panels; ! /** The splash */ private SplashWindow plash; *************** *** 117,123 **** /** SPLIT_RIGHT */ public static final Integer SPLIT_RIGHT = new Integer(2); - - /** closed spaces */ - private Set<Space> closedSpaces = new HashSet<Space>(); /** The browsing tree */ --- 115,118 ---- *************** *** 127,131 **** private JPanel alertPanel; ! private JTextArea textArea; --- 122,126 ---- private JPanel alertPanel; ! private JTextArea textArea; *************** *** 135,141 **** private MenuFactory menuFactory; ! private List<Operation> operations; ! /** * Constructor for GUI --- 130,136 ---- private MenuFactory menuFactory; ! private List<Operation> operations; ! /** * Constructor for GUI *************** *** 145,153 **** super("B-processor"); String os = System.getProperty("os.name"); ! if (os.startsWith("Mac")) { isMac = true; } ! setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); instance = this; --- 140,148 ---- super("B-processor"); String os = System.getProperty("os.name"); ! if (os.startsWith("Mac")) { isMac = true; } ! setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); instance = this; *************** *** 169,173 **** return instance; } ! /** * --- 164,168 ---- return instance; } ! /** * *************** *** 181,188 **** int result = JOptionPane.showConfirmDialog(parent, message, "", type); System.out.println("Result from the dialog."); ! return result; } ! /** * --- 176,183 ---- int result = JOptionPane.showConfirmDialog(parent, message, "", type); System.out.println("Result from the dialog."); ! return result; } ! /** * *************** *** 191,199 **** public static int confirmSave() { String message = "Do you want to save the changes you made in project \"" ! + Project.getInstance().getName() ! + "\"?"; return GUI.confirm(message); } ! /** * --- 186,194 ---- public static int confirmSave() { String message = "Do you want to save the changes you made in project \"" ! + Project.getInstance().getName() ! + "\"?"; return GUI.confirm(message); } ! /** * *************** *** 212,216 **** } } ! /** * --- 207,211 ---- } } ! /** * *************** *** 226,230 **** return true; } ! /** * --- 221,225 ---- return true; } ! /** * *************** *** 234,238 **** public static boolean userSaveAs() throws Exception { File file = GUI.chooseFile("Save"); ! if (file != null) { if (file.getName().lastIndexOf('.') != -1) { --- 229,233 ---- public static boolean userSaveAs() throws Exception { File file = GUI.chooseFile("Save"); ! if (file != null) { if (file.getName().lastIndexOf('.') != -1) { *************** *** 246,250 **** } } ! /** * --- 241,245 ---- } } ! /** * *************** *** 255,259 **** if (Project.getInstance().isDirty()) { int result = GUI.confirmSave(); ! if (result == JOptionPane.YES_OPTION) { if (userSave()) { --- 250,254 ---- if (Project.getInstance().isDirty()) { int result = GUI.confirmSave(); ! if (result == JOptionPane.YES_OPTION) { if (userSave()) { *************** *** 272,276 **** return true; } ! /** * --- 267,271 ---- return true; } ! /** * *************** *** 283,289 **** /** Abstract action */ private abstract class EditAction implements ActionListener { ! } ! /** * Create menus --- 278,284 ---- /** Abstract action */ private abstract class EditAction implements ActionListener { ! } ! /** * Create menus *************** *** 310,319 **** JMenu tools = new JMenu("Tools"); tools.setMnemonic(KeyEvent.VK_T); ! JMenuItem toolsEnergy = new JMenuItem("Energy calc"); toolsEnergy.setMnemonic(KeyEvent.VK_T); toolsEnergy.addActionListener(new ToolsEnergyActionListener()); tools.add(toolsEnergy); ! menu.registerMenu(tools); --- 305,314 ---- JMenu tools = new JMenu("Tools"); tools.setMnemonic(KeyEvent.VK_T); ! JMenuItem toolsEnergy = new JMenuItem("Energy calc"); toolsEnergy.setMnemonic(KeyEvent.VK_T); toolsEnergy.addActionListener(new ToolsEnergyActionListener()); tools.add(toolsEnergy); ! menu.registerMenu(tools); *************** *** 357,361 **** private abstract class ModellorAction extends AbstractAction { protected Modellor modellor; ! public ModellorAction(Modellor modellor) { super(modellor.title()); --- 352,356 ---- private abstract class ModellorAction extends AbstractAction { protected Modellor modellor; ! public ModellorAction(Modellor modellor) { super(modellor.title()); *************** *** 363,367 **** } } ! private JMenu createCreateMenu() { JMenu create = new JMenu("Create"); --- 358,362 ---- } } ! private JMenu createCreateMenu() { JMenu create = new JMenu("Create"); *************** *** 449,456 **** return create; } ! class CommandAction extends AbstractAction { private Class<? extends Command> clarse; ! public CommandAction(Class<? extends Command> clarse) { super(clarse.getSimpleName()); --- 444,451 ---- return create; } ! class CommandAction extends AbstractAction { private Class<? extends Command> clarse; ! public CommandAction(Class<? extends Command> clarse) { super(clarse.getSimpleName()); *************** *** 491,495 **** editUndo.setMnemonic(KeyEvent.VK_N); editUndo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, ! Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); editUndo.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { --- 486,490 ---- editUndo.setMnemonic(KeyEvent.VK_N); editUndo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, ! Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); editUndo.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { *************** *** 528,532 **** editCopy.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { ! } }); --- 523,527 ---- editCopy.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { ! } }); *************** *** 540,544 **** editPaste.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { ! } }); --- 535,539 ---- editPaste.addActionListener(new EditAction() { public void actionPerformed(ActionEvent arg0) { ! } }); *************** *** 559,573 **** editDelete.setEnabled(false); edit.add(editDelete); - - edit.addSeparator(); - - JMenuItem refreshDataView = new JMenuItem("Refresh Data View"); - refreshDataView.setEnabled(true); - refreshDataView.addActionListener(new EditAction() { - public void actionPerformed(ActionEvent event) { - makeTree(); - }; - }); - edit.add(refreshDataView); Selection.primary().addObserver(new EditMenuListener(edit)); return edit; --- 554,557 ---- *************** *** 593,599 **** fileLoad.setEnabled(true); file.add(fileLoad); ! file.addSeparator(); ! JMenuItem fileClose = new JMenuItem("Close"); fileClose.addActionListener(new FileCloseActionListener()); --- 577,583 ---- fileLoad.setEnabled(true); file.add(fileLoad); ! file.addSeparator(); ! JMenuItem fileClose = new JMenuItem("Close"); fileClose.addActionListener(new FileCloseActionListener()); *************** *** 601,605 **** fileClose.setEnabled(true); file.add(fileClose); ! JMenuItem fileSave = new JMenuItem("Save"); fileSave.addActionListener(new FileSaveActionListener()); --- 585,589 ---- fileClose.setEnabled(true); file.add(fileClose); ! JMenuItem fileSave = new JMenuItem("Save"); fileSave.addActionListener(new FileSaveActionListener()); *************** *** 609,613 **** fileSave.setEnabled(true); file.add(fileSave); ! JMenuItem fileSaveAs = new JMenuItem("Save As"); fileSaveAs.addActionListener(new FileSaveAsActionListener()); --- 593,597 ---- fileSave.setEnabled(true); file.add(fileSave); ! JMenuItem fileSaveAs = new JMenuItem("Save As"); fileSaveAs.addActionListener(new FileSaveAsActionListener()); *************** *** 616,620 **** file.add(fileSaveAs); file.addSeparator(); ! { JMenuItem item = new JMenuItem("Import Data..."); --- 600,604 ---- file.add(fileSaveAs); file.addSeparator(); ! { JMenuItem item = new JMenuItem("Import Data..."); *************** *** 628,634 **** file.add(item); } ! file.addSeparator(); ! JMenuItem fileImport = new JMenuItem("Import..."); fileImport.addActionListener(new FileImportActionListener()); --- 612,618 ---- file.add(item); } ! file.addSeparator(); ! JMenuItem fileImport = new JMenuItem("Import..."); fileImport.addActionListener(new FileImportActionListener()); *************** *** 636,640 **** fileImport.setEnabled(true); file.add(fileImport); ! if (IMPORT) { JMenuItem item = new JMenuItem("Import Library..."); --- 620,624 ---- fileImport.setEnabled(true); file.add(fileImport); ! if (IMPORT) { JMenuItem item = new JMenuItem("Import Library..."); *************** *** 670,674 **** if (file != null && ! state == JFileChooser.APPROVE_OPTION) { try { Project.getInstance().exportObjAll(file.getPath()); --- 654,658 ---- if (file != null && ! state == JFileChooser.APPROVE_OPTION) { try { Project.getInstance().exportObjAll(file.getPath()); *************** *** 691,695 **** if (file != null && ! state == JFileChooser.APPROVE_OPTION) { try { Project.getInstance().exportXmlAll(file.getPath()); --- 675,679 ---- if (file != null && ! state == JFileChooser.APPROVE_OPTION) { try { Project.getInstance().exportXmlAll(file.getPath()); *************** *** 720,724 **** return file; } ! /** * Print a alert message in the gui --- 704,708 ---- return file; } ! /** * Print a alert message in the gui *************** *** 746,750 **** alert(string, where); } ! /** * Print a alert message in the gui --- 730,734 ---- alert(string, where); } ! /** * Print a alert message in the gui *************** *** 781,785 **** alertTimer.stop(); } ! @Override public void mouseExited(MouseEvent e) { --- 765,769 ---- alertTimer.stop(); } ! @Override public void mouseExited(MouseEvent e) { *************** *** 819,823 **** } ! /** * Register menu factory --- 803,807 ---- } ! /** * Register menu factory *************** *** 827,831 **** this.menuFactory = factory; } ! /** * Give menuFactory --- 811,815 ---- this.menuFactory = factory; } ! /** * Give menuFactory *************** *** 835,839 **** return this.menuFactory; } ! /** * Adds a menu to the menu bar. --- 819,823 ---- return this.menuFactory; } ! /** * Adds a menu to the menu bar. *************** *** 844,871 **** menu.registerMenu(extraMenu); } - - /** - * - */ - public void doNew() { - - } - - - /** * Create the main view */ ! public void createMainView() { panels = new LinkedList<Component>(); ! splitPaneMiddleRight = new JSplitPane(); splitPaneMiddleRight.setResizeWeight(1.0); splitPaneLeftRight = new JSplitPane(); splitPaneLeftRight.setDividerSize(7); splitPaneLeftRight.setRightComponent(splitPaneMiddleRight); ! JPanel holder = new JPanel(new BorderLayout()); controlPanels = Box.createVerticalBox(); --- 828,848 ---- menu.registerMenu(extraMenu); } /** * Create the main view */ ! private void createMainView() { panels = new LinkedList<Component>(); ! ! makeTree(); ! splitPaneMiddleRight = new JSplitPane(); splitPaneMiddleRight.setResizeWeight(1.0); splitPaneLeftRight = new JSplitPane(); + splitPaneLeftRight.setLeftComponent(tree); splitPaneLeftRight.setDividerSize(7); splitPaneLeftRight.setRightComponent(splitPaneMiddleRight); ! JPanel holder = new JPanel(new BorderLayout()); controlPanels = Box.createVerticalBox(); *************** *** 874,878 **** vfiller.setPreferredSize(new Dimension(240, 640)); holder.add(BorderLayout.SOUTH, vfiller); ! splitPaneMiddleRight.setRightComponent(new JScrollPane(holder)); --- 851,855 ---- vfiller.setPreferredSize(new Dimension(240, 640)); holder.add(BorderLayout.SOUTH, vfiller); ! splitPaneMiddleRight.setRightComponent(new JScrollPane(holder)); *************** *** 881,885 **** getContentPane().add(splitPaneLeftRight, BorderLayout.CENTER); getContentPane().add(StatusBar.instance(), BorderLayout.SOUTH); ! makeTree(); registerControlPanel(AttributeView.instance()); --- 858,862 ---- getContentPane().add(splitPaneLeftRight, BorderLayout.CENTER); getContentPane().add(StatusBar.instance(), BorderLayout.SOUTH); ! registerControlPanel(AttributeView.instance()); *************** *** 890,896 **** */ private void makeTree() { - if (tree != null) { - tree.removeAll(); - } Font font = new Font("Sans-serif", Font.BOLD, 12); tree = new JTabbedPane(JTabbedPane.TOP); --- 867,870 ---- *************** *** 905,912 **** tree.setMinimumSize(new Dimension(140, 240)); tree.setPreferredSize(new Dimension(275, 240)); - registerPanel(tree, SPLIT_LEFT); } ! /** * --- 879,885 ---- tree.setMinimumSize(new Dimension(140, 240)); tree.setPreferredSize(new Dimension(275, 240)); } ! /** * *************** *** 923,927 **** operations.remove(operation); } ! private void performOperations() { for (Operation current : operations) { --- 896,900 ---- operations.remove(operation); } ! private void performOperations() { for (Operation current : operations) { *************** *** 930,947 **** } } ! /** * Register panel * @param panel The panel component - * @param placement The panel placement */ ! public void registerPanel(Component panel, Integer placement) { ! if (placement.equals(SPLIT_LEFT)) { ! splitPaneLeftRight.setLeftComponent(panel); ! } else if (placement.equals(SPLIT_MIDDLE)) { ! splitPaneMiddleRight.setLeftComponent(panel); ! } else { ! controlPanels.add(panel); ! } } --- 903,913 ---- } } ! /** * Register panel * @param panel The panel component */ ! public void registerPanel(Component panel) { ! splitPaneMiddleRight.setLeftComponent(panel); } *************** *** 959,963 **** } } ! /** * --- 925,929 ---- } } ! /** * *************** *** 974,978 **** } } ! /** * --- 940,944 ---- } } ! /** * *************** *** 986,990 **** } } ! /** * Start the GUI --- 952,956 ---- } } ! /** * Start the GUI *************** *** 994,998 **** setSize(800, 600); } ! /** * Show the GUI --- 960,964 ---- setSize(800, 600); } ! /** * Show the GUI *************** *** 1009,1013 **** Project.getInstance().checkpoint(); Project.getInstance().changed(false); ! Timer animator = new Timer(1000 / 30, new ActionListener() { public void actionPerformed(ActionEvent arg0) { --- 975,979 ---- Project.getInstance().checkpoint(); Project.getInstance().changed(false); ! Timer animator = new Timer(1000 / 30, new ActionListener() { public void actionPerformed(ActionEvent arg0) { *************** *** 1016,1019 **** --- 982,986 ---- }); animator.start(); + System.out.println(this.getSize().width + " , " + this.getSize().height); } /** *************** *** 1025,1038 **** } } ! ! /** ! * Tells if a space is closed. ! * @param sp the space ! * @return wherther or not the space is closed. ! */ ! public boolean isClosed(Space sp) { ! boolean closed = closedSpaces.contains(sp); ! return closed; ! } /** --- 992,996 ---- } } ! /** |