Example usage for com.jgoodies.forms.factories Borders createEmptyBorder

List of usage examples for com.jgoodies.forms.factories Borders createEmptyBorder

Introduction

In this page you can find the example usage for com.jgoodies.forms.factories Borders createEmptyBorder.

Prototype

public static Border createEmptyBorder(String encodedSizes) 

Source Link

Document

Creates and returns a Border using sizes as specified by the given string.

Usage

From source file:se.streamsource.streamflow.client.ui.administration.forms.definition.FormSignatureView.java

License:Apache License

public FormSignatureView(@Service ApplicationContext context, @Uses FormSignatureModel model,
        @Structure Module module) {//w  ww.  j a  v  a  2s.co m
    super(new BorderLayout());
    this.module = module;
    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    this.model = model;

    FormLayout formLayout = new FormLayout("200dlu", "");

    DefaultFormBuilder formBuilder = new DefaultFormBuilder(formLayout, this);
    formBuilder.setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    formValueBinder = module.objectBuilderFactory().newObject(StateBinder.class);
    formValueBinder.setResourceMap(context.getResourceMap(getClass()));
    RequiredSignatureValue signatureValue = formValueBinder.bindingTemplate(RequiredSignatureValue.class);

    BindingFormBuilder bb = new BindingFormBuilder(formBuilder, formValueBinder);

    bb.appendLine(AdministrationResources.name_label, TEXTFIELD, signatureValue.name())
            .appendLine(AdministrationResources.description_label, TEXTFIELD, signatureValue.description());

    formValueBinder.addObserver(this);

    new RefreshWhenShowing(this, this);
}

From source file:se.streamsource.streamflow.client.ui.administration.forms.definition.PageEditView.java

License:Apache License

