1 package cz
.cvut
.promod
.epc
;
3 import com
.jidesoft
.dialog
.AbstractDialogPage
;
4 import com
.jidesoft
.status
.LabelStatusBarItem
;
5 import com
.jidesoft
.swing
.JideBoxLayout
;
6 import cz
.cvut
.promod
.epc
.ioController
.EPCNotationIOController
;
7 import cz
.cvut
.promod
.epc
.modelFactory
.EPCNotationModelFactory
;
8 import cz
.cvut
.promod
.epc
.resources
.Resources
;
9 import cz
.cvut
.promod
.epc
.settings
.EPCSettings
;
10 import cz
.cvut
.promod
.gui
.Modeler
;
11 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.DockableFrameData
;
12 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.NotationWorkspaceData
;
13 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.factory
.DiagramModelFactory
;
14 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.localIOController
.NotationLocalIOController
;
15 import cz
.cvut
.promod
.services
.ModelerSession
;
16 import cz
.cvut
.promod
.services
.menuService
.MenuService
;
17 import cz
.cvut
.promod
.services
.menuService
.utils
.InsertMenuItemResult
;
18 import cz
.cvut
.promod
.services
.menuService
.utils
.MenuItemPosition
;
19 import org
.apache
.log4j
.Logger
;
20 import cz
.cvut
.promod
.services
.actionService
.actionUtils
.ProModAction
;
24 import java
.io
.FileReader
;
25 import java
.io
.IOException
;
26 import java
.util
.List
;
27 import java
.util
.Properties
;
31 * ProMod, master thesis project
32 * User: Petr Zverina, petr.zverina@gmail.com
33 * Date: 19:41:58, 5.12.2009
35 * Implementation of EPC modeling notation.
37 public class EPCNotation
implements cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.Notation
{
39 private static final Logger LOG
= Logger
.getLogger(EPCNotation
.class);
41 public static final String EPC_LABEL
= Resources
.getResources().getString("epc.menu.epc");
43 private final LabelStatusBarItem selectedToolStatusBarItem
;
45 private final EPCNotationModel model
;
47 private final EPCNotationModelFactory modelFactory
;
49 private final EPCNotationIOController ioController
;
51 private final String NOTATION_DESCRIPTION
=
52 Resources
.getResources().getString("epc.description");
53 private final String NOTATION_TOOL_TIP
=
54 Resources
.getResources().getString("epc.tool.tip");
57 public EPCNotation(final File propertiesFile
) throws InstantiationException
{
58 final Properties properties
= new Properties();
60 properties
.load(new FileReader(propertiesFile
));
61 } catch (IOException e
) {
62 LOG
.error("Properties for the EPC Notations couldn't be read.", e
);
63 throw new InstantiationException("Mandatory properties couldn't be read.");
66 final EPCSettings settings
= new EPCSettings(properties
);
67 EPCSettings
.setInstance(settings
);
69 selectedToolStatusBarItem
= new LabelStatusBarItem();
71 model
= new EPCNotationModel(properties
, selectedToolStatusBarItem
);
73 modelFactory
= new EPCNotationModelFactory();
75 ioController
= new EPCNotationIOController(model
.getExtension(), getIdentifier());
79 public String
getName() {
80 return model
.getName();
84 public String
getDescription() {
85 return model
.getDescription();
89 public Set
<DockableFrameData
> getDockableFrames() {
90 return model
.getDockableFrames();
94 public String
getFullName() {
95 return model
.getFullName();
99 public String
getAbbreviation() {
100 return model
.getAbbreviation();
104 public Icon
getNotationIcon() {
105 return Resources
.getIcon(Resources
.ICONS
+ Resources
.DIAGRAM
);
109 public String
getNotationToolTip() {
110 return NOTATION_TOOL_TIP
;
114 public NotationWorkspaceData
getNotationWorkspaceData() {
115 return model
.getWorkspace();
119 public ImageIcon
getNotationPreviewImage() {
120 return Resources
.getIcon(Resources
.ICONS
+ Resources
.PREVIEW
);
124 public String
getNotationPreviewText() {
125 return NOTATION_DESCRIPTION
;
129 public DiagramModelFactory
getDiagramModelFactory() {
134 public NotationLocalIOController
getLocalIOController() {
139 public String
getIdentifier() {
140 return model
.getIdentifier();
143 public InsertMenuItemResult
addPopupMenuItem(final ProModAction proModAction
, final MenuItemPosition menuItemPosition
,final MenuService
.MenuSeparator menuSeparator
, final boolean checkable
){
144 return model
.addPopupMenuAction(proModAction
, menuItemPosition
, menuSeparator
, checkable
);
159 * Initialize epc notation specific status bar items.
161 private void initStatusBar() {
162 ModelerSession
.getStatusBarService().addStatusBarItem(
163 getIdentifier(), selectedToolStatusBarItem
, JideBoxLayout
.FIX
167 private void initToolBar() {
168 ModelerSession
.getToolBarService().addAction(
170 model
.getAction(EPCNotationModel
.UNDO_ACTION_KEY
)
173 ModelerSession
.getToolBarService().addAction(
175 model
.getAction(EPCNotationModel
.REDO_ACTION_KEY
)
178 ModelerSession
.getToolBarService().addAction(
180 model
.getAction(EPCNotationModel
.SAVE_ACTION_KEY
)
183 ModelerSession
.getToolBarService().addAction(
185 model
.getAction(EPCNotationModel
.SAVE_ALL_ACTION_KEY
)
190 public void finish() { }
192 private void initActions() {
193 ModelerSession
.getActionService().registerAction(
195 model
.getActionIdentifier(EPCNotationModel
.REFRESH_ACTION_KEY
),
196 model
.getAction(EPCNotationModel
.REFRESH_ACTION_KEY
)
199 ModelerSession
.getActionService().registerAction(
201 model
.getActionIdentifier(EPCNotationModel
.DELETE_ACTION_KEY
),
202 model
.getAction(EPCNotationModel
.DELETE_ACTION_KEY
)
205 ModelerSession
.getActionService().registerAction(
207 model
.getActionIdentifier(EPCNotationModel
.UNDO_ACTION_KEY
),
208 model
.getAction(EPCNotationModel
.UNDO_ACTION_KEY
)
211 ModelerSession
.getActionService().registerAction(
213 model
.getActionIdentifier(EPCNotationModel
.REDO_ACTION_KEY
),
214 model
.getAction(EPCNotationModel
.REDO_ACTION_KEY
)
217 ModelerSession
.getActionService().registerAction(
219 model
.getActionIdentifier(EPCNotationModel
.SAVE_ACTION_KEY
),
220 model
.getAction(EPCNotationModel
.SAVE_ACTION_KEY
)
223 ModelerSession
.getActionService().registerAction(
225 model
.getActionIdentifier(EPCNotationModel
.SAVE_ALL_ACTION_KEY
),
226 model
.getAction(EPCNotationModel
.SAVE_ALL_ACTION_KEY
)
230 private void initMainMenu() {
231 ModelerSession
.getMenuService().insertMainMenuItem(
232 model
.getAction(EPCNotationModel
.SAVE_ACTION_KEY
),
233 new MenuItemPosition(Modeler
.FILE_LABEL
, MenuItemPosition
.PlacementStyle
.FIRST
)
237 ModelerSession
.getMenuService().insertMainMenuItem(
238 model
.getAction(EPCNotationModel
.REFRESH_ACTION_KEY
),
239 new MenuItemPosition(EPC_LABEL
)
244 public List
<AbstractDialogPage
> getSettingPages() {
245 return EPCSettings
.getInstance().getSettingPages();