1 package cz
.cvut
.promod
.gui
.dialogs
.simpleTextFieldDialog
;
3 import cz
.cvut
.promod
.services
.ModelerSession
;
4 import cz
.cvut
.promod
.services
.componentFactoryService
.ComponentFactoryService
;
9 import com
.jgoodies
.forms
.factories
.Borders
;
10 import com
.jgoodies
.forms
.layout
.FormLayout
;
11 import com
.jgoodies
.forms
.layout
.CellConstraints
;
14 * ProMod, master thesis project
15 * User: Petr Zverina, petr.zverina@gmail.com
16 * Date: 23:49:51, 23.10.2009
18 * A View component of SimpleTextFieldDialog.
20 public class SimpleTextFieldDialogView
extends JDialog
{
22 private final Dimension INIT_SIZE
= new Dimension(450, 170);
24 protected JLabel textLabel
= ModelerSession
.getComponentFactoryService().createLabel("");
25 protected JTextField inputTextField
= ModelerSession
.getComponentFactoryService().createTextField();
27 protected final JLabel errorLabel
= ModelerSession
.getComponentFactoryService().createLabel("");
29 protected JButton confirmButton
= ModelerSession
.getComponentFactoryService().createButton("", null);
30 protected JButton cancelButton
= ModelerSession
.getComponentFactoryService().createButton("", null);
32 protected SimpleTextFieldDialogView(){
35 errorLabel
.setForeground(Color
.RED
);
38 private void initLayout() {
41 final JPanel centerPanel
= ModelerSession
.getComponentFactoryService().createPanel();
42 centerPanel
.setBorder(Borders
.createEmptyBorder(ComponentFactoryService
.DEFAULT_FORM_BORDER
));
44 centerPanel
.setLayout(new FormLayout(
45 "min(pref;2000dlu):grow",
46 "pref, 3dlu, pref, 3dlu, pref, 7dlu"
48 final CellConstraints cellConstraints
= new CellConstraints();
50 centerPanel
.add(textLabel
, cellConstraints
. xy(1, 1));
51 centerPanel
.add(inputTextField
, cellConstraints
.xy(1,3));
53 centerPanel
.add(errorLabel
, cellConstraints
.xy(1, 5));
55 final JPanel southPanel
= ModelerSession
.getComponentFactoryService().createPanel();
56 southPanel
.setBorder(Borders
.createEmptyBorder(ComponentFactoryService
.DEFAULT_FORM_BORDER
));
58 southPanel
.setLayout(new FormLayout(
59 "pref:grow, pref, 3dlu, pref, pref:grow",
62 southPanel
.add(confirmButton
, cellConstraints
.xy(2, 1));
63 southPanel
.add(cancelButton
, cellConstraints
.xy(4, 1));
65 setLayout(new BorderLayout());
66 add(centerPanel
, BorderLayout
.CENTER
);
67 add(southPanel
, BorderLayout
.SOUTH
);