Example usage for com.vaadin.ui HorizontalLayout setMargin

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

Introduction

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

Prototype

@Override
    public void setMargin(boolean enabled) 

Source Link

Usage

From source file:org.ikasan.dashboard.ui.administration.panel.PolicyManagementPanel.java

License:BSD License

@SuppressWarnings({ "serial" })
protected void init() {
    this.setWidth("100%");
    this.setHeight("100%");

    this.createAssociatedRolesPanel();
    this.createPolicyDropPanel();

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);// w  w w .ja v a2s. c  o  m
    layout.setSpacing(true);
    layout.setWidth("100%");

    Panel policyAdministrationPanel = new Panel();
    policyAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    policyAdministrationPanel.setHeight("100%");
    policyAdministrationPanel.setWidth("100%");

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setSizeFull();

    Label roleManagementLabel = new Label("Policy Management");
    roleManagementLabel.setStyleName(ValoTheme.LABEL_HUGE);
    gridLayout.addComponent(roleManagementLabel, 0, 0, 1, 0);

    Label roleSearchHintLabel = new Label();
    roleSearchHintLabel.setCaptionAsHtml(true);
    roleSearchHintLabel.setCaption(
            VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Policy Name field to find a policy.");
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleSearchHintLabel, 0, 1, 1, 1);

    Layout controlLayout = this.initControlLayout();

    gridLayout.addComponent(controlLayout, 0, 2, 1, 2);

    GridLayout formLayout = new GridLayout(2, 4);
    formLayout.setWidth("100%");
    formLayout.setSpacing(true);
    formLayout.setColumnExpandRatio(0, 1);
    formLayout.setColumnExpandRatio(1, 5);

    Label policyNameLabel = new Label("Policy Name:");
    policyNameLabel.setSizeUndefined();
    final DragAndDropWrapper policyNameFieldWrap = initPolicyNameField();

    formLayout.addComponent(policyNameLabel, 0, 0);
    formLayout.setComponentAlignment(policyNameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(policyNameFieldWrap, 1, 0);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.descriptionField = new TextArea();
    this.descriptionField.setWidth("70%");
    this.descriptionField.setHeight("60px");
    formLayout.addComponent(descriptionLabel, 0, 1);
    formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    formLayout.addComponent(this.descriptionField, 1, 1);

    this.linkTypeLabel.setSizeUndefined();
    formLayout.addComponent(this.linkTypeLabel, 0, 2);
    formLayout.setComponentAlignment(this.linkTypeLabel, Alignment.MIDDLE_RIGHT);
    this.linkType.setWidth("70%");
    formLayout.addComponent(this.linkType, 1, 2);
    this.linkTypeLabel.setVisible(false);
    this.linkType.setVisible(false);

    this.linkedEntityLabel.setSizeUndefined();
    this.linkedEntity = new TextArea();
    this.linkedEntity.setWidth("70%");
    this.linkedEntity.setHeight("60px");

    formLayout.addComponent(this.linkedEntityLabel, 0, 3);
    formLayout.setComponentAlignment(this.linkedEntityLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(linkedEntity, 1, 3);
    this.linkedEntityLabel.setVisible(false);
    this.linkedEntity.setVisible(false);

    gridLayout.addComponent(formLayout, 0, 3, 1, 3);

    Label roleTableHintLabel = new Label();
    roleTableHintLabel.setCaptionAsHtml(true);
    roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The Roles table below displays the roles that are assigned the current policy.");
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleTableHintLabel, 0, 4, 1, 4);

    gridLayout.addComponent(this.roleTable, 0, 5, 1, 5);

    policyAdministrationPanel.setContent(gridLayout);
    layout.addComponent(policyAdministrationPanel);

    HorizontalLayout roleMemberPanelLayout = new HorizontalLayout();
    roleMemberPanelLayout.setMargin(true);
    roleMemberPanelLayout.addComponent(this.policyDropPanel);
    roleMemberPanelLayout.setSizeFull();

    HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
    hsplit.setFirstComponent(layout);
    hsplit.setSecondComponent(roleMemberPanelLayout);

    // Set the position of the splitter as percentage
    hsplit.setSplitPosition(65, Unit.PERCENTAGE);
    hsplit.setLocked(true);

    this.setContent(hsplit);
}

