1 package cz
.cvut
.promod
.hierarchyNotation
;
3 import com
.jgoodies
.binding
.PresentationModel
;
4 import com
.jgoodies
.binding
.value
.ValueModel
;
5 import com
.jidesoft
.status
.LabelStatusBarItem
;
6 import com
.jidesoft
.swing
.JideBoxLayout
;
7 import cz
.cvut
.promod
.gui
.Modeler
;
8 import cz
.cvut
.promod
.gui
.settings
.SettingPageData
;
9 import cz
.cvut
.promod
.hierarchyNotation
.ioController
.ProcessHierarchyIOController
;
10 import cz
.cvut
.promod
.hierarchyNotation
.modelFactory
.ProcessHierarchyModelFactory
;
11 import cz
.cvut
.promod
.hierarchyNotation
.resources
.Resources
;
12 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.DockableFrameData
;
13 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.NotationWorkspaceData
;
14 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.factory
.DiagramModelFactory
;
15 import cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.localIOController
.NotationLocalIOController
;
16 import cz
.cvut
.promod
.services
.ModelerSession
;
17 import cz
.cvut
.promod
.services
.actionService
.actionUtils
.ProModAction
;
18 import cz
.cvut
.promod
.services
.menuService
.MenuService
;
19 import cz
.cvut
.promod
.services
.menuService
.utils
.InsertMenuItemResult
;
20 import cz
.cvut
.promod
.services
.menuService
.utils
.MenuItemPosition
;
23 import java
.util
.List
;
27 * ProMod, master thesis project
28 * User: Petr Zverina, petr.zverina@gmail.com
29 * Date: 23:30:50, 25.11.2009
31 * Implementation of a ProcessHierarchyNotation plugin.
33 public class ProcessHierarchyNotation
implements cz
.cvut
.promod
.plugin
.notationSpecificPlugIn
.notation
.Notation
{
35 private final ProcessHierarchyNotationModel model
;
37 private final ProcessHierarchyModelFactory modelFactory
;
39 private final ProcessHierarchyIOController ioController
;
41 private final ValueModel checkTreeStructureModel
;
43 private static final Icon ICON
= Resources
.getIcon(Resources
.ICONS
+ Resources
.DIAGRAM
);
45 private final LabelStatusBarItem statusBarItem
= ModelerSession
.getComponentFactoryService().createLabelStatusBarItem();
48 * Parameter-less constructor.
50 public ProcessHierarchyNotation(){
51 model
= new ProcessHierarchyNotationModel(statusBarItem
);
53 final PresentationModel
<ProcessHierarchyNotationModel
> presentation
=
54 new PresentationModel
<ProcessHierarchyNotationModel
>(model
);
56 checkTreeStructureModel
= presentation
.getModel(ProcessHierarchyNotationModel
.CHECK_TREE_STRUCTURE_PROPERTY
);
58 checkTreeStructureModel
.setValue(true); // initialize is this check turned on
60 modelFactory
= new ProcessHierarchyModelFactory();
62 ioController
= new ProcessHierarchyIOController(model
.getExtension(), getIdentifier());
68 public String
getName() {
69 return model
.getName();
73 public String
getDescription() {
74 return model
.getDescription();
78 private void initComponents() {
79 statusBarItem
.setHorizontalAlignment(JLabel
.RIGHT
);
83 public Set
<DockableFrameData
> getDockableFrames() {
84 return model
.getDockableFrames();
88 public String
getFullName() {
89 return model
.getFullName();
93 public String
getAbbreviation() {
94 return model
.getAbbreviation();
98 public Icon
getNotationIcon() {
103 public String
getNotationToolTip() {
104 return "Process Hierarchy.";
108 public NotationWorkspaceData
getNotationWorkspaceData() {
109 return model
.getWorkspace();
113 public ImageIcon
getNotationPreviewImage() {
114 return Resources
.getIcon(Resources
.ICONS
+ Resources
.PREVIEW
);
118 public String
getNotationPreviewText() {
119 return "Process Hierarchy Notation is supposed to be used for a process or organization hierarchy modeling. It is not a standard kind of flow-chart. Use the processes and build the hierarchical structure.";
123 public DiagramModelFactory
getDiagramModelFactory() {
128 public NotationLocalIOController
getLocalIOController() {
133 public String
getIdentifier() {
134 return model
.getIdentifier();
138 * Process Hierarchy notation does NOT support popup menu functionality.
142 public InsertMenuItemResult
addPopupMenuItem(ProModAction proModAction
, MenuItemPosition menuItemPosition
, MenuService
.MenuSeparator menuSeparator
, boolean checkable
){
143 return InsertMenuItemResult
.POPUP_NOT_SUPPORTED
;
147 public List
<SettingPageData
> getSettingPages() {
162 private void initMainMenu() {
163 ModelerSession
.getMenuService().insertMainMenuItem(
164 model
.getAction(ProcessHierarchyNotationModel
.SAVE_ACTION_KEY
),
165 new MenuItemPosition(Modeler
.FILE_LABEL
, MenuItemPosition
.PlacementStyle
.FIRST
169 ModelerSession
.getMenuService().insertMainMenuItem(
170 model
.getAction(ProcessHierarchyNotationModel
.REFRESH_ACTION_KEY
),
171 new MenuItemPosition(ProcessHierarchyNotationModel
.PROCESS_HIERARCHY_LABEL
)
175 private void initStatusBar() {
177 ModelerSession
.getStatusBarService().addStatusBarItem(
178 getIdentifier(), statusBarItem
, JideBoxLayout
.VARY
182 private void initToolBar() {
183 ModelerSession
.getToolBarService().addAction(
185 model
.getAction(ProcessHierarchyNotationModel
.SAVE_ACTION_KEY
)
188 ModelerSession
.getToolBarService().addAction(
190 model
.getAction(ProcessHierarchyNotationModel
.SAVE_ALL_ACTION_KEY
)
193 ModelerSession
.getToolBarControlService().getCommandBar(getIdentifier()).addSeparator();
195 ModelerSession
.getToolBarService().addAction(
197 model
.getAction(ProcessHierarchyNotationModel
.REFRESH_ACTION_KEY
)
200 ModelerSession
.getToolBarService().addAction(
202 model
.getAction(ProcessHierarchyNotationModel
.DELETE_ACTION_KEY
)
205 ModelerSession
.getToolBarControlService().getCommandBar(getIdentifier()).addSeparator();
207 ModelerSession
.getToolBarControlService().getCommandBar(getIdentifier()).add(createTreeTestCheckBox());
210 private JCheckBox
createTreeTestCheckBox() {
211 final JCheckBox checkBox
= ModelerSession
.getComponentFactoryService().createCheckBox();
212 checkBox
.setText(ProcessHierarchyNotationModel
.CHECK_TREE_STRUCTURE_LABEL
);
214 com
.jgoodies
.binding
.adapter
.Bindings
.bind(checkBox
, checkTreeStructureModel
);
219 private void initActions() {
220 ModelerSession
.getActionService().registerAction(
222 ProcessHierarchyNotationModel
.REFRESH_ACTION_KEY
,
223 model
.getAction(ProcessHierarchyNotationModel
.REFRESH_ACTION_KEY
)
226 ModelerSession
.getActionService().registerAction(
228 ProcessHierarchyNotationModel
.DELETE_ACTION_KEY
,
229 model
.getAction(ProcessHierarchyNotationModel
.DELETE_ACTION_KEY
)
232 ModelerSession
.getActionService().registerAction(
234 ProcessHierarchyNotationModel
.SAVE_ACTION_KEY
,
235 model
.getAction(ProcessHierarchyNotationModel
.SAVE_ACTION_KEY
)
238 ModelerSession
.getActionService().registerAction(
240 ProcessHierarchyNotationModel
.SAVE_ALL_ACTION_KEY
,
241 model
.getAction(ProcessHierarchyNotationModel
.SAVE_ALL_ACTION_KEY
)
246 public void finish() { }
248 public boolean checkTreeStructure(){
249 return (Boolean
) checkTreeStructureModel
.getValue();
253 * Sets a text to the label status bar item.
255 * @param text is the text to be displayed in the status bar
257 public void setStatusInfoText(final String text
){
258 statusBarItem
.setText(text
);