public PageEditView(@Service ApplicationContext context, @Uses PageEditModel model, @Structure Module module) {
    this.model = model;
    JPanel panel = new JPanel(new BorderLayout());
    refreshComponents = new RefreshComponents();

    ActionMap am = context.getActionMap(this);

    valueBinder = module.objectBuilderFactory().newObject(ValueBinder.class);
    actionBinder = module.objectBuilderFactory().newObjectBuilder(ActionBinder.class)
            .use(context.getActionMap(this)).newInstance();
    actionBinder.setResourceMap(context.getResourceMap(getClass()));

    JPanel topPanel = new JPanel(new BorderLayout());
    JPanel fieldPanel = new JPanel();
    FormLayout fieldFormLayout = new FormLayout("45dlu, 5dlu, 150dlu:grow", "pref, pref");

    DefaultFormBuilder fieldFormBuilder = new DefaultFormBuilder(fieldFormLayout, fieldPanel);
    fieldFormBuilder.setBorder(Borders.createEmptyBorder("4dlu, 4dlu, 4dlu, 4dlu"));

    fieldFormBuilder.append(text(AdministrationResources.type_label),
            new JLabel(text(AdministrationResources.page_break_field_type)));
    fieldFormBuilder.nextLine();/*from  w  ww. jav a  2s  .  com*/

    fieldFormBuilder.add(new JLabel(text(AdministrationResources.name_label)));
    fieldFormBuilder.nextColumn(2);
    fieldFormBuilder
            .add(valueBinder.bind("description", actionBinder.bind("changeDescription", descriptionField)));

    topPanel.add(fieldPanel, BorderLayout.NORTH);

    JPanel rulePanel = new JPanel();
    FormLayout ruleFormLayout = new FormLayout("45dlu, 5dlu, 150dlu, 5dlu, 45dlu, 5dlu, 150dlu:grow",
            "pref, pref, pref, pref:grow");

    DefaultFormBuilder ruleFormBuilder = new DefaultFormBuilder(ruleFormLayout, rulePanel);
    ruleFormBuilder.addSeparator(text(AdministrationResources.visibility_rule));
    ruleFormBuilder.setBorder(Borders.createEmptyBorder("4dlu, 4dlu, 4dlu, 4dlu"));

    ruleFormBuilder.nextLine();

    ruleFormBuilder.add(new JLabel(text(AdministrationResources.rule_field_id)));
    ruleFormBuilder.nextColumn(2);
    ruleFormBuilder.add(valueBinder.bind("fieldId", actionBinder.bind("changeRuleFieldId", ruleFieldIdCombo)));
    ruleFieldIdCombo.setRenderer(new LinkListCellRenderer());

    ruleFormBuilder.nextColumn(2);

    ruleFormBuilder.add(new JLabel(text(AdministrationResources.rule_values)));

    VisibilityRuleValuesView visibilityRuleValuesView = module.objectBuilderFactory()
            .newObjectBuilder(VisibilityRuleValuesView.class).use(model.newVisibilityRuleValuesModel())
            .newInstance();
    //visibilityRuleValuesView.setMaximumSize( new Dimension(150, 75 ) );
    ruleFormBuilder.add(visibilityRuleValuesView,
            new CellConstraints(7, 2, 1, 3, CellConstraints.FILL, CellConstraints.FILL));

    ruleFormBuilder.nextLine();

    ruleFormBuilder.add(new JLabel(text(AdministrationResources.rule_condition)));
    ruleFormBuilder.nextColumn(2);
    ruleFormBuilder
            .add(valueBinder.bind("condition", actionBinder.bind("changeRuleCondition", ruleConditionCombo)));
    ruleConditionCombo.setRenderer(new DefaultListRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            if (value instanceof LinkValue) {
                LinkValue itemValue = (LinkValue) value;
                String val = itemValue == null ? ""
                        : text(VisibilityRuleCondition.valueOf(itemValue.text().get()));

                return super.getListCellRendererComponent(list, val, index, isSelected, cellHasFocus);
            } else
                return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        }
    });

    ruleFormBuilder.add(new JLabel(text(AdministrationResources.rule_visible_when)),
            new CellConstraints(1, 4, 1, 1, CellConstraints.FILL, CellConstraints.TOP));

    javax.swing.Action visibilityWhenToTrueAction = am.get("changeVisibleWhenToTrue");
    javax.swing.Action visibilityWhenToFalseAction = am.get("changeVisibleWhenToFalse");

    buttonGroup = new JXRadioGroup();
    buttonGroup.setLayoutAxis(BoxLayout.LINE_AXIS);
    visibleWhenTrue = new JRadioButton(visibilityWhenToTrueAction);
    visibleWhenFalse = new JRadioButton(visibilityWhenToFalseAction);
    buttonGroup.add(visibleWhenTrue);
    buttonGroup.add(visibleWhenFalse);

    ruleFormBuilder.add(buttonGroup,
            new CellConstraints(3, 4, 1, 1, CellConstraints.FILL, CellConstraints.TOP));

    topPanel.add(rulePanel, BorderLayout.CENTER);
    panel.add(topPanel, BorderLayout.NORTH);
    panel.add(new JPanel(), BorderLayout.CENTER);

    refreshComponents.visibleOn("possiblerulefields", rulePanel);

    setViewportView(panel);

    new RefreshWhenShowing(this, this);
}

From source file:se.streamsource.streamflow.client.ui.administration.forms.definition.SelectionElementsView.java

License:Apache License