From source file:org.ikasan.dashboard.ui.administration.panel.RoleManagementPanel.java

License:BSD License

@SuppressWarnings({ "serial" })
protected void init() {
    this.setWidth("100%");
    this.setHeight("100%");

    this.initPolicyNameField();
    this.createPolicyDropPanel();

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();//from  www.  j  av  a  2  s .co m

    Panel roleAdministrationPanel = new Panel();
    roleAdministrationPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    roleAdministrationPanel.setHeight("100%");
    roleAdministrationPanel.setWidth("100%");

    GridLayout gridLayout = new GridLayout(2, 6);
    gridLayout.setWidth("100%");
    gridLayout.setHeight("100%");
    gridLayout.setMargin(true);
    gridLayout.setSizeFull();

    Label roleManagementLabel = new Label("Role Management");
    roleManagementLabel.setStyleName(ValoTheme.LABEL_HUGE);
    gridLayout.addComponent(roleManagementLabel, 0, 0, 1, 0);

    Label roleSearchHintLabel = new Label();
    roleSearchHintLabel.setCaptionAsHtml(true);
    roleSearchHintLabel.setCaption(
            VaadinIcons.QUESTION_CIRCLE_O.getHtml() + " Type into the Role Name field to find a role.");
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleSearchHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleSearchHintLabel, 0, 1, 1, 1);

    Layout controlLayout = this.initControlLayout();

    gridLayout.addComponent(controlLayout, 0, 2, 1, 2);

    Label roleNameLabel = new Label("Role Name:");
    roleNameLabel.setSizeUndefined();
    initRoleNameField();

    GridLayout formLayout = new GridLayout(2, 2);
    formLayout.setWidth("100%");
    formLayout.setHeight("115px");
    formLayout.setSpacing(true);

    formLayout.setColumnExpandRatio(0, 1);
    formLayout.setColumnExpandRatio(1, 5);

    this.roleNameField.setWidth("70%");
    formLayout.addComponent(roleNameLabel, 0, 0);
    formLayout.setComponentAlignment(roleNameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(this.roleNameField, 1, 0);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    this.descriptionField = new TextArea();
    this.descriptionField.setWidth("70%");
    this.descriptionField.setHeight("60px");
    formLayout.addComponent(descriptionLabel, 0, 1);
    formLayout.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);
    formLayout.addComponent(descriptionField, 1, 1);

    gridLayout.addComponent(formLayout, 0, 3, 1, 3);

    Label roleTableHintLabel = new Label();
    roleTableHintLabel.setCaptionAsHtml(true);
    roleTableHintLabel.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The Associated Users/Groups table below displays the users/groups that are assigned the current role.");
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_TINY);
    roleTableHintLabel.addStyleName(ValoTheme.LABEL_LIGHT);
    gridLayout.addComponent(roleTableHintLabel, 0, 4, 1, 4);

    this.associatedPrincipalsTable = new Table();
    this.associatedPrincipalsTable.addItemClickListener(this.associatedPrincipalItemClickListener);
    this.associatedPrincipalsTable.addContainerProperty("Associated Users/Groups", String.class, null);
    this.associatedPrincipalsTable.addContainerProperty("", Button.class, null);
    this.associatedPrincipalsTable.setHeight("600px");
    this.associatedPrincipalsTable.setWidth("650px");

    gridLayout.addComponent(this.associatedPrincipalsTable, 0, 5, 1, 5);

    roleAdministrationPanel.setContent(gridLayout);
    layout.addComponent(roleAdministrationPanel);

    HorizontalLayout policyDropPanelLayout = new HorizontalLayout();
    policyDropPanelLayout.setMargin(true);
    policyDropPanelLayout.addComponent(this.policyDropPanel);
    policyDropPanelLayout.setSizeFull();

    HorizontalSplitPanel hsplit = new HorizontalSplitPanel();
    hsplit.setFirstComponent(layout);
    hsplit.setSecondComponent(policyDropPanelLayout);

    // Set the position of the splitter as percentage
    hsplit.setSplitPosition(65, Unit.PERCENTAGE);
    hsplit.setLocked(true);

    this.setContent(hsplit);
}

From source file:org.ikasan.dashboard.ui.administration.panel.UserDirectoriesPanel.java

License:BSD License

