Example usage for com.vaadin.ui FormLayout setMargin

List of usage examples for com.vaadin.ui FormLayout setMargin

Introduction

In this page you can find the example usage for com.vaadin.ui FormLayout setMargin.

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:org.jpos.qi.login.LoginView.java

License:Open Source License

private FormLayout createForm() {
    FormLayout formLayout = new FormLayout();
    formLayout.setMargin(false);
    formLayout.setSizeUndefined();/* w w  w  .  j  a v  a2 s.com*/

    binder = new Binder<>(String.class);
    username = new TextField(app.getMessage("login.username"));
    username.setMaxLength(60);

    binder.forField(username)
            .withValidator(new RegexpValidator(
                    app.getMessage("errorMessage.invalidField", username.getCaption()), USERNAME_PATTERN))
            .bind(string -> string, null);
    binder.setBean("");
    username.focus();
    username.setReadOnly(false);
    password = new PasswordField();
    password.setCaption(app.getMessage("login.password"));
    password.setMaxLength(64);
    binder.forField(password).asRequired(app.getMessage("errorMessage.req", password.getCaption()))
            .withValidator(new RegexpValidator(
                    app.getMessage("errorMessage.invalidField", password.getCaption()), PASSWORD_PATTERN))
            .bind(string -> string, null);
    password.setReadOnly(false);

    rememberMe = new CheckBox(app.getMessage("login.remember"));
    rememberMe.setDescription(app.getMessage("login.rememberDesc"));

    formLayout.addComponent(username);
    formLayout.addComponent(password);
    if (helper.isRememberEnabled())
        formLayout.addComponent(rememberMe);
    return formLayout;
}

From source file:org.jpos.qi.QIEntityView.java

License:Open Source License

protected Layout createLayout() {
    FormLayout layout = new FormLayout();
    layout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);
    layout.addStyleName("qi-form");
    layout.setMargin(new MarginInfo(false));
    addFields(layout);//from ww  w  .  j  a va2 s.  co m
    return layout;
}

From source file:org.jumpmind.metl.ui.views.deploy.EditAgentDeploymentPanel.java

License:Open Source License

public EditAgentDeploymentPanel(ApplicationContext context, AgentDeployment agentDeployment,
        AgentDeploymentChangeListener listener, TabbedPanel tabbedPanel) {
    this.context = context;
    this.agentDeployment = agentDeployment;
    this.listener = listener;
    this.tabbedPanel = tabbedPanel;

    VerticalLayout vlay = new VerticalLayout();
    FormLayout form = new FormLayout();
    form.setSpacing(true);//w  ww . j  a va 2  s  .  c om
    form.setMargin(true);
    form.addComponent(getNameComponent());
    form.addComponent(getLogLevelComponent());
    form.addComponent(getStartTypeComponent());

    vlay.addComponent(form);
    cronLayout = new HorizontalLayout();
    cronLayout.setSpacing(true);
    cronLayout.setMargin(true);
    cronLayout.addComponent(getScheduleComponent("Second"));
    cronLayout.addComponent(getScheduleComponent("Minute"));
    cronLayout.addComponent(getScheduleComponent("Hour"));
    cronLayout.addComponent(getScheduleComponent("Day"));
    cronLayout.addComponent(getScheduleComponent("Month"));
    cronLayout.addComponent(getScheduleComponent("Day of Week"));
    cronLayout.addComponent(getScheduleComponent("Year"));
    vlay.addComponent(cronLayout);

    FormLayout cronForm = new FormLayout();
    cronForm.setSpacing(true);
    cronForm.setMargin(true);
    cronForm.addComponent(getCronComponent());
    vlay.addComponent(cronForm);

    table = new Table();
    table.setSizeFull();
    BeanItemContainer<AgentDeploymentParameter> container = new BeanItemContainer<AgentDeploymentParameter>(
            AgentDeploymentParameter.class);
    table.setContainerDataSource(container);
    table.setEditable(true);
    table.setSelectable(true);
    table.setTableFieldFactory(new EditFieldFactory());
    table.setVisibleColumns("name", "value");
    table.setColumnHeaders("Parameter Name", "Value");

    container.addAll(agentDeployment.getAgentDeploymentParameters());

    setSplitPosition(60f);
    setFirstComponent(vlay);
    setSecondComponent(table);
    updateScheduleEnable();
    updateScheduleFields();
}