public SelectionElementsView(@Service ApplicationContext context, @Uses SelectionElementsModel model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(Borders.createEmptyBorder("4dlu, 4dlu, 4dlu, 4dlu"));

    JScrollPane scrollPanel = new JScrollPane();
    am = context.getActionMap(this);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    upButton = new StreamflowButton(am.get("up"));
    toolbar.add(upButton);//from   w  ww  . j  ava  2 s .co m
    downButton = new StreamflowButton(am.get("down"));
    toolbar.add(downButton);
    upButton.setEnabled(false);
    downButton.setEnabled(false);
    toolbar.add(new StreamflowButton(am.get("rename")));
    toolbar.add(new StreamflowButton(am.get("importvalues")));
    toolbar.add(new StreamflowButton(am.get("removeall")));

    model.refresh();
    elementList = new JXList(new EventListModel<String>(model.getEventList()));
    elementList.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList jList, Object o, int i, boolean b, boolean b1) {
            if ("".equals(o)) {
                Component cell = super.getListCellRendererComponent(jList,
                        i18n.text(WorkspaceResources.name_label), i, b, b1);
                cell.setForeground(Color.GRAY);
                return cell;
            }
            return super.getListCellRendererComponent(jList, o, i, b, b1); //To change body of overridden methods use File | Settings | File Templates.
        }
    });

    scrollPanel.setViewportView(elementList);

    add(scrollPanel, BorderLayout.CENTER);
    add(toolbar, BorderLayout.SOUTH);

    elementList.getSelectionModel().addListSelectionListener(
            new SelectionActionEnabler(am.get("remove"), am.get("rename"), am.get("up"), am.get("down")) {

                @Override
                public boolean isSelectedValueValid(Action action) {
                    boolean result = true;
                    try {
                        int selectedIndex = elementList.getSelectedIndex();
                        if (selectedIndex == -1) {
                            result = false;
                        } else if (action.equals(am.get("up"))) {
                            if (selectedIndex == 0)
                                result = false;
                        } else if (action.equals(am.get("down"))) {
                            if (selectedIndex == elementList.getModel().getSize() - 1)
                                result = false;
                        }
                    } catch (IndexOutOfBoundsException e) {
                        result = false;
                    }
                    return result;
                }
            });
    elementList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}

From source file:se.streamsource.streamflow.client.ui.administration.forms.definition.VisibilityRuleValuesView.java

License:Apache License

public VisibilityRuleValuesView(@Service ApplicationContext context, @Uses VisibilityRuleValuesModel model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(Borders.createEmptyBorder("4dlu, 4dlu, 4dlu, 4dlu"));

    JScrollPane scrollPanel = new JScrollPane();
    ActionMap am = context.getActionMap(this);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    toolbar.add(new StreamflowButton(am.get("rename")));

    model.refresh();/*from ww  w.jav  a2  s.com*/
    elementList = new JXList(new EventListModel<String>(model.getEventList()));
    elementList.setCellRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList jList, Object o, int i, boolean b, boolean b1) {
            if ("".equals(o)) {
                Component cell = super.getListCellRendererComponent(jList,
                        i18n.text(WorkspaceResources.name_label), i, b, b1);
                cell.setForeground(Color.GRAY);
                return cell;
            }
            return super.getListCellRendererComponent(jList, o, i, b, b1); //To change body of overridden methods use File | Settings | File Templates.
        }
    });

    scrollPanel.setViewportView(elementList);

    add(scrollPanel, BorderLayout.CENTER);
    add(toolbar, BorderLayout.SOUTH);

    elementList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("remove")));
    elementList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("rename")));
    elementList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

}

From source file:se.streamsource.streamflow.client.ui.administration.forms.FormView.java

License:Apache License

public FormView(@Service ApplicationContext context, @Uses FormModel model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);

    model.addObserver(this);
    textArea = new JTextArea();
    textArea.setLineWrap(true);/*w ww. j a va 2  s  .  com*/
    textArea.setWrapStyleWord(true);
    textArea.setEditable(false);
    add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(new StreamflowButton(am.get("edit")), BorderLayout.SOUTH);

    new RefreshWhenShowing(this, model);
}

From source file:se.streamsource.streamflow.client.ui.administration.forms.SelectedFormsView.java

License:Apache License

public SelectedFormsView(@Service ApplicationContext context, @Uses final SelectedFormsModel model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);
    setActionMap(am);/*from w  ww .j  a  va  2 s . co m*/

    labelList = new JList(new EventListModel<LinkValue>(model.getList()));

    labelList.setCellRenderer(new LinkListCellRenderer());

    add(new JScrollPane(labelList), BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    add(toolbar, BorderLayout.SOUTH);
    labelList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("remove")));

    new RefreshWhenShowing(this, model);
}

From source file:se.streamsource.streamflow.client.ui.administration.groups.ParticipantsView.java

License:Apache License