protected void init() {
    Label userDirectories = new Label("User Directories");
    userDirectories.setStyleName(ValoTheme.LABEL_HUGE);

    Label parapraphOne = new Label();
    parapraphOne.setCaptionAsHtml(true);
    parapraphOne.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The table below shows the user directories currently configured for Ikasan.");
    parapraphOne.addStyleName(ValoTheme.LABEL_TINY);
    parapraphOne.addStyleName(ValoTheme.LABEL_LIGHT);

    Label parapraphTwo = new Label();
    parapraphTwo.setCaptionAsHtml(true);
    parapraphTwo.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The order of the directory is the order in which it will be searched for users and groups."
            + " It is recommended that each user exists in a single directory.");
    parapraphTwo.addStyleName(ValoTheme.LABEL_TINY);
    parapraphTwo.addStyleName(ValoTheme.LABEL_LIGHT);

    this.mainLayout.setWidth("100%");
    this.mainLayout.setSpacing(true);

    this.mainLayout.addComponent(userDirectories);
    this.mainLayout.addComponent(parapraphOne);
    this.mainLayout.addComponent(parapraphTwo);

    Button newDirectoryButton = new Button("Add Directory");
    newDirectoryButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            final UserDirectoryManagementPanel authMethodPanel = new UserDirectoryManagementPanel(
                    new AuthenticationMethod(), securityService, authenticationProviderFactory, ldapService);

            Window window = new Window("Configure User Directory");
            window.setModal(true);//from   w  w  w .j  a  va2 s  .  com
            window.setHeight("90%");
            window.setWidth("90%");

            window.setContent(authMethodPanel);

            UI.getCurrent().addWindow(window);

            window.addCloseListener(new Window.CloseListener() {
                @Override
                public void windowClose(Window.CloseEvent e) {
                    populateAll();
                }
            });
        }
    });

    this.mainLayout.addComponent(newDirectoryButton);

    this.setWidth("100%");
    this.setHeight("100%");

    this.directoryTable = new Table();
    this.directoryTable.setWidth("100%");
    this.directoryTable.setHeight("600px");
    this.directoryTable.setCellStyleGenerator(new IkasanCellStyleGenerator());
    this.directoryTable.addContainerProperty("Directory Name", String.class, null);
    this.directoryTable.addContainerProperty("Type", String.class, null);
    this.directoryTable.addContainerProperty("Order", Layout.class, null);
    this.directoryTable.addContainerProperty("Operations", Layout.class, null);

    this.directoryTable.setColumnExpandRatio("Directory Name", 25);
    this.directoryTable.setColumnExpandRatio("Type", 25);

    this.directoryTable.setColumnAlignment("Order", Align.CENTER);
    this.directoryTable.setColumnExpandRatio("Order", 10);
    this.directoryTable.setColumnAlignment("Operations", Align.CENTER);
    this.directoryTable.setColumnWidth("Operations", 300);

    this.mainLayout.addComponent(this.directoryTable);

    this.mainLayout.setMargin(true);

    Panel wrapperPanel = new Panel();
    wrapperPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    wrapperPanel.setSizeFull();
    wrapperPanel.setContent(this.mainLayout);

    HorizontalLayout wrapperLayout = new HorizontalLayout();
    wrapperLayout.setSizeFull();
    wrapperLayout.setMargin(true);
    wrapperLayout.addComponent(wrapperPanel);

    this.setContent(wrapperLayout);
}

From source file:org.ikasan.dashboard.ui.administration.window.PolicyAssociationBusinessStreamSearchWindow.java

License:BSD License

private void createResultsPanel() {
    this.resultsPanel = new Panel();
    this.resultsPanel.setSizeFull();
    this.resultsPanel.setStyleName("dashboard");

    this.resultsTable = new Table();
    this.resultsTable.setSizeFull();
    this.resultsTable.addContainerProperty("Name", String.class, null);
    this.resultsTable.addContainerProperty("Description", String.class, null);

    this.resultsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override/* w  ww . j  ava 2  s  . c  om*/
        public void itemClick(ItemClickEvent itemClickEvent) {
            businessStream = (BusinessStream) itemClickEvent.getItemId();
            UI.getCurrent().removeWindow(PolicyAssociationBusinessStreamSearchWindow.this);
        }
    });

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(this.resultsTable);
    layout.setSizeFull();
    layout.setMargin(true);

    this.resultsPanel.setContent(layout);
}

