Search in sources :

Example 1 with SectorColorAttributePlugin

use of com.ramussoft.idef0.attribute.SectorColorAttributePlugin in project ramus by Vitaliy-Yakovchuk.

the class IDEF0ViewPlugin method setFramework.

@Override
public void setFramework(final GUIFramework framework) {
    super.setFramework(framework);
    this.engine = framework.getEngine();
    this.rules = framework.getAccessRules();
    this.frame.setEngine(framework);
    addOpenDiagramListener();
    addOpenStreamsViewListener();
    framework.addCloseMainFrameListener(new CloseMainFrameAdapter() {

        @Override
        public void closed() {
            Options.save();
            if (navigator != null)
                navigator.dispose();
            if (engine.getPluginProperty("Core", "MainFrame") == framework.getMainFrame()) {
                NDataPlugin dataPlugin = (NDataPlugin) engine.getPluginProperty("IDEF0", "DataPlugin");
                if (dataPlugin != null) {
                    dataPlugin.clear();
                    dataPlugin.clearAll();
                }
            }
            if (server != null) {
                try {
                    server.getServer().close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                server.interrupt();
            }
        }
    });
    framework.addActionListener("FileOpened", new ActionListener() {

        @Override
        public void onAction(ActionEvent event) {
            if (event.getValue() == null) {
                SwingUtilities.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        NewProjectDialog dialog = new NewProjectDialog(framework.getMainFrame());
                        dialog.showModal(engine, rules, framework);
                    }
                });
            }
        }
    });
    framework.addActionListener(Commands.FULL_REFRESH, new ActionListener() {

        @Override
        public void onAction(ActionEvent event) {
            if (NDataPluginFactory.getExistingDataPlugin(engine) != null)
                NDataPluginFactory.fullRefrash(framework);
        }
    });
    framework.setSystemAttributeName(IDEF0Plugin.getBackgroundColorAttribute(engine), ResourceLoader.getString("bk_color"));
    framework.setSystemAttributeName(IDEF0Plugin.getForegroundColorAttribute(engine), ResourceLoader.getString("fg_color"));
    framework.setSystemAttributeName(IDEF0Plugin.getFontAttribute(engine), ResourceLoader.getString("font"));
    framework.setSystemAttributeName(IDEF0Plugin.getFunctionTypeAttribute(engine), ResourceLoader.getString("function_type"));
    framework.setSystemAttributeName(IDEF0Plugin.getFunctionOunerAttribute(engine), ResourceLoader.getString("select_owner"));
    StreamAttributePlugin plugin = new StreamAttributePlugin();
    plugin.setFramework(framework);
    framework.setSystemAttributePlugin(IDEF0Plugin.getStreamAttribute(engine), plugin);
    framework.setSystemAttributeName(IDEF0Plugin.getStreamAttribute(engine), ResourceLoader.getString("stream"));
    framework.setSystemAttributePlugin(IDEF0Plugin.getSectorBorderEndAttribute(engine), new SectorFontAttributePlugin());
    framework.setSystemAttributeName(IDEF0Plugin.getSectorBorderEndAttribute(engine), ResourceLoader.getString("font"));
    framework.setSystemAttributePlugin(IDEF0Plugin.getSectorBorderStartAttribute(engine), new SectorColorAttributePlugin());
    framework.setSystemAttributeName(IDEF0Plugin.getSectorBorderStartAttribute(engine), ResourceLoader.getString("color"));
    framework.setSystemAttributePlugin(IDEF0Plugin.getSectorFunctionAttribute(engine), new LineStyleAttributePlugin());
    framework.setSystemAttributeName(IDEF0Plugin.getSectorFunctionAttribute(engine), ResourceLoader.getString("arrow"));
}
Also used : NewProjectDialog(com.ramussoft.pb.master.NewProjectDialog) SectorFontAttributePlugin(com.ramussoft.idef0.attribute.SectorFontAttributePlugin) StreamAttributePlugin(com.ramussoft.idef0.attribute.StreamAttributePlugin) CloseMainFrameAdapter(com.ramussoft.gui.common.event.CloseMainFrameAdapter) NDataPlugin(com.ramussoft.pb.data.negine.NDataPlugin) ActionListener(com.ramussoft.gui.common.event.ActionListener) ActionEvent(com.ramussoft.gui.common.event.ActionEvent) IOException(java.io.IOException) SectorColorAttributePlugin(com.ramussoft.idef0.attribute.SectorColorAttributePlugin) LineStyleAttributePlugin(com.ramussoft.idef0.attribute.LineStyleAttributePlugin)

Aggregations

ActionEvent (com.ramussoft.gui.common.event.ActionEvent)1 ActionListener (com.ramussoft.gui.common.event.ActionListener)1 CloseMainFrameAdapter (com.ramussoft.gui.common.event.CloseMainFrameAdapter)1 LineStyleAttributePlugin (com.ramussoft.idef0.attribute.LineStyleAttributePlugin)1 SectorColorAttributePlugin (com.ramussoft.idef0.attribute.SectorColorAttributePlugin)1 SectorFontAttributePlugin (com.ramussoft.idef0.attribute.SectorFontAttributePlugin)1 StreamAttributePlugin (com.ramussoft.idef0.attribute.StreamAttributePlugin)1 NDataPlugin (com.ramussoft.pb.data.negine.NDataPlugin)1 NewProjectDialog (com.ramussoft.pb.master.NewProjectDialog)1 IOException (java.io.IOException)1