1 package cz
.cvut
.promod
.gui
.dialogs
.newProject
;
3 import com
.jgoodies
.forms
.layout
.FormLayout
;
4 import com
.jgoodies
.forms
.layout
.CellConstraints
;
5 import com
.jgoodies
.forms
.factories
.Borders
;
10 import cz
.cvut
.promod
.services
.ModelerSession
;
11 import cz
.cvut
.promod
.services
.componentFactoryService
.ComponentFactoryService
;
14 * ProMod, master thesis project
15 * User: Petr Zverina, petr.zverina@gmail.com
16 * Date: 1:40:04, 20.10.2009
18 * The view component for NewProjectDialog.
20 public class NewProjectDialogView
extends JDialog
{
22 private final JLabel projectNameLabel
= ModelerSession
.getComponentFactoryService().createLabel("project name");
23 protected final JTextField projectNameTextField
= ModelerSession
.getComponentFactoryService().createTextField();
25 private final JLabel projectLocationLabel
= ModelerSession
.getComponentFactoryService().createLabel("project location");
26 protected final JTextField projectLocationTextField
= ModelerSession
.getComponentFactoryService().createTextField();
27 protected final JButton projectLocationButton
= ModelerSession
.getComponentFactoryService().createButton("...", null);
29 protected final JButton createProjectButton
= ModelerSession
.getComponentFactoryService().createButton("create project", null);
30 protected final JButton cancelButton
= ModelerSession
.getComponentFactoryService().createButton("cancel", null);
32 protected final JLabel errorLabel
= ModelerSession
.getComponentFactoryService().createLabel("");
34 protected final JPanel centerPanel
= ModelerSession
.getComponentFactoryService().createPanel();
36 public static final String TITLE
=
37 ModelerSession
.getCommonResourceBundle().getString("modeler.action.new.project.dialog");
39 public NewProjectDialogView(){
44 errorLabel
.setForeground(Color
.RED
);
51 private void initLayout() {
52 centerPanel
.setBorder(Borders
.createEmptyBorder(ComponentFactoryService
.DEFAULT_FORM_BORDER
));
53 centerPanel
.setLayout(new FormLayout(
54 "pref, 3dlu, max(180dlu;pref):grow, 3dlu, pref",
55 "pref, 3dlu, pref, 3dlu, pref, 20dlu")
59 final CellConstraints cellConstraints
= new CellConstraints();
61 centerPanel
.add(projectNameLabel
, cellConstraints
.xy(1, row
));
62 centerPanel
.add(projectNameTextField
, cellConstraints
.xyw(3, row
, 3));
65 centerPanel
.add(projectLocationLabel
, cellConstraints
.xy(1, row
));
66 centerPanel
.add(projectLocationTextField
, cellConstraints
.xy(3, row
));
67 centerPanel
.add(projectLocationButton
, cellConstraints
.xy(5, row
));
70 final JPanel southPanel
= ModelerSession
.getComponentFactoryService().createPanel();
71 southPanel
.setBorder(Borders
.createEmptyBorder(ComponentFactoryService
.DEFAULT_FORM_BORDER
));
72 southPanel
.setLayout(new FormLayout(
73 "pref, 50dlu:grow, pref",
77 southPanel
.add(errorLabel
, cellConstraints
.xyw(1, 1, 3));
79 southPanel
.add(cancelButton
, cellConstraints
.xy(1, 3));
80 southPanel
.add(createProjectButton
, cellConstraints
.xy(3, 3));
83 setLayout(new BorderLayout());
84 add(centerPanel
, BorderLayout
.CENTER
);
85 add(southPanel
, BorderLayout
.SOUTH
);