From source file:org.ikasan.dashboard.ui.administration.window.PolicyAssociationFlowSearchWindow.java

License:BSD License

/**
  * Helper method to initialise this object.
  * //from   www. j  a  v a 2s  .  c o m
  * @param message
  */
protected void init() {
    this.setSizeFull();
    this.setModal(true);

    this.serverCombo = new ComboBox();
    this.moduleCombo = new ComboBox();

    this.createSearchPanel();
    this.createResultsPanel();

    VerticalLayout leftPanelLayout = new VerticalLayout();
    leftPanelLayout.setMargin(true);
    leftPanelLayout.setWidth(320, Unit.PIXELS);
    leftPanelLayout.setHeight("100%");
    leftPanelLayout.addComponent(this.searchPanel);

    HorizontalLayout rightPanelLayout = new HorizontalLayout();
    rightPanelLayout.setSizeFull();
    rightPanelLayout.setMargin(true);
    rightPanelLayout.addComponent(this.resultsPanel);

    this.horizontalSplitPanel = new HorizontalSplitPanel(leftPanelLayout, rightPanelLayout);
    this.horizontalSplitPanel.setSizeFull();
    this.horizontalSplitPanel.setSplitPosition(320, Unit.PIXELS);
    this.horizontalSplitPanel.setLocked(true);
    this.horizontalSplitPanel.addStyleName("ikasansplitpanel");
    this.setContent(horizontalSplitPanel);
}

From source file:org.ikasan.dashboard.ui.administration.window.PolicyAssociationFlowSearchWindow.java

License:BSD License

private void createResultsPanel() {
    this.resultsPanel = new Panel();
    this.resultsPanel.setSizeFull();
    this.resultsPanel.setStyleName("dashboard");

    this.resultsTable = new Table();
    this.resultsTable.setSizeFull();
    this.resultsTable.addContainerProperty("Server", String.class, null);
    this.resultsTable.addContainerProperty("Module", String.class, null);
    this.resultsTable.addContainerProperty("Flow", String.class, null);

    this.resultsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override//w w w . ja v a 2 s.  co  m
        public void itemClick(ItemClickEvent itemClickEvent) {
            flow = (Flow) itemClickEvent.getItemId();
            UI.getCurrent().removeWindow(PolicyAssociationFlowSearchWindow.this);
        }
    });

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(this.resultsTable);
    layout.setSizeFull();
    layout.setMargin(true);

    this.resultsPanel.setContent(layout);
}

From source file:org.ikasan.dashboard.ui.administration.window.PolicyAssociationModuleSearchWindow.java

License:BSD License

/**
  * Helper method to initialise this object.
  * //  w  w w.  j a  va2  s .c  o m
  * @param message
  */
protected void init() {
    this.setSizeFull();
    this.setModal(true);

    this.serverCombo = new ComboBox();

    this.createSearchPanel();
    this.createResultsPanel();

    VerticalLayout leftPanelLayout = new VerticalLayout();
    leftPanelLayout.setMargin(true);
    leftPanelLayout.setWidth(320, Unit.PIXELS);
    leftPanelLayout.setHeight("100%");
    leftPanelLayout.addComponent(this.searchPanel);

    HorizontalLayout rightPanelLayout = new HorizontalLayout();
    rightPanelLayout.setSizeFull();
    rightPanelLayout.setMargin(true);
    rightPanelLayout.addComponent(this.resultsPanel);

    this.horizontalSplitPanel = new HorizontalSplitPanel(leftPanelLayout, rightPanelLayout);
    this.horizontalSplitPanel.setSizeFull();
    this.horizontalSplitPanel.setSplitPosition(320, Unit.PIXELS);
    this.horizontalSplitPanel.setLocked(true);
    this.horizontalSplitPanel.addStyleName("ikasansplitpanel");
    this.setContent(horizontalSplitPanel);
}

From source file:org.ikasan.dashboard.ui.administration.window.PolicyAssociationModuleSearchWindow.java

License:BSD License

