Converted all CRLF to LF.
[indepmod/mmn.git] / IndependentModeler / src / cz / cvut / promod / gui / dialogs / pluginsOverview / notations / NotationOverviewTabView.java
blobae0b723409b92b243759b43bf70de4da3bb5f2dd
1 package cz.cvut.promod.gui.dialogs.pluginsOverview.notations;
3 import com.jgoodies.forms.factories.Borders;
4 import com.jgoodies.forms.layout.FormLayout;
5 import com.jgoodies.forms.layout.CellConstraints;
7 import javax.swing.*;
9 import cz.cvut.promod.services.componentFactoryService.ComponentFactoryService;
10 import cz.cvut.promod.services.ModelerSession;
11 import cz.cvut.promod.gui.dialogs.pluginsOverview.PluginsOverviewDialogView;
12 import cz.cvut.promod.gui.dialogs.pluginsOverview.PluginsOverviewDialogDialog;
14 import java.awt.*;
16 /**
17 * ProMod, master thesis project
18 * User: Petr Zverina, petr.zverina@gmail.com
19 * Date: 16:50:08, 11.2.2010
21 * A View component of NotationOverviewTab.
24 public class NotationOverviewTabView extends JPanel {
27 protected final JList notationsList = ModelerSession.getComponentFactoryService().createList();
28 protected final JList modulesList = ModelerSession.getComponentFactoryService().createList();
30 private final JLabel identifierLabel =
31 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.IDENTIFIER_LABEL);
32 private final JLabel nameLabel =
33 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.NAME_LABEL);
34 private final JLabel descriptionLabel =
35 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.DESCRIPTION_LABEL);
36 private final JLabel abbreviationLabel =
37 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.ABBREVIATION_LABEL);
38 private final JLabel fullNameLabel =
39 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.FULL_NAME_LABEL);
40 private final JLabel toolTipLabel =
41 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.TOOL_TIP_LABEL);
42 private final JLabel fileExtensionLabel =
43 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.FILE_EXTENSION_LABEL);
44 private final JLabel notationLabel =
45 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.NOTATION_LABEL);
46 private final JLabel moduleLabel =
47 ModelerSession.getComponentFactoryService().createLabel(PluginsOverviewDialogDialog.MODULE_LABEL);
49 protected final JTextField identifierTextArea =
50 ModelerSession.getComponentFactoryService().createTextField();
51 protected final JTextField nameTextArea =
52 ModelerSession.getComponentFactoryService().createTextField();
53 protected final JTextField fullNameTextArea =
54 ModelerSession.getComponentFactoryService().createTextField();
55 protected final JTextArea descriptionTextArea =
56 ModelerSession.getComponentFactoryService().createTextArea();
57 protected final JTextField abbreviationTextArea =
58 ModelerSession.getComponentFactoryService().createTextField();
59 protected final JTextField toolTipTextArea =
60 ModelerSession.getComponentFactoryService().createTextField();
61 protected final JTextField fileExtensionTextArea =
62 ModelerSession.getComponentFactoryService().createTextField();
65 public NotationOverviewTabView(){
66 identifierTextArea.setEditable(false);
67 fullNameTextArea.setEditable(false);
68 nameTextArea.setEditable(false);
69 abbreviationTextArea.setEditable(false);
70 toolTipTextArea.setEditable(false);
71 fileExtensionTextArea.setEditable(false);
72 descriptionTextArea.setEditable(false);
74 descriptionTextArea.setLineWrap(true);
75 descriptionTextArea.setWrapStyleWord(true);
77 notationsList.setFixedCellWidth(PluginsOverviewDialogView.LIST_WIDTH);
78 modulesList.setFixedCellWidth(PluginsOverviewDialogView.LIST_WIDTH);
80 initLayout();
83 private void initLayout() {
84 setBorder(Borders.createEmptyBorder(ComponentFactoryService.DEFAULT_FORM_BORDER));
86 final JPanel topCenterPanel = ModelerSession.getComponentFactoryService().createPanel();
87 topCenterPanel.setBorder(Borders.createEmptyBorder(ComponentFactoryService.DEFAULT_FORM_BORDER));
89 topCenterPanel.setLayout(new FormLayout(
90 "pref, 3dlu, pref:grow",
91 "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 10dlu, pref"
92 ));
93 final CellConstraints cellConstraints = new CellConstraints();
95 int row = 1;
96 topCenterPanel.add(identifierLabel, cellConstraints.xy(1,row));
97 topCenterPanel.add(identifierTextArea, cellConstraints.xy(3,row));
99 row += 2;
100 topCenterPanel.add(nameLabel, cellConstraints.xy(1,row));
101 topCenterPanel.add(nameTextArea, cellConstraints.xy(3,row));
103 row += 2;
104 topCenterPanel.add(fullNameLabel, cellConstraints.xy(1,row));
105 topCenterPanel.add(fullNameTextArea, cellConstraints.xy(3,row));
107 row += 2;
108 topCenterPanel.add(abbreviationLabel, cellConstraints.xy(1,row));
109 topCenterPanel.add(abbreviationTextArea, cellConstraints.xy(3,row));
111 row += 2;
112 topCenterPanel.add(toolTipLabel, cellConstraints.xy(1,row));
113 topCenterPanel.add(toolTipTextArea, cellConstraints.xy(3,row));
115 row += 2;
116 topCenterPanel.add(fileExtensionLabel, cellConstraints.xy(1,row));
117 topCenterPanel.add(fileExtensionTextArea, cellConstraints.xy(3,row));
119 row += 2;
120 topCenterPanel.add(descriptionLabel, cellConstraints.xy(1,row));
122 final JPanel centerPanel = ModelerSession.getComponentFactoryService().createPanel();
123 centerPanel.setLayout(new BorderLayout());
125 centerPanel.add(topCenterPanel, BorderLayout.NORTH);
126 centerPanel.add(ModelerSession.getComponentFactoryService().createScrollPane(descriptionTextArea));
128 setLayout(new BorderLayout(PluginsOverviewDialogView.HGAP, PluginsOverviewDialogView.HGAP));
130 final JPanel listsNotationPanel = ModelerSession.getComponentFactoryService().createPanel();
131 listsNotationPanel.setLayout(new BorderLayout());
132 listsNotationPanel.add(notationLabel, BorderLayout.NORTH);
133 listsNotationPanel.add(ModelerSession.getComponentFactoryService().createScrollPane(notationsList), BorderLayout.CENTER);
135 final JPanel listsModulePanel = ModelerSession.getComponentFactoryService().createPanel();
136 listsModulePanel.setLayout(new BorderLayout());
137 listsModulePanel.add(moduleLabel, BorderLayout.NORTH);
138 listsModulePanel.add(ModelerSession.getComponentFactoryService().createScrollPane(modulesList), BorderLayout.CENTER);
140 final JPanel listsPanel = ModelerSession.getComponentFactoryService().createPanel();
141 listsPanel.setLayout(new BorderLayout(PluginsOverviewDialogView.HGAP, PluginsOverviewDialogView.HGAP));
142 listsPanel.add(listsNotationPanel, BorderLayout.WEST);
143 listsPanel.add(listsModulePanel, BorderLayout.EAST);
145 add(centerPanel, BorderLayout.CENTER);
146 add(listsPanel, BorderLayout.WEST);