Source Code Cross Referenced for MainFrame.java in  » UML » MetaBoss » com » metaboss » applications » designstudio » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » MetaBoss » com.metaboss.applications.designstudio 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
0002:        // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
0003:        // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
0004:        // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
0005:        // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
0006:        // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0007:        // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
0008:        // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
0009:        // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
0010:        // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
0011:        // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
0012:        // POSSIBILITY OF SUCH DAMAGE.
0013:        //
0014:        // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
0015:        package com.metaboss.applications.designstudio;
0016:
0017:        import java.awt.BorderLayout;
0018:        import java.awt.Component;
0019:        import java.awt.Container;
0020:        import java.awt.Cursor;
0021:        import java.awt.Dimension;
0022:        import java.awt.Graphics;
0023:        import java.awt.event.ActionEvent;
0024:        import java.awt.event.ComponentAdapter;
0025:        import java.awt.event.ComponentEvent;
0026:        import java.awt.event.KeyEvent;
0027:        import java.awt.event.WindowEvent;
0028:        import java.util.ArrayList;
0029:
0030:        import javax.swing.Action;
0031:        import javax.swing.ActionMap;
0032:        import javax.swing.InputMap;
0033:        import javax.swing.JComponent;
0034:        import javax.swing.JFrame;
0035:        import javax.swing.JMenu;
0036:        import javax.swing.JMenuBar;
0037:        import javax.swing.JOptionPane;
0038:        import javax.swing.JPanel;
0039:        import javax.swing.JSplitPane;
0040:        import javax.swing.JToolBar;
0041:        import javax.swing.KeyStroke;
0042:        import javax.swing.UIManager;
0043:
0044:        import com.metaboss.applications.designstudio.Application.ObjectChangedEvent;
0045:        import com.metaboss.applications.designstudio.Application.OnContainerChangedEvent;
0046:        import com.metaboss.applications.designstudio.Application.OnContainerCloseEvent;
0047:        import com.metaboss.applications.designstudio.Application.OnElementIndexChangedEvent;
0048:        import com.metaboss.applications.designstudio.Application.OnModelChangedEvent;
0049:        import com.metaboss.applications.designstudio.Application.OptionsChangedEvent;
0050:        import com.metaboss.applications.designstudio.Application.ShowContainerEvent;
0051:        import com.metaboss.applications.designstudio.auxilarydialogs.AboutDialog;
0052:        import com.metaboss.applications.designstudio.auxilarydialogs.OptionsDialog;
0053:        import com.metaboss.applications.designstudio.components.ContainerAction;
0054:        import com.metaboss.applications.designstudio.components.DockLayout;
0055:        import com.metaboss.applications.designstudio.components.EtchedToolBarBorder;
0056:        import com.metaboss.applications.designstudio.components.SeparatorAction;
0057:        import com.metaboss.applications.designstudio.components.SplitPane;
0058:        import com.metaboss.applications.designstudio.components.StatusBar;
0059:        import com.metaboss.applications.designstudio.components.TabPanel;
0060:        import com.metaboss.applications.designstudio.components.TabPanel.TabPanelEvent;
0061:        import com.metaboss.applications.designstudio.designtree.DesignTreePanel;
0062:        import com.metaboss.applications.designstudio.designtree.DesignTreeTabDescriptor;
0063:        import com.metaboss.applications.designstudio.icons.IconsHolder;
0064:        import com.metaboss.applications.designstudio.propertiesview.PropertiesViewPanel;
0065:        import com.metaboss.applications.designstudio.userobjects.ModelUserObject;
0066:        import com.metaboss.sdlctools.models.metabossmodel.ModelElement;
0067:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataDictionary;
0068:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.DataType;
0069:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Namespace;
0070:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.Structure;
0071:        import com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel.TypeTemplate;
0072:        import com.metaboss.sdlctools.models.metabossmodel.designlibrarymodel.DesignLibrary;
0073:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Enterprise;
0074:        import com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.Message;
0075:        import com.metaboss.sdlctools.models.metabossmodel.technologylibrarymodel.StorageTechnology;
0076:
0077:        /*		Design Studion main frame class			*/
0078:
0079:        public class MainFrame extends JFrame {
0080:            public static final int MIN_WIDTH = 300;
0081:            public static final int MIN_HEIGHT = 200;
0082:
0083:            private boolean mNoClose = false;
0084:            // UI components
0085:            private SplitPane mSplitPane = null;
0086:            private SplitPane mRightSplitPane = null;
0087:            private StatusBar mStatusBar = new StatusBar();
0088:            private JPanel mMDI = new MDIPanel();
0089:            private TabPanel mTabPanel = null;
0090:            private JPanel mToolbarBoundry = new JPanel();
0091:            // designtreepanel
0092:            public DesignTreePanel mTreePanel = null;
0093:            private PropertiesViewPanel mPropertiesPanel = null;
0094:            // toolbars
0095:            private JToolBar mFileToolBar = new JToolBar();
0096:            private JToolBar mActionToolBar = new JToolBar();
0097:            private JToolBar mModelToolBar = new JToolBar();
0098:            private JToolBar mCurrentWindowToolBar = new JToolBar();
0099:            // main menu
0100:            private JMenuBar mMenuBar = new JMenuBar();
0101:            private JMenu mMenuFile = new JMenu(Application
0102:                    .getString("file_menu"));
0103:            private JMenu mMenuView = new JMenu(Application
0104:                    .getString("view_menu"));
0105:            private JMenu mMenuTools = new JMenu(Application
0106:                    .getString("tools_menu"));
0107:            private JMenu mMenuWindow = new JMenu(Application
0108:                    .getString("window_menu"));
0109:            private JMenu mMenuAction = new JMenu(Application
0110:                    .getString("action_menu"));
0111:            private JMenu mMenuModel = new JMenu(Application
0112:                    .getString("model_menu"));
0113:            private JMenu mMenuHelp = new JMenu(Application
0114:                    .getString("help_menu"));
0115:
0116:            private int mNextFrameX = 0;
0117:            private int mNextFrameY = 0;
0118:            private int mFrameDistance = 0;
0119:
0120:            // actions
0121:            private Action mExitAction = new ExitAction();
0122:            private Action mSearchAction = new SearchAction();
0123:            private Action mRefreshAction = new RefreshAction();
0124:            private Action mPrintAction = new PrintAction();
0125:            private Action mOptionsAction = new OptionsAction();
0126:            private Action mAboutAction = new AboutAction();
0127:            private Action mCloseActiveWindowAction = new CloseActiveWindowAction();
0128:            private Action mCloseAllAction = new CloseAllAction();
0129:            private Action mNextWindowAction = new NextWindowAction();
0130:            private Action mPrevWindowAction = new PrevWindowAction();
0131:            private Action mShowStatusBarAction = new ShowStatusBarAction();
0132:            private Action mShowPropertiesBarAction = new ShowPropertiesBarAction();
0133:            private Action mShowSystemLogAction = new ShowSystemLogAction();
0134:            private Action mValidateModelAction = new ValidateModelAction();
0135:            private Action mRectifyModelAction = new RectifyModelAction();
0136:            private Action mValidateModelsAction = new ValidateModelsAction();
0137:            private Action mNewEnterpriseModelAction = new NewEnterpriseModelAction();
0138:            private Action mOpenModelAction = new OpenModelAction();
0139:            private Action mSaveModelAction = new SaveModelAction();
0140:            private Action mSaveAllModelsAction = new SaveAllModelsAction();
0141:            private Action mCloseModelAction = new CloseModelAction();
0142:            private Action mCloseAllModelsAction = new CloseAllModelsAction();
0143:            private Action mExportModelAsMetaBossXMIAction = new ExportModelAsMetaBossXMIAction();
0144:            private Action mExportModelAsUMLXMIAction = new ExportModelAsUMLXMIAction();
0145:            private Action mEditModelPropertiesAction = new EditModelPropertiesAction();
0146:            private ContainerAction mReopenAction = new ContainerAction(
0147:                    Application.getString("reopen_item"));
0148:
0149:            public MainFrame() {
0150:                super (Application.getString("title"));
0151:                getContentPane().setFont(Application.DEFAULT_FONT);
0152:
0153:                //????
0154:                mSearchAction.setEnabled(false);
0155:                mPrintAction.setEnabled(false);
0156:                //????
0157:
0158:                try {
0159:                    addComponentListener(new ComponentAdapter() {
0160:                        public void componentResized(ComponentEvent e) {
0161:                            Component c = e.getComponent();
0162:                            if (c.getWidth() < MIN_WIDTH)
0163:                                c.setSize(MIN_WIDTH, c.getHeight());
0164:                            if (c.getHeight() < MIN_HEIGHT)
0165:                                c.setSize(c.getWidth(), MIN_HEIGHT);
0166:                        }
0167:                    });
0168:
0169:                    createTabPanel();
0170:                    createDesignTreePanel();
0171:                    createPropertiesPanel();
0172:                    createSplitPane();
0173:                    createToolBar();
0174:                    createMainMenu();
0175:                    createStatusBar();
0176:
0177:                    mToolbarBoundry.add(mSplitPane, BorderLayout.CENTER);
0178:                    getContentPane().add(mToolbarBoundry);
0179:                    getContentPane().add(mStatusBar, BorderLayout.SOUTH);
0180:
0181:                    setIconImage(IconsHolder.loadImage("MetaBoss.gif"));
0182:
0183:                    Application.fillActions(getFileActions(), mFileToolBar,
0184:                            mMenuFile, null);
0185:                    Application.fillActions(getModelActions(), mModelToolBar,
0186:                            mMenuModel, null);
0187:                    Application.fillActions(getViewActions(null), null,
0188:                            mMenuView, null);
0189:                    Application.fillActions(getActionActions(null),
0190:                            mActionToolBar, mMenuAction, null);
0191:                    Application.fillActions(getToolsActions(), null,
0192:                            mMenuTools, null);
0193:                    Application.fillActions(getWindowActions(), null,
0194:                            mMenuWindow, null);
0195:                    Application.fillActions(getHelpActions(), null, mMenuHelp,
0196:                            null);
0197:
0198:                    pack();
0199:                    createEventListeners();
0200:                    checkActions();
0201:                    //			setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
0202:
0203:                    InputMap lMap = mSplitPane
0204:                            .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
0205:                    lMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
0206:                            KeyEvent.CTRL_MASK), "next");
0207:                    lMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_TAB,
0208:                            KeyEvent.CTRL_MASK | KeyEvent.SHIFT_MASK), "prev");
0209:
0210:                    ActionMap lActionMap = mSplitPane.getActionMap();
0211:                    lActionMap.put("next", mNextWindowAction);
0212:                    lActionMap.put("prev", mPrevWindowAction);
0213:                } catch (Throwable t) {
0214:                    t.printStackTrace();
0215:                }
0216:            }
0217:
0218:            // show frame
0219:            public void makeVisible() {
0220:                setBounds(Application.properties.mMainFrameBounds);
0221:                setVisible(true);
0222:                setSplittersInitialState();
0223:                Application.splash.setVisible(false);
0224:            }
0225:
0226:            public void beforeClose() {
0227:                //???closeAllWindows(false);
0228:                Application.properties.mMainFrameBounds = getBounds();
0229:                Application.properties.mDeviderLocation = mSplitPane
0230:                        .getDividerLocation();
0231:                if (mPropertiesPanel.isVisible())
0232:                    Application.properties.mRightDeviderLocation = mRightSplitPane
0233:                            .getDividerLocation();
0234:                Application.properties.mViewStatusBar = mStatusBar.isVisible();
0235:                //Application.properties.mViewPropertiesBar = mPropertiesPanel.isVisible();
0236:            }
0237:
0238:            // get current package
0239:            public ModelUserObject getCurrentPackage() {
0240:                return mTreePanel.getCurrentPackage();
0241:            }
0242:
0243:            // update child compoents on options change event
0244:            protected void updateComponents() {
0245:                //mTabPanel.setCloseRegime(Application.properties.mCloseButtonRegime);
0246:            }
0247:
0248:            /**Overridden so we can exit when window is closed*/
0249:            protected void processWindowEvent(WindowEvent e) {
0250:                super .processWindowEvent(e);
0251:
0252:                switch (e.getID()) {
0253:                case WindowEvent.WINDOW_CLOSING:
0254:                    if (!mNoClose)
0255:                        Application.exit();
0256:                    break;
0257:                }
0258:            }
0259:
0260:            public class NoCloseException extends Exception {
0261:            }
0262:
0263:            public void setVisible(boolean b) {
0264:                if (!b) {
0265:                    if (closeAllWindows(false) && saveApplicationData()) {
0266:                        super .setVisible(b);
0267:                    }
0268:                } else
0269:                    super .setVisible(b);
0270:            }
0271:
0272:            // save Models
0273:            private boolean saveApplicationData() {
0274:                mNoClose = false;
0275:                boolean lResult = true;
0276:                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
0277:                try {
0278:                    try {
0279:                        Application.saveModels(true, true);
0280:                    } catch (Exception e) {
0281:                        lResult = false;
0282:                        mNoClose = true;
0283:                    }
0284:                } finally {
0285:                    setCursor(Cursor.getDefaultCursor());
0286:                }
0287:                return lResult;
0288:            }
0289:
0290:            // create Application Events listeners
0291:            private void createEventListeners() {
0292:                Application
0293:                        .addOptionsEventListener(new Application.OptionsChangedListener() {
0294:                            public void optionsChanged(OptionsChangedEvent event) {
0295:                                updateComponents();
0296:                                if (event.getMetabossChanged()) {
0297:                                    beforeClose();
0298:                                    Application.fireRefresh();
0299:                                }
0300:                            }
0301:                        });
0302:                Application
0303:                        .addContainerShowListener(new Application.ShowContainerListener() {
0304:                            public void showContainer(ShowContainerEvent event) {
0305:                                int lIndex = mTabPanel.findTabIndexByName(event
0306:                                        .getUserObject().getID());
0307:                                if (lIndex == -1) {
0308:                                    BaseUserObject lObject = event
0309:                                            .getUserObject();
0310:                                    if (lObject != null)
0311:                                        mTabPanel.addTab(lObject
0312:                                                .getContainerCaption(), lObject
0313:                                                .getID(), event.getContainer(),
0314:                                                event.getIcon());
0315:                                } else
0316:                                    mTabPanel.setTabIndex(lIndex);
0317:                                checkActions();
0318:                            }
0319:                        });
0320:                Application
0321:                        .addOnContainerCloseListener(new Application.OnContainerCloseListener() {
0322:                            public void closeContainer(
0323:                                    OnContainerCloseEvent event) {
0324:                                Application.fillActions(getViewActions(null),
0325:                                        mCurrentWindowToolBar, mMenuView, null);
0326:                                mToolbarBoundry.repaint();
0327:                                checkActions();
0328:                            }
0329:                        });
0330:                Application
0331:                        .addOnContainerChangedListener(new Application.OnContainerChangedListener() {
0332:                            public void containerChanged(
0333:                                    OnContainerChangedEvent event) {
0334:                                checkActions();
0335:                            }
0336:                        });
0337:                Application
0338:                        .addObjectChanged(new Application.ObjectChangedListener() {
0339:                            public void onObjectChanged(ObjectChangedEvent event) {
0340:                                BaseUserObject lObject = null;
0341:                                switch (event.getEventSource()) {
0342:                                case ObjectChangedEvent.ET_SELECTED:
0343:                                    processObjectChanged(event.getUserObject());
0344:                                    break;
0345:                                case ObjectChangedEvent.ET_SELECT:
0346:                                    mTreePanel.objectSelected(event
0347:                                            .getUserObject());
0348:                                    break;
0349:                                case ObjectChangedEvent.ET_EDITED:
0350:                                    processObjectChanged(event.getUserObject());
0351:                                    mTreePanel.objectChanged(event
0352:                                            .getUserObject());
0353:                                    checkActions();
0354:                                    break;
0355:                                case ObjectChangedEvent.ET_INSERTED:
0356:                                    mTreePanel.addNewObject(event
0357:                                            .getUserObject());
0358:                                    checkActions();
0359:                                    break;
0360:                                case ObjectChangedEvent.ET_DELETED:
0361:                                    closeObjectContainers(event.getObjectID());
0362:                                    Application.fillActions(
0363:                                            getActionActions(null),
0364:                                            mActionToolBar, mMenuAction, null);
0365:                                    lObject = event.getUserObject();
0366:                                    if (lObject == null)
0367:                                        mTreePanel.removeNode(event
0368:                                                .getObjectID());
0369:                                    else
0370:                                        mTreePanel.removeNode(lObject);
0371:                                    checkActions();
0372:                                    break;
0373:                                case ObjectChangedEvent.ET_MOVED:
0374:                                    lObject = event.getUserObject();
0375:                                    if (lObject != null) {
0376:                                        mTreePanel.objectMoved(lObject);
0377:                                        checkActions();
0378:                                    }
0379:                                    break;
0380:                                }
0381:                            }
0382:                        });
0383:                Application
0384:                        .addOnModelChangedListener(new Application.OnModelChangedListener() {
0385:                            public void modelChanged(OnModelChangedEvent event) {
0386:                                Application.fillActions(getFileActions(),
0387:                                        mFileToolBar, mMenuFile, null);
0388:                                checkActions();
0389:                                processObjectChanged(mTreePanel
0390:                                        .getCurrentUserObject());
0391:                            }
0392:                        });
0393:                Application
0394:                        .addCloseModelListener(new Application.CloseModelListener() {
0395:                            public void closeModel(
0396:                                    Application.CloseModelEvent event) {
0397:                                try {
0398:                                    Application.sModelRepository
0399:                                            .closeModel(event.getModel()
0400:                                                    .getFileName());
0401:                                } catch (Exception e) {
0402:                                    Application.processError(e);
0403:                                }
0404:                            }
0405:                        });
0406:                Application
0407:                        .addElementIndexChangedEvent(new Application.OnElemenIndexChangedEventListener() {
0408:                            public void indexChanged(
0409:                                    OnElementIndexChangedEvent event) {
0410:                                mTreePanel.processObjectIndexChanged(event
0411:                                        .getUserObject(), event.getNewIndex(),
0412:                                        event.getOldIndex());
0413:                            }
0414:                        });
0415:            }
0416:
0417:            private void closeObjectContainers(String pID) {
0418:                int i = 0;
0419:                while (i < mTabPanel.getTabCount()) {
0420:                    BaseChildPanel lPanel = (BaseChildPanel) mTabPanel
0421:                            .getPanel(i);
0422:                    if (lPanel != null) {
0423:                        ModelElement lElement = lPanel.getBOObject();
0424:                        if (lElement != null && lElement.refMofId().equals(pID)) {
0425:                            lPanel.setChanged(false);
0426:                            mTabPanel.deleteTab(i);
0427:                            continue;
0428:                        }
0429:                        if (lPanel instanceof  BaseGraphPanel) {
0430:                            BaseGraphModel lModel = (BaseGraphModel) ((BaseGraphPanel) lPanel)
0431:                                    .getModel();
0432:                            if (lModel != null && lModel.mDiagram != null
0433:                                    && lModel.mDiagram.refMofId().equals(pID)) {
0434:                                lPanel.setChanged(false);
0435:                                mTabPanel.deleteTab(i);
0436:                                continue;
0437:                            }
0438:                        }
0439:                    }
0440:                    i++;
0441:                }
0442:            }
0443:
0444:            // process current model object changed event
0445:            private void processObjectChanged(BaseUserObject pObject) {
0446:                Application.fillActions(getActionActions(pObject),
0447:                        mActionToolBar, mMenuAction, null);
0448:                showRightPropertiesPanel(pObject);
0449:                if (pObject != null) {
0450:                    mStatusBar.setPanelText(1, pObject.getToolTip());
0451:                    int lIndex = mTabPanel.findTabIndexByName(pObject.getID());
0452:                    if (lIndex > -1)
0453:                        mTabPanel.setTabCaption(pObject.getContainerCaption(),
0454:                                lIndex);
0455:                } else
0456:                    mStatusBar.setPanelText(1, "");
0457:            }
0458:
0459:            // create split pane
0460:            private void createSplitPane() {
0461:                mMDI.setLayout(new BorderLayout());
0462:                mMDI.add(mTabPanel, BorderLayout.NORTH);
0463:                //mMDI.setBackground(SystemColor.desktop);
0464:                mMDI.setBackground(UIManager.getColor("desktop"));
0465:
0466:                mRightSplitPane = new SplitPane(JSplitPane.VERTICAL_SPLIT,
0467:                        mMDI, mPropertiesPanel);
0468:                mSplitPane = new SplitPane(JSplitPane.HORIZONTAL_SPLIT,
0469:                        mTreePanel, mRightSplitPane);
0470:                //getContentPane().add(mSplitPane);
0471:            }
0472:
0473:            // create properties panel
0474:            private void createPropertiesPanel() {
0475:                mPropertiesPanel = new PropertiesViewPanel();
0476:                //mPropertiesPanel.setVisible(Application.properties.mViewPropertiesBar);
0477:                //?? 	
0478:            }
0479:
0480:            //create toolbar
0481:            private void createToolBar() {
0482:                mFileToolBar.setBorder(new EtchedToolBarBorder());
0483:                mFileToolBar.setRollover(true);
0484:                mActionToolBar.setBorder(new EtchedToolBarBorder());
0485:                mActionToolBar.setRollover(true);
0486:                mModelToolBar.setBorder(new EtchedToolBarBorder());
0487:                mModelToolBar.setRollover(true);
0488:                mCurrentWindowToolBar.setBorder(new EtchedToolBarBorder());
0489:                mCurrentWindowToolBar.setRollover(true);
0490:
0491:                // toolbar boundary		
0492:                mToolbarBoundry.setLayout(new DockLayout());
0493:                mToolbarBoundry.add(mFileToolBar, BorderLayout.NORTH);
0494:                mToolbarBoundry.add(mModelToolBar, BorderLayout.NORTH);
0495:                mToolbarBoundry.add(mActionToolBar, BorderLayout.NORTH);
0496:                mToolbarBoundry.add(mCurrentWindowToolBar, BorderLayout.NORTH);
0497:            }
0498:
0499:            // create main menu
0500:            private void createMainMenu() {
0501:                mMenuBar.add(mMenuFile);
0502:                mMenuBar.add(mMenuAction);
0503:                mMenuBar.add(mMenuView);
0504:                mMenuBar.add(mMenuModel);
0505:                mMenuBar.add(mMenuTools);
0506:                mMenuBar.add(mMenuWindow);
0507:                mMenuBar.add(mMenuHelp);
0508:
0509:                setJMenuBar(mMenuBar);
0510:            }
0511:
0512:            // create StatusBar
0513:            private void createStatusBar() {
0514:                mStatusBar.setFont(Application.DEFAULT_FONT);
0515:                mStatusBar.addPanel(Application.getVersion(), 60,
0516:                        javax.swing.text.StyleConstants.ALIGN_CENTER);
0517:                mStatusBar.addPanel("", 200);
0518:                mStatusBar.setVisible(Application.properties.mViewStatusBar);
0519:            }
0520:
0521:            // create tabpanel
0522:            private void createTabPanel() {
0523:                mTabPanel = new TabPanel(mMDI) {
0524:                    public void deleteTab(int pIndex) {
0525:                        checkContainerSaved((BaseChildPanel) getPanel(pIndex));
0526:                        super .deleteTab(pIndex);
0527:                    }
0528:                };
0529:
0530:                mTabPanel.setFont(Application.DEFAULT_FONT);
0531:                mTabPanel.setCloseRegime(TabPanel.CB_ONEFORALL);
0532:                mTabPanel
0533:                        .addTabPanelEventListener(new TabPanel.TabPanelListener() {
0534:                            public void tabChanged(TabPanelEvent event) {
0535:                                mCurrentWindowToolBar.removeAll();
0536:                                Container lPanel = mTabPanel.getCurrentPanel();
0537:                                if (lPanel instanceof  BaseChildPanel) {
0538:                                    BaseChildPanel lBaseChildPanel = (BaseChildPanel) lPanel;
0539:                                    Application.fillActions(
0540:                                            getViewActions(lBaseChildPanel),
0541:                                            mCurrentWindowToolBar, mMenuView,
0542:                                            null);
0543:                                    lBaseChildPanel.containerActivate();
0544:                                }
0545:                                checkActions();
0546:                            }
0547:                        });
0548:            }
0549:
0550:            // create design tree panel	
0551:            private void createDesignTreePanel() {
0552:                try {
0553:                    mTreePanel = new DesignTreePanel();
0554:                } catch (Throwable t) {
0555:                    t.printStackTrace();
0556:                }
0557:            }
0558:
0559:            // show right properties panel
0560:            private void showRightPropertiesPanel(BaseUserObject pUserObject) {
0561:                if (pUserObject != null) {
0562:                    try {
0563:                        mPropertiesPanel.editProperties(pUserObject);
0564:                    } catch (Exception e) {
0565:                        e.printStackTrace();
0566:                    }
0567:                }
0568:            }
0569:
0570:            // set splitters initial state
0571:            private void setSplittersInitialState() {
0572:                if (Application.properties.mDeviderLocation == 0)
0573:                    mSplitPane.setDividerLocation(0.3);
0574:                else
0575:                    mSplitPane
0576:                            .setDividerLocation(Application.properties.mDeviderLocation);
0577:                setRightSplitter();
0578:            }
0579:
0580:            private void setRightSplitter() {
0581:                if (mPropertiesPanel.isVisible()) {
0582:                    if (Application.properties.mRightDeviderLocation == 0)
0583:                        mRightSplitPane.setDividerLocation(0.8);
0584:                    else
0585:                        mRightSplitPane
0586:                                .setDividerLocation(Application.properties.mRightDeviderLocation);
0587:                    mRightSplitPane.setDividerSize(4);
0588:                } else
0589:                    mRightSplitPane.setDividerSize(0);
0590:            }
0591:
0592:            // Brings the next non-iconified internal frame to the front.
0593:            private void selectNextWindow() {
0594:                int lIndex = mTabPanel.getTabIndex();
0595:                lIndex++;
0596:                if (lIndex >= mTabPanel.getTabCount())
0597:                    lIndex = 0;
0598:                mTabPanel.setTabIndex(lIndex);
0599:            }
0600:
0601:            // Brings the prev non-iconified internal frame to the front.
0602:            private void selectPrevWindow() {
0603:                int lIndex = mTabPanel.getTabIndex();
0604:                lIndex--;
0605:                if (lIndex < 0)
0606:                    lIndex = mTabPanel.getTabCount() - 1;
0607:                mTabPanel.setTabIndex(lIndex);
0608:            }
0609:
0610:            // close all windows
0611:            private boolean closeAllWindows(boolean pRepaint) {
0612:                boolean lResult = true;
0613:                try {
0614:                    checkAllContainers();
0615:                    mTabPanel.clearAll();
0616:                    if (pRepaint)
0617:                        mMDI.repaint();
0618:                } catch (NoCloseException e) {
0619:                    lResult = false;
0620:                } catch (Exception e) {
0621:                    e.printStackTrace();
0622:                }
0623:                return lResult;
0624:            }
0625:
0626:            // close active window
0627:            private void closeActiveWindow() {
0628:                mTabPanel.closeActiveWindow();
0629:            }
0630:
0631:            // show options dialog
0632:            private void showOptionsDialog() throws Exception {
0633:                new OptionsDialog(this );
0634:            }
0635:
0636:            // show About dialog
0637:            private void showAboutDialog() throws Exception {
0638:                new AboutDialog(this );
0639:            }
0640:
0641:            // create file menu actions list
0642:            private Object[] getFileActions() {
0643:                ArrayList lList = new ArrayList();
0644:
0645:                lList.add(mNewEnterpriseModelAction);
0646:                lList.add(mOpenModelAction);
0647:                lList.add(mReopenAction);
0648:                mReopenAction.clearChildActions();
0649:                for (int i = 0; i < Application.properties.mReopenModels.size(); i++)
0650:                    mReopenAction.addChildAction(new ReopenModelAction(
0651:                            (String) Application.properties.mReopenModels
0652:                                    .get(i)));
0653:                lList.add(new SeparatorAction());
0654:                lList.add(mExportModelAsMetaBossXMIAction);
0655:                lList.add(mExportModelAsUMLXMIAction);
0656:                lList.add(mSaveModelAction);
0657:                lList.add(mSaveAllModelsAction);
0658:                lList.add(mCloseModelAction);
0659:                lList.add(mCloseAllModelsAction);
0660:                lList.add(new SeparatorAction());
0661:                lList.add(mPrintAction);
0662:                lList.add(mSearchAction);
0663:                lList.add(mRefreshAction);
0664:                lList.add(new SeparatorAction());
0665:                lList.add(mExitAction);
0666:
0667:                return lList.toArray();
0668:            }
0669:
0670:            // get Action menu Actions
0671:            public Object[] getActionActions(BaseUserObject pObject) {
0672:                ArrayList lList = getActionActionsAsList(pObject);
0673:                return (lList != null) ? lList.toArray() : null;
0674:            }
0675:
0676:            // get Action menu Actions
0677:            public ArrayList getActionActionsAsList(BaseUserObject pObject) {
0678:                ArrayList lList = new ArrayList();
0679:
0680:                if (pObject != null) {
0681:                    DesignTreeTabDescriptor lDescriptor = mTreePanel
0682:                            .getCurentTabDescriptor();
0683:                    if (lDescriptor != null) {
0684:                        if (lDescriptor.isSystem()) {
0685:                            ModelElement lModelElement = pObject.getBOObject();
0686:                            if (lModelElement instanceof  Namespace
0687:                                    || lModelElement instanceof  DataType
0688:                                    || lModelElement instanceof  TypeTemplate
0689:                                    || lModelElement instanceof  Message
0690:                                    || lModelElement instanceof  Structure
0691:                                    || lModelElement instanceof  StorageTechnology) {
0692:                                lList.add(new CopyModelElementAction(pObject));
0693:                                lList.add(new SeparatorAction());
0694:                            }
0695:                        } else if (lDescriptor.getRootUserObject()
0696:                                .getBOObject() instanceof  DesignLibrary) {
0697:                            ModelElement lModelElement = pObject.getBOObject();
0698:                            if (lModelElement instanceof  DataDictionary
0699:                                    && lModelElement.getName().equals("core") == false) {
0700:                                lList.add(new CopyModelElementAction(pObject));
0701:                                lList.add(new SeparatorAction());
0702:                            }
0703:                        } else if (lDescriptor.getRootUserObject()
0704:                                .getBOObject() instanceof  Enterprise) {
0705:                            ModelElement lModelElement = pObject.getBOObject();
0706:                            if (lModelElement instanceof  com.metaboss.sdlctools.models.metabossmodel.enterprisemodel.System) {
0707:                                lList.add(new CopyModelElementAction(pObject));
0708:                                lList.add(new SeparatorAction());
0709:                            }
0710:                        }
0711:                    }
0712:
0713:                    Object[] lActions = pObject.getActions();
0714:                    if (lActions != null)
0715:                        for (int i = 0; i < lActions.length; i++)
0716:                            lList.add(lActions[i]);
0717:                }
0718:
0719:                return lList;
0720:            }
0721:
0722:            // get Model menu actions list
0723:            private Object[] getModelActions() {
0724:                ArrayList lList = new ArrayList();
0725:
0726:                lList.add(mValidateModelAction);
0727:                lList.add(mValidateModelsAction);
0728:                lList.add(mRectifyModelAction);
0729:                lList.add(new SeparatorAction());
0730:                lList.add(mEditModelPropertiesAction);
0731:
0732:                return lList.toArray();
0733:            }
0734:
0735:            // create View menu actions
0736:            private Object[] getViewActions(BaseChildPanel pPanel) {
0737:                ArrayList lList = new ArrayList();
0738:
0739:                if (pPanel != null) {
0740:                    Object[] lActions = pPanel.getActions();
0741:                    if (lActions != null)
0742:                        for (int i = 0; i < lActions.length; i++)
0743:                            lList.add(lActions[i]);
0744:                }
0745:
0746:                lList.add(new SeparatorAction());
0747:                lList.add(mShowStatusBarAction);
0748:                lList.add(mShowPropertiesBarAction);
0749:                lList.add(mShowSystemLogAction);
0750:
0751:                return lList.toArray();
0752:            }
0753:
0754:            // create Window menu actions list
0755:            private Object[] getWindowActions() {
0756:                ArrayList lList = new ArrayList();
0757:
0758:                lList.add(mNextWindowAction);
0759:                lList.add(mPrevWindowAction);
0760:                lList.add(new SeparatorAction());
0761:                lList.add(mCloseActiveWindowAction);
0762:                lList.add(mCloseAllAction);
0763:
0764:                return lList.toArray();
0765:            }
0766:
0767:            // create Tools menu actions list
0768:            private Object[] getToolsActions() {
0769:                ArrayList lList = new ArrayList();
0770:
0771:                lList.add(mOptionsAction);
0772:
0773:                return lList.toArray();
0774:            }
0775:
0776:            // create Window menu actions list
0777:            private Object[] getHelpActions() {
0778:                ArrayList lList = new ArrayList();
0779:
0780:                lList.add(mAboutAction);
0781:
0782:                return lList.toArray();
0783:            }
0784:
0785:            // check Actions
0786:            private void checkActions() {
0787:                boolean lTabsThere = mTabPanel.getTabCount() > 0;
0788:                boolean lMoreThenOne = mTabPanel.getTabCount() > 1;
0789:                boolean lSelected = mTabPanel.getTabIndex() > -1;
0790:
0791:                mCloseActiveWindowAction.setEnabled(lTabsThere && lSelected);
0792:                mCloseAllAction.setEnabled(lTabsThere);
0793:                mNextWindowAction.setEnabled(lTabsThere && lSelected
0794:                        && lMoreThenOne);
0795:                mPrevWindowAction.setEnabled(lTabsThere && lSelected
0796:                        && lMoreThenOne);
0797:
0798:                DesignTreeTabDescriptor lDescriptor = mTreePanel
0799:                        .getCurentTabDescriptor();
0800:                ModelUserObject lPackage = getCurrentPackage();
0801:                boolean lEnabled = lPackage != null && lDescriptor != null;
0802:
0803:                mNewEnterpriseModelAction.setEnabled(true);
0804:                mOpenModelAction.setEnabled(true);
0805:                mReopenAction.setEnabled(Application.properties.mReopenModels
0806:                        .size() > 0);
0807:                mSaveModelAction
0808:                        .setEnabled(lEnabled
0809:                                && (lDescriptor.isModified() || findUnsavedContainer(lPackage)));
0810:                mSaveAllModelsAction.setEnabled(Application
0811:                        .getModifiedModelsCount() > 0);
0812:                mCloseModelAction.setEnabled(lEnabled
0813:                        && !lDescriptor.isSystem());
0814:                mEditModelPropertiesAction.setEnabled(lEnabled
0815:                        && !lDescriptor.isSystem());
0816:                mExportModelAsMetaBossXMIAction.setEnabled(lEnabled);
0817:                mExportModelAsUMLXMIAction.setEnabled(lEnabled);
0818:                mCloseAllModelsAction
0819:                        .setEnabled(Application.getModelsCount() > 1);
0820:                mValidateModelAction.setEnabled(lEnabled);
0821:                mRectifyModelAction.setEnabled(lEnabled);
0822:            }
0823:
0824:            // check container saved
0825:            private void checkContainerSaved(BaseChildPanel pPanel) {
0826:                if (pPanel == null)
0827:                    return;
0828:                if (pPanel.getChanged())
0829:                    pPanel.saveContent();
0830:            }
0831:
0832:            // check and save all containers content
0833:            private void checkAllContainers() throws Exception {
0834:                for (int i = 0; i < mTabPanel.getTabCount(); i++) {
0835:                    BaseChildPanel lPanel = (BaseChildPanel) mTabPanel
0836:                            .getPanel(i);
0837:                    if (lPanel != null && lPanel.getChanged())
0838:                        lPanel.saveContent();
0839:                }
0840:            }
0841:
0842:            // find unsaved container
0843:            private boolean findUnsavedContainer(ModelUserObject pPackage) {
0844:                if (pPackage != null) {
0845:                    for (int i = 0; i < mTabPanel.getTabCount(); i++) {
0846:                        BaseChildPanel lPanel = (BaseChildPanel) mTabPanel
0847:                                .getPanel(i);
0848:                        if (lPanel != null
0849:                                && lPanel.getChanged()
0850:                                && lPanel.getPackage() != null
0851:                                && lPanel.getPackage().equals(
0852:                                        pPackage.getPackage()))
0853:                            return true;
0854:                    }
0855:                }
0856:                return false;
0857:            }
0858:
0859:            //create new model
0860:            private void createNewModel() {
0861:                Application.createModel();
0862:            }
0863:
0864:            // open model
0865:            private void openModel() {
0866:                Application.openModel();
0867:            }
0868:
0869:            // reopen model
0870:            private void reOpenModel(String pFileName) {
0871:                try {
0872:                    Application.openModel(pFileName);
0873:                } catch (Exception e) {
0874:                    Application.processError(e);
0875:                }
0876:            }
0877:
0878:            // close current model
0879:            private void closeCurrentModel() {
0880:                try {
0881:                    checkAllContainers();
0882:                    Application.closeModel(Application.getCurrentPackage(),
0883:                            false, true);
0884:                } catch (Exception e) {
0885:                    Application.processError(e);
0886:                }
0887:            }
0888:
0889:            // close all models
0890:            private void closeAllModels() {
0891:                try {
0892:                    checkAllContainers();
0893:                    Application.closeAllModels();
0894:                } catch (Exception e) {
0895:                    Application.processError(e);
0896:                }
0897:            }
0898:
0899:            // save current model
0900:            private void saveModel() {
0901:                try {
0902:                    checkAllContainers();
0903:
0904:                    DesignTreeTabDescriptor lDescriptor = mTreePanel
0905:                            .getCurentTabDescriptor();
0906:                    if (lDescriptor != null) {
0907:                        Object[] lPackages = lDescriptor.getPackages();
0908:                        for (int i = 0; i < lPackages.length; i++)
0909:                            Application
0910:                                    .saveOneModel((ModelUserObject) lPackages[i]);
0911:                    }
0912:                } catch (Exception e) {
0913:                    Application.processError(e);
0914:                }
0915:                checkActions();
0916:            }
0917:
0918:            // save all models
0919:            private void saveAllModels() {
0920:                try {
0921:                    checkAllContainers();
0922:                    Application.saveModels(false, false);
0923:                } catch (Exception e) {
0924:                    Application.processError(e);
0925:                }
0926:                checkActions();
0927:            }
0928:
0929:            // Validate current model
0930:            private void validateCurrentModel() {
0931:                DesignTreeTabDescriptor lDescriptor = mTreePanel
0932:                        .getCurentTabDescriptor();
0933:                if (lDescriptor != null) {
0934:                    Object[] lPackages = lDescriptor.getPackages();
0935:                    for (int i = 0; i < lPackages.length; i++)
0936:                        Application
0937:                                .validateModel((ModelUserObject) lPackages[i]);
0938:                }
0939:            }
0940:
0941:            // Rectify curent model
0942:            private void rectifyCurrentModel() {
0943:                DesignTreeTabDescriptor lDescriptor = mTreePanel
0944:                        .getCurentTabDescriptor();
0945:                if (lDescriptor != null) {
0946:                    Object[] lPackages = lDescriptor.getPackages();
0947:                    for (int i = 0; i < lPackages.length; i++)
0948:                        Application
0949:                                .rectifyModel((ModelUserObject) lPackages[i]);
0950:                }
0951:            }
0952:
0953:            // Export 
0954:            private void exportCurrentModelAsMetaBossXMI() {
0955:                try {
0956:                    DesignTreeTabDescriptor lDescriptor = mTreePanel
0957:                            .getCurentTabDescriptor();
0958:                    if (lDescriptor != null) {
0959:                        Object[] lPackages = lDescriptor.getPackages();
0960:                        for (int i = 0; i < lPackages.length; i++)
0961:                            Application.exportModel(
0962:                                    (ModelUserObject) lPackages[i], false);
0963:                    }
0964:                } catch (Exception e) {
0965:                    Application.processError(e);
0966:                }
0967:            }
0968:
0969:            // Export 
0970:            private void exportCurrentModelAsUMLXMI() {
0971:                try {
0972:                    DesignTreeTabDescriptor lDescriptor = mTreePanel
0973:                            .getCurentTabDescriptor();
0974:                    if (lDescriptor != null) {
0975:                        Object[] lPackages = lDescriptor.getPackages();
0976:                        for (int i = 0; i < lPackages.length; i++)
0977:                            Application.exportModel(
0978:                                    (ModelUserObject) lPackages[i], true);
0979:                    }
0980:                } catch (Exception e) {
0981:                    Application.processError(e);
0982:                }
0983:            }
0984:
0985:            // edit current model properties
0986:            private void editCurrentModelProperties() {
0987:                DesignTreeTabDescriptor lDescriptor = mTreePanel
0988:                        .getCurentTabDescriptor();
0989:                if (lDescriptor != null)
0990:                    lDescriptor.editProperties();
0991:            }
0992:
0993:            // copy current model element
0994:            private void copyModelElement(BaseUserObject pObject) {
0995:                Application.copyModelElement(pObject, getCurrentPackage());
0996:            }
0997:
0998:            // fire refresh event
0999:            private void fireRefresh() {
1000:                try {
1001:                    checkAllContainers();
1002:                } catch (Exception e) {
1003:                    e.printStackTrace();
1004:                }
1005:                Application.fireRefresh();
1006:            }
1007:
1008:            /*		Auxilary classes		*/
1009:
1010:            /*		MDI Panel class			*/
1011:
1012:            public class MDIPanel extends JPanel {
1013:                protected void paintComponent(Graphics g) {
1014:                    super .paintComponent(g);
1015:
1016:                    Dimension lSize = getSize();
1017:                    int lx = lSize.width
1018:                            - Application.METABOSS_LOGO.getIconWidth() - 10;
1019:                    int ly = lSize.height
1020:                            - Application.METABOSS_LOGO.getIconHeight() - 10;
1021:                    Application.METABOSS_LOGO.paintIcon(this , g, lx, ly);
1022:                }
1023:            }
1024:
1025:            /*		Actions		*/
1026:
1027:            /*		New Enterprise Model Action			*/
1028:
1029:            public class NewEnterpriseModelAction extends BaseAction {
1030:                public NewEnterpriseModelAction() {
1031:                    super ("New Enterprise Model", Application.NEWMODEL_ICON);
1032:                }
1033:
1034:                public void actionPerformed(ActionEvent arg0) {
1035:                    createNewModel();
1036:                }
1037:            }
1038:
1039:            /*		Open Model Action			*/
1040:
1041:            public class OpenModelAction extends BaseAction {
1042:                public OpenModelAction() {
1043:                    super ("Open Model", Application.OPEN_ICON);
1044:                }
1045:
1046:                public void actionPerformed(ActionEvent arg0) {
1047:                    openModel();
1048:                }
1049:            }
1050:
1051:            /*		Save Model Action			*/
1052:
1053:            public class SaveModelAction extends BaseAction {
1054:                public SaveModelAction() {
1055:                    super ("Save Model", Application.SAVE_ICON);
1056:                }
1057:
1058:                public void actionPerformed(ActionEvent arg0) {
1059:                    saveModel();
1060:                }
1061:            }
1062:
1063:            /*		Save All Models	Action			*/
1064:
1065:            public class SaveAllModelsAction extends BaseAction {
1066:                public SaveAllModelsAction() {
1067:                    super ("Save All Models", null);
1068:                }
1069:
1070:                public void actionPerformed(ActionEvent arg0) {
1071:                    saveAllModels();
1072:                }
1073:            }
1074:
1075:            /*		Close Model Action			*/
1076:
1077:            public class CloseModelAction extends BaseAction {
1078:                public CloseModelAction() {
1079:                    super ("Close Model", null);
1080:                }
1081:
1082:                public void actionPerformed(ActionEvent arg0) {
1083:                    closeCurrentModel();
1084:                }
1085:            }
1086:
1087:            /*		Close All Models	*/
1088:
1089:            public class CloseAllModelsAction extends BaseAction {
1090:                public CloseAllModelsAction() {
1091:                    super ("Close All Models", null);
1092:                }
1093:
1094:                public void actionPerformed(ActionEvent arg0) {
1095:                    closeAllModels();
1096:                }
1097:            }
1098:
1099:            /*		Validate Models Action				*/
1100:
1101:            public class ValidateModelsAction extends BaseAction {
1102:                public ValidateModelsAction() {
1103:                    super ("Validate All Models", null);
1104:                }
1105:
1106:                public void actionPerformed(ActionEvent e) {
1107:                    Application.validateModels(false, false);
1108:                }
1109:            }
1110:
1111:            /*		Validate Model Action		*/
1112:
1113:            public class ValidateModelAction extends BaseAction {
1114:                public ValidateModelAction() {
1115:                    super ("Validate Model", Application.VALIDATE_ICON);
1116:                }
1117:
1118:                public void actionPerformed(ActionEvent e) {
1119:                    validateCurrentModel();
1120:                }
1121:            }
1122:
1123:            /*		Rectify Model Action		*/
1124:
1125:            public class RectifyModelAction extends BaseAction {
1126:                public RectifyModelAction() {
1127:                    super ("Rectify Model", "Attempt To Rectify Model",
1128:                            Application.RECTIFY_ICON);
1129:                }
1130:
1131:                public void actionPerformed(ActionEvent e) {
1132:                    rectifyCurrentModel();
1133:                }
1134:            }
1135:
1136:            /*	Export Model As MetaBoss XMI Action	*/
1137:
1138:            public class ExportModelAsMetaBossXMIAction extends BaseAction {
1139:                public ExportModelAsMetaBossXMIAction() {
1140:                    super ("Export Model As MetaBoss XMI",
1141:                            Application.EXPORTMBXMI_ICON);
1142:                }
1143:
1144:                public void actionPerformed(ActionEvent e) {
1145:                    exportCurrentModelAsMetaBossXMI();
1146:                }
1147:            }
1148:
1149:            /*	Export Model As UML XMI Action	*/
1150:
1151:            public class ExportModelAsUMLXMIAction extends BaseAction {
1152:                public ExportModelAsUMLXMIAction() {
1153:                    super ("Export Model As UML XMI", Application.EXPORTXMI_ICON);
1154:                }
1155:
1156:                public void actionPerformed(ActionEvent e) {
1157:                    exportCurrentModelAsUMLXMI();
1158:                }
1159:            }
1160:
1161:            /*		Edit Model Properties Action		*/
1162:
1163:            public class EditModelPropertiesAction extends BaseAction {
1164:                public EditModelPropertiesAction() {
1165:                    super (Application.getString("editproperties_action"),
1166:                            Application.EDIT_ICON);
1167:                    mAddToToolBar = false;
1168:                }
1169:
1170:                public void actionPerformed(ActionEvent e) {
1171:                    editCurrentModelProperties();
1172:                }
1173:            }
1174:
1175:            /*		Reopen Model Action		*/
1176:
1177:            public class ReopenModelAction extends BaseAction {
1178:                private String mFileName = null;
1179:
1180:                public ReopenModelAction(String pFileName) {
1181:                    super (pFileName, null);
1182:                    mFileName = pFileName;
1183:                }
1184:
1185:                public void actionPerformed(ActionEvent e) {
1186:                    int n = JOptionPane.showConfirmDialog(null, "Open model \""
1187:                            + mFileName + "\" ?", "Confirm",
1188:                            JOptionPane.YES_NO_OPTION);
1189:                    if (n == 0)
1190:                        reOpenModel(mFileName);
1191:                }
1192:            }
1193:
1194:            /*		Copy Model Element Action		*/
1195:
1196:            public class CopyModelElementAction extends BaseAction {
1197:                private BaseUserObject mObject = null;
1198:
1199:                public CopyModelElementAction(BaseUserObject pObject) {
1200:                    super ("Copy Model Element", Application.COPYELEMENT_ICON);
1201:                    mObject = pObject;
1202:                }
1203:
1204:                public void actionPerformed(ActionEvent e) {
1205:                    copyModelElement(mObject);
1206:                }
1207:            }
1208:
1209:            /*		Exit Action			*/
1210:
1211:            public class ExitAction extends BaseAction {
1212:                public ExitAction() {
1213:                    super ("Exit", null);
1214:                }
1215:
1216:                public void actionPerformed(ActionEvent e) {
1217:                    setVisible(false);
1218:                    if (!isVisible())
1219:                        Application.exit();
1220:                }
1221:            }
1222:
1223:            /*		Search model element Action			*/
1224:
1225:            public class SearchAction extends BaseAction {
1226:                public SearchAction() {
1227:                    super ("Search", Application.SEARCH_ICON);
1228:                }
1229:
1230:                public void actionPerformed(ActionEvent e) {
1231:                    //setSplittersInitialState(); //???
1232:                    mToolbarBoundry.repaint();
1233:                }
1234:            }
1235:
1236:            /*		Refresh Model Tree Action			*/
1237:
1238:            public class RefreshAction extends BaseAction {
1239:                public RefreshAction() {
1240:                    super ("Refresh", Application.REFRESH_ICON);
1241:                }
1242:
1243:                public void actionPerformed(ActionEvent e) {
1244:                    fireRefresh();
1245:                }
1246:            }
1247:
1248:            /*		Print Action			*/
1249:
1250:            public class PrintAction extends BaseAction {
1251:                public PrintAction() {
1252:                    super ("Print", Application.PRINT_ICON);
1253:                }
1254:
1255:                public void actionPerformed(ActionEvent arg0) {
1256:                    //???
1257:                }
1258:            }
1259:
1260:            /*		Development Studio Options Action			*/
1261:
1262:            public class OptionsAction extends BaseAction {
1263:                public OptionsAction() {
1264:                    super ("Options", Application.OPTIONS_ICON);
1265:                }
1266:
1267:                public void actionPerformed(ActionEvent e) {
1268:                    try {
1269:                        showOptionsDialog();
1270:                    } catch (Throwable t) {
1271:                        t.printStackTrace();
1272:                    }
1273:                }
1274:            }
1275:
1276:            /*		Close Active Window Action 		*/
1277:
1278:            public class CloseActiveWindowAction extends BaseAction {
1279:                public CloseActiveWindowAction() {
1280:                    super ("Close Window", null);
1281:                }
1282:
1283:                public void actionPerformed(ActionEvent e) {
1284:                    closeActiveWindow();
1285:                }
1286:            }
1287:
1288:            /*		Next Window Action 		*/
1289:
1290:            public class NextWindowAction extends BaseAction {
1291:                public NextWindowAction() {
1292:                    super ("Next Window", null);
1293:                }
1294:
1295:                public void actionPerformed(ActionEvent e) {
1296:                    selectNextWindow();
1297:                }
1298:            }
1299:
1300:            /*		Prev Window Action 		*/
1301:
1302:            public class PrevWindowAction extends BaseAction {
1303:                public PrevWindowAction() {
1304:                    super ("Previous Window", null);
1305:                }
1306:
1307:                public void actionPerformed(ActionEvent e) {
1308:                    selectPrevWindow();
1309:                }
1310:            }
1311:
1312:            /*		Close All Action 		*/
1313:
1314:            public class CloseAllAction extends BaseAction {
1315:                public CloseAllAction() {
1316:                    super ("Ñlose All", null);
1317:                }
1318:
1319:                public void actionPerformed(ActionEvent e) {
1320:                    try {
1321:                        closeAllWindows(true);
1322:                    } catch (Exception ex) {
1323:                        ex.printStackTrace();
1324:                    }
1325:                }
1326:            }
1327:
1328:            /*		About Action 		*/
1329:
1330:            public class AboutAction extends BaseAction {
1331:                public AboutAction() {
1332:                    super ("About", null);
1333:                }
1334:
1335:                public void actionPerformed(ActionEvent e) {
1336:                    try {
1337:                        showAboutDialog();
1338:                    } catch (Throwable t) {
1339:                        t.printStackTrace();
1340:                    }
1341:                }
1342:            }
1343:
1344:            /*		Show status bar Action		*/
1345:
1346:            public class ShowStatusBarAction extends BaseAction {
1347:                public ShowStatusBarAction() {
1348:                    super ("Status Bar", null);
1349:                    mIsCheck = true;
1350:                    mIsChecked = Application.properties.mViewStatusBar;
1351:                }
1352:
1353:                public void actionPerformed(ActionEvent arg0) {
1354:                    super .actionPerformed(arg0);
1355:                    mStatusBar.setVisible(isChecked());
1356:                }
1357:            }
1358:
1359:            /*		Show Properties Panel Action		*/
1360:
1361:            public class ShowPropertiesBarAction extends BaseAction {
1362:                public ShowPropertiesBarAction() {
1363:                    super ("Properties Bar", null);
1364:                    mIsCheck = true;
1365:                    mIsChecked = Application.properties.mViewPropertiesBar;
1366:                }
1367:
1368:                public void actionPerformed(ActionEvent arg0) {
1369:                    super .actionPerformed(arg0);
1370:                    Application.properties.mViewPropertiesBar = isChecked();
1371:                    mPropertiesPanel.checkTabs();
1372:                    //mPropertiesPanel.setVisible(isChecked());
1373:                    //setRightSplitter();
1374:                }
1375:            }
1376:
1377:            /*    Show System Log Action     */
1378:
1379:            public class ShowSystemLogAction extends BaseAction {
1380:                public ShowSystemLogAction() {
1381:                    super ("System Log", null);
1382:                    mIsCheck = true;
1383:                    mIsChecked = Application.properties.mViewSystemLog;
1384:                }
1385:
1386:                public void actionPerformed(ActionEvent arg0) {
1387:                    super.actionPerformed(arg0);
1388:                    Application.properties.mViewSystemLog = isChecked();
1389:                    mPropertiesPanel.checkTabs();
1390:                }
1391:            }
1392:
1393:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.