private void createResultsPanel() {
    this.resultsPanel = new Panel();
    this.resultsPanel.setSizeFull();
    this.resultsPanel.setStyleName("dashboard");

    this.resultsTable = new Table();
    this.resultsTable.setSizeFull();
    this.resultsTable.addContainerProperty("Server", String.class, null);
    this.resultsTable.addContainerProperty("Module", String.class, null);
    this.resultsTable.addContainerProperty("Flow", String.class, null);

    this.resultsTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
        @Override//from   w w  w  .j a v  a 2  s  .  com
        public void itemClick(ItemClickEvent itemClickEvent) {
            module = (Module) itemClickEvent.getItemId();
            UI.getCurrent().removeWindow(PolicyAssociationModuleSearchWindow.this);
        }
    });

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(this.resultsTable);
    layout.setSizeFull();
    layout.setMargin(true);

    this.resultsPanel.setContent(layout);
}

From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationSearchResultsPanel.java

License:BSD License

/**
 * Helper method to initialise this object.
 *//*from  w  w  w .  j  av  a 2 s .c om*/
@SuppressWarnings("serial")
protected void init() {
    this.addStyleName(ValoTheme.PANEL_BORDERLESS);

    final HorizontalLayout contentLayout = new HorizontalLayout();

    contentLayout.setSizeFull();
    contentLayout.setMargin(true);
    contentLayout.setSpacing(true);
    contentLayout.addComponent(this.searchResultsTable);
    this.setContent(contentLayout);
    this.setSizeFull();
}

From source file:org.ikasan.dashboard.ui.mappingconfiguration.panel.MappingConfigurationView.java

License:BSD License

/**
 * Helper method to initialise this object.
 *//*from  w  ww. j a v a 2  s  .c o  m*/
protected void init() {
    this.setSizeFull();

    HorizontalLayout topContainer = new HorizontalLayout();
    topContainer.setSizeFull();
    topContainer.setMargin(true);
    topContainer.addComponent(this.searchPanel);
    HorizontalLayout bottomContainer = new HorizontalLayout();
    bottomContainer.setMargin(true);
    bottomContainer.setSizeFull();
    bottomContainer.addComponent(this.viewComponentContainer);

    final Button hideFilterButton = new Button();
    hideFilterButton.setIcon(VaadinIcons.MINUS);
    hideFilterButton.setCaption("Hide Filter");
    hideFilterButton.setStyleName(ValoTheme.BUTTON_LINK);
    hideFilterButton.addStyleName(ValoTheme.BUTTON_SMALL);

    final Button showFilterButton = new Button();
    showFilterButton.setIcon(VaadinIcons.PLUS);
    showFilterButton.setCaption("Show Filter");
    showFilterButton.addStyleName(ValoTheme.BUTTON_LINK);
    showFilterButton.addStyleName(ValoTheme.BUTTON_SMALL);
    showFilterButton.setVisible(false);

    hideFilterButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            hideFilterButton.setVisible(false);
            showFilterButton.setVisible(true);
            splitPosition = verticalSplitPanel.getSplitPosition();
            splitUnit = verticalSplitPanel.getSplitPositionUnit();
            verticalSplitPanel.setSplitPosition(0, Unit.PIXELS);
        }
    });

    showFilterButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            hideFilterButton.setVisible(true);
            showFilterButton.setVisible(false);
            verticalSplitPanel.setSplitPosition(splitPosition, splitUnit);
        }
    });

    GridLayout filterButtonLayout = new GridLayout(2, 1);
    filterButtonLayout.setHeight(25, Unit.PIXELS);
    filterButtonLayout.addComponent(hideFilterButton, 0, 0);
    filterButtonLayout.addComponent(showFilterButton, 1, 0);

    this.verticalSplitPanel = new VerticalSplitPanel(topContainer, bottomContainer);
    this.verticalSplitPanel.addStyleName(ValoTheme.SPLITPANEL_LARGE);
    this.verticalSplitPanel.setSizeFull();
    this.verticalSplitPanel.setSplitPosition(260, Unit.PIXELS);

    GridLayout wrapper = new GridLayout(1, 2);
    wrapper.setRowExpandRatio(0, .01f);
    wrapper.setRowExpandRatio(1, .99f);
    wrapper.setSizeFull();
    wrapper.addComponent(filterButtonLayout);
    wrapper.setComponentAlignment(filterButtonLayout, Alignment.MIDDLE_RIGHT);
    wrapper.addComponent(verticalSplitPanel);

    this.setContent(wrapper);
}