public ParticipantsView(@Service ApplicationContext context, @Uses final ParticipantsModel model) {
    super(new BorderLayout());
    this.model = model;
    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);
    setActionMap(am);//from w  w w .j  a  v a  2s . co m

    participantList = new JList(new EventListModel<LinkValue>(model.getList()));

    participantList.setCellRenderer(new LinkListCellRenderer());

    add(new JScrollPane(participantList), BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    add(toolbar, BorderLayout.SOUTH);

    participantList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("remove")));

    new RefreshWhenShowing(this, model);
}

From source file:se.streamsource.streamflow.client.ui.administration.labels.SelectedLabelsView.java

License:Apache License

public SelectedLabelsView(@Service ApplicationContext context, @Uses SelectedLabelsModel model) {
    super(new BorderLayout());
    this.modelSelected = model;
    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);
    setActionMap(am);/*from ww w  . j  a  va2 s  .  c  o  m*/

    labelList = new JList(new EventListModel<LinkValue>(modelSelected.getList()));

    labelList.setCellRenderer(new LinkListCellRenderer());

    add(new JScrollPane(labelList), BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    add(toolbar, BorderLayout.SOUTH);
    labelList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("remove")));

    new RefreshWhenShowing(this, modelSelected);
}

From source file:se.streamsource.streamflow.client.ui.administration.organisationsettings.MailRestrictionsView.java

License:Apache License

public MailRestrictionsView(@Service ApplicationContext context, @Uses final MailRestrictionsModel model) {
    this.model = model;

    FormLayout layout = new FormLayout("150dlu, 2dlu, 50, 200", "pref");
    setLayout(layout);//w  w w .  j av  a2 s  . c o m
    setMaximumSize(new Dimension(Short.MAX_VALUE, 50));
    builder = new DefaultFormBuilder(layout, this);

    builder.add(new JLabel(i18n.text(AdministrationResources.mailrestrictions_addresses)),
            new CellConstraints(1, 1, 1, 1, CellConstraints.LEFT, CellConstraints.TOP, new Insets(4, 0, 0, 0)));

    JPanel addressPanel = new JPanel(new BorderLayout());
    addressPanel.setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);
    setActionMap(am);

    JPopupMenu options = new JPopupMenu();
    options.add(am.get("rename"));
    options.add(am.get("remove"));

    JScrollPane scrollPane = new JScrollPane();
    EventList<LinkValue> itemValueEventList = model.getList();
    list = new JList(new EventListModel<LinkValue>(itemValueEventList));
    list.setCellRenderer(new LinkListCellRenderer());
    scrollPane.setViewportView(list);
    addressPanel.add(scrollPane, BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(new OptionsAction(options)));
    addressPanel.add(toolbar, BorderLayout.SOUTH);

    list.getSelectionModel()
            .addListSelectionListener(new SelectionActionEnabler(am.get("remove"), am.get("rename")));

    builder.add(addressPanel, new CellConstraints(3, 1, 2, 1));

    new RefreshWhenShowing(this, model);

}

From source file:se.streamsource.streamflow.client.ui.administration.organizations.OrganizationUsersView.java

License:Apache License

public OrganizationUsersView(@Service ApplicationContext context, @Uses OrganizationUsersModel model) {
    super(new BorderLayout());
    this.model = model;

    setBorder(Borders.createEmptyBorder("2dlu, 2dlu, 2dlu, 2dlu"));

    ActionMap am = context.getActionMap(this);
    setActionMap(am);// ww w .jav a  2 s . c o m

    linkValues = model.getList();
    participantList = new JList(new EventListModel<LinkValue>(linkValues));
    participantList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    participantList.setCellRenderer(new LinkListCellRenderer());

    JScrollPane scrollPane = new JScrollPane(participantList);
    add(scrollPane, BorderLayout.CENTER);

    JPanel toolbar = new JPanel();
    toolbar.add(new StreamflowButton(am.get("add")));
    toolbar.add(new StreamflowButton(am.get("remove")));
    add(toolbar, BorderLayout.SOUTH);

    participantList.getSelectionModel().addListSelectionListener(new SelectionActionEnabler(am.get("remove")));

    new RefreshWhenShowing(this, model);
}