From source file:org.jumpmind.metl.ui.views.design.PropertySheet.java

License:Open Source License

@SuppressWarnings("unchecked")
public void setSource(Object obj) {
    value = obj;/*ww  w .  j  a  v a  2  s . co  m*/
    editButton.setVisible(hasAdvancedEditor());
    FormLayout formLayout = new FormLayout();
    formLayout.setWidth(100, Unit.PERCENTAGE);
    formLayout.setMargin(false);
    formLayout.addStyleName(ValoTheme.FORMLAYOUT_LIGHT);

    if (obj != null) {

        if (obj instanceof List<?>) {
            List<Object> l = (List<Object>) obj;
            if (l.size() == 1) {
                if (l.get(0) instanceof FlowStep) {
                    obj = (FlowStep) l.get(0);
                }
            }
        }

        if (obj instanceof FlowStep) {
            obj = ((FlowStep) obj).getComponent();
        }

        if (obj instanceof Component) {
            Component component = (Component) obj;
            context.getConfigurationService().refresh(component, true);
            addComponentProperties(formLayout, component);
        }

        if (obj instanceof Resource) {
            Resource resource = (Resource) obj;
            addResourceProperties(formLayout, resource);
        }

        if (obj instanceof AbstractObjectWithSettings) {
            List<XMLSetting> settings = buildSettings(obj);
            if (settings != null) {
                for (XMLSetting definition : settings) {
                    addSettingField(definition, (AbstractObjectWithSettings) obj, formLayout);
                }
            }
        }

        if (obj instanceof Component) {
            Component component = (Component) obj;
            XMLComponent componentDefintion = context.getComponentDefinitionFactory()
                    .getDefinition(component.getType());
            addThreadCount(componentDefintion, formLayout, component);
            addComponentShared(formLayout, component);
        }

        if (obj instanceof List<?>) {
            addCommonComponentSettings(formLayout, obj);
        }

    }
    panel.setContent(formLayout);
}

From source file:org.opennms.features.topology.app.internal.ui.info.DefaultEdgeInfoPanelItem.java

License:Open Source License

@Override
protected Component getComponent(EdgeRef ref, GraphContainer container) {
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*from w  w  w .j  a  va 2s .  c om*/
    formLayout.setMargin(false);

    if (ref instanceof AbstractEdge) {
        AbstractEdge edge = (AbstractEdge) ref;

        formLayout.addComponent(createLabel("Source", edge.getSource().getVertex().getLabel()));
        formLayout.addComponent(createLabel("Target", edge.getTarget().getVertex().getLabel()));
    }

    return formLayout;
}

From source file:org.opennms.features.topology.app.internal.ui.info.DefaultEdgeInfoPanelItemProvider.java

License:Open Source License

private Component createComponent(EdgeRef ref) {
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*from ww w.j  av a2s . co  m*/
    formLayout.setMargin(false);

    if (ref instanceof AbstractEdge) {
        AbstractEdge edge = (AbstractEdge) ref;

        formLayout.addComponent(createLabel("Source", edge.getSource().getVertex().getLabel()));
        formLayout.addComponent(createLabel("Target", edge.getTarget().getVertex().getLabel()));
    }

    return formLayout;
}

From source file:org.opennms.features.topology.app.internal.ui.info.DefaultVertexInfoPanelItem.java

License:Open Source License

@Override
protected Component getComponent(VertexRef ref, GraphContainer container) {
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*www . jav a 2s .  c  om*/
    formLayout.setMargin(false);

    formLayout.addComponent(createLabel("Name", ref.getLabel()));
    formLayout.addComponent(createLabel("ID", String.format("%s:%s", ref.getNamespace(), ref.getId())));

    if (ref instanceof AbstractVertex) {
        AbstractVertex vertex = (AbstractVertex) ref;

        formLayout.addComponent(createLabel("Icon Key", vertex.getIconKey()));

        if (vertex.getIpAddress() != null) {
            formLayout.addComponent(createLabel("IP Address", vertex.getIpAddress()));
        }
    }

    return formLayout;
}

From source file:org.opennms.features.topology.app.internal.ui.info.DefaultVertexInfoPanelItemProvider.java

License:Open Source License

private Component createComponent(VertexRef ref) {
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);/*from w w w  . j a  v  a  2s .c om*/
    formLayout.setMargin(false);

    formLayout.addComponent(createLabel("Name", ref.getLabel()));
    formLayout.addComponent(createLabel("ID", String.format("%s:%s", ref.getNamespace(), ref.getId())));

    if (ref instanceof AbstractVertex) {
        AbstractVertex vertex = (AbstractVertex) ref;

        formLayout.addComponent(createLabel("Icon Key", vertex.getIconKey()));

        if (vertex.getIpAddress() != null) {
            formLayout.addComponent(createLabel("IP Address", vertex.getIpAddress()));
        }
    }

    return formLayout;
}

From source file:org.opennms.features.topology.app.internal.ui.info.NodeInfoPanelItem.java

License:Open Source License

@Override
protected Component getComponent(VertexRef ref, GraphContainer container) {
    if (ref instanceof AbstractVertex && ((AbstractVertex) ref).getNodeID() != null) {
        AbstractVertex vertex = ((AbstractVertex) ref);
        OnmsNode node = nodeDao.get(vertex.getNodeID());

        if (node != null) {
            FormLayout formLayout = new FormLayout();
            formLayout.setSpacing(false);
            formLayout.setMargin(false);

            formLayout.addComponent(createLabel("Node ID", "" + node.getId()));

            final HorizontalLayout nodeButtonLayout = new HorizontalLayout();
            Button nodeButton = createButton(node.getLabel(), null, null,
                    event -> new NodeInfoWindow(vertex.getNodeID()).open());
            nodeButton.setStyleName(BaseTheme.BUTTON_LINK);
            nodeButtonLayout.addComponent(nodeButton);
            nodeButtonLayout.setCaption("Node Label");
            formLayout.addComponent(nodeButtonLayout);

            if (!Strings.isNullOrEmpty(node.getSysObjectId())) {
                formLayout.addComponent(createLabel("Enterprise OID", node.getSysObjectId()));
            }//from  w w w . j av a 2s  .c o  m

            return formLayout;
        }
    }

    return null;
}

From source file:org.opennms.features.topology.app.internal.ui.info.NodeInfoPanelItemProvider.java

License:Open Source License

private Component createComponent(AbstractVertex ref) {
    Preconditions.checkState(ref.getNodeID() != null, "no Node ID defined.");
    OnmsNode node = nodeDao.get(ref.getNodeID());
    FormLayout formLayout = new FormLayout();
    formLayout.setSpacing(false);//from w ww.j av a2 s  .com
    formLayout.setMargin(false);

    formLayout.addComponent(createLabel("Node ID", "" + node.getId()));

    final HorizontalLayout nodeButtonLayout = new HorizontalLayout();
    Button nodeButton = createButton(node.getLabel(), null, null,
            event -> new NodeInfoWindow(ref.getNodeID()).open());
    nodeButton.setStyleName(BaseTheme.BUTTON_LINK);
    nodeButtonLayout.addComponent(nodeButton);
    nodeButtonLayout.setCaption("Node Label");
    formLayout.addComponent(nodeButtonLayout);

    if (!Strings.isNullOrEmpty(node.getSysObjectId())) {
        formLayout.addComponent(createLabel("Enterprise OID", node.getSysObjectId()));
    }

    return formLayout;
}