Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

List of usage examples for com.vaadin.ui VerticalLayout setComponentAlignment

Introduction

In this page you can find the example usage for com.vaadin.ui VerticalLayout setComponentAlignment.

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

From source file:org.escidoc.browser.ui.UserGroupView.java

License:Open Source License

private void addOrgUnitTable(VerticalLayout layout) {
    selectorTable = new Table();
    selectorTable.setWidth("60%");
    selectorTable.setPageLength(7);//from www  .ja v a 2 s .  c o m
    selectorTable.setSelectable(true);
    selectorTable.setImmediate(true);
    selectorTable.setColumnReorderingAllowed(true);

    final BeanItemContainer<ResourceModel> dataSource;
    dataSource = populateContainerTable();

    selectorTable.setContainerDataSource(dataSource);
    selectorTable.setVisibleColumns(new String[] { PropertyId.NAME, (String) PropertyId.ID });
    selectorTable.addActionHandler(new Action.Handler() {

        @Override
        public Action[] getActions(@SuppressWarnings("unused") Object target,
                @SuppressWarnings("unused") Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, @SuppressWarnings("unused") Object sender, Object target) {
            if (action.equals(ACTION_ADD)) {
                // mainWindow.addWindow(new OrganizationSelectionView(repositories, resourceProxy, nameField,
                // mainWindow, dataSource).modalWindow());
                openViewAddRemoveOUs();
            } else {
                try {
                    repositories.group().removeOrganization(resourceProxy.getId(),
                            ((ResourceModel) target).getId());
                    selectorTable.removeItem(target);
                    mainWindow.showNotification(
                            "Organization with the id " + resourceProxy.getId() + " is removed from the group.",
                            Window.Notification.TYPE_TRAY_NOTIFICATION);
                } catch (EscidocClientException e) {
                    mainWindow.showNotification("Error removing organizationunit: ", e.getMessage(),
                            Window.Notification.TYPE_ERROR_MESSAGE);

                }
            }
        }

        private void openViewAddRemoveOUs() {
            final Window subwindow = new Window("A modal subwindow");
            subwindow.setModal(true);
            subwindow.setWidth("650px");
            VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);

            try {
                subwindow.addComponent(new AddOrgUnitstoGroup(router, resourceProxy, controller));
            } catch (EscidocClientException e) {
                controller.showError(e);
            }
            Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                @Override
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    subwindow.getParent().removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            router.getMainWindow().addWindow(subwindow);

        }
    });
    layout.addComponent(selectorTable);

}

From source file:org.escidoc.browser.ui.view.helpers.DragnDropHelper.java

License:Open Source License

protected void createDragComponents() throws EscidocClientException {
    tree = new Tree();
    table = new Table("Drag from table to tree");
    table.setWidth("100%");
    tableDelete = new Table();

    initializeTree(new SourceIs(table));
    initializeTable(new SourceIs(tree));

    Panel pn = new Panel();
    pn.setHeight("100%");
    VerticalLayout vlTree = new VerticalLayout();
    vlTree.addComponent(new Label("Drag from Tree to Table to add new OU"));

    vlTree.addComponent(tf);/*from  w  w  w . jav a2 s. c  om*/
    vlTree.addComponent(tree);

    HorizontalLayout hl = new HorizontalLayout();
    pn.setContent(vlTree);
    hl.addComponent(pn);

    VerticalLayout vl = new VerticalLayout();
    vl.setWidth("100%");
    hl.addComponent(vl);
    vl.addComponent(table);

    if (canRemoveOperation()) {
        initializeDeleteTable(new SourceIs(table));
        vl.addComponent(tableDelete);
        vl.setComponentAlignment(tableDelete, Alignment.TOP_RIGHT);
    }
    addComponent(hl);

}

From source file:org.escidoc.browser.ui.view.helpers.OrganizationalUnitsTableVH.java

License:Open Source License

@Override
protected void addActionLists() {
    // if (contextController.canUpdateContext()) {
    table.addActionHandler(new Action.Handler() {
        @Override/*from  w ww  .j  a v a2 s. co m*/
        public Action[] getActions(Object target, Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if ((ACTION_DELETE == action) && (target != null)) {
                confirmActionWindow(target);
            } else {
                openViewAddRemoveOUs();
            }

        }

        private void openViewAddRemoveOUs() {
            final Window subwindow = new Window("A modal subwindow");
            subwindow.setModal(true);
            subwindow.setWidth("650px");
            VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);

            try {
                subwindow.addComponent(new AddOrgUnitstoContext(router, resourceProxy, controller,
                        resourceProxy.getOrganizationalUnit()));
            } catch (EscidocClientException e) {
                controller.showError(e);
            }
            Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                @Override
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    subwindow.getParent().removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            router.getMainWindow().addWindow(subwindow);
        }
    });
    // }
}

From source file:org.escidoc.browser.ui.view.helpers.OUParentTableVH.java

License:Open Source License

@Override
protected void addActionLists() {
    table.addActionHandler(new Action.Handler() {
        @Override//from w ww.java  2s.  c  om
        public Action[] getActions(Object target, Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if ((ACTION_DELETE == action) && (target != null)) {
                confirmActionWindow(target);
            } else {
                openViewAddRemoveOUs();
            }

        }

        private void openViewAddRemoveOUs() {
            final Window subwindow = new Window("A modal subwindow");
            subwindow.setModal(true);
            subwindow.setWidth("650px");
            VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);

            try {
                subwindow.addComponent(new OrgUnitParentEditView(orgUnitProxy, orgUnitProxy.getParentList(),
                        router, controller));
            } catch (EscidocClientException e) {
                controller.showError(e);
            }
            Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                @Override
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    subwindow.getParent().removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            router.getMainWindow().addWindow(subwindow);
        }
    });

}

From source file:org.fatal1t.finbe.ui.views.SimpleLoginView.java

@Autowired
public SimpleLoginView(LoginService service, AuthenticationService authenticationService1) {
    setSizeFull();/*w w  w  . j  a v a 2  s .c o m*/

    this.loginService = service;
    this.authenticationService = authenticationService1;
    // Create login & registration button and add them to separate component
    loginButton = new Button("Login");
    registerButton = new Button("Register");
    buttons = new HorizontalLayout(loginButton, registerButton);
    // Create the user input field
    user = new TextField("User:");
    user.setWidth("300px");
    user.setRequired(true);
    user.setInputPrompt("Your username (eg. joe@email.com)");
    user.setValue("test");
    //user.addValidator(new EmailValidator(
    //        "Username must be an email address"));
    //user.setInvalidAllowed(false);

    // Create the password input field
    password = new PasswordField("Password:");
    password.setWidth("300px");
    //password.addValidator(new PasswordValidator());
    password.setRequired(true);
    password.setValue("123456");
    password.setNullRepresentation("");

    //add listeners and shortcuts
    this.loginButton.addClickListener(e -> this.loginButtonClick(e));
    this.loginButton.setClickShortcut(ShortcutAction.KeyCode.ENTER);
    this.registerButton.addClickListener(e -> {
        System.out.println("Pozadavek na registraci");
        this.getUI().getNavigator().navigateTo(RegistrationView.NAME);

    });

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(user, password, buttons);
    fields.setCaption("Please login to access the application. (test@test.com/passw0rd)");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, true));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);

    setCompositionRoot(viewLayout);

}

From source file:org.icrisat.gdms.ui.GDMSMain.java

void buildMainView() {
    _mainLayout.setSizeFull();//from  w w  w  .  j av a 2s.co  m

    _lblLoginMessage = new Label("");
    _lblLoginMessage.setStyleName(Reindeer.LABEL_H2);

    HorizontalLayout topMenuLayout = getTopMenu();
    CssLayout headerImageLayout = getHeader();

    VerticalLayout topLayout = new VerticalLayout();
    topLayout.addComponent(headerImageLayout);
    topLayout.addComponent(topMenuLayout);
    topLayout.setComponentAlignment(topMenuLayout, Alignment.TOP_RIGHT);
    topLayout.addComponent(_lblLoginMessage);
    topLayout.setComponentAlignment(_lblLoginMessage, Alignment.TOP_RIGHT);
    topLayout.setMargin(false, true, true, true);
    _mainLayout.addComponent(topLayout);

    CssLayout mainCSSLayout = new CssLayout();
    mainCSSLayout.setMargin(false, true, true, true);
    mainCSSLayout.setSizeFull();

    _tabsheet = new TabSheet();
    _tabsheet.setSizeFull();

    mainCSSLayout.addComponent(_tabsheet);
    _mainLayout.addComponent(mainCSSLayout);
    _mainLayout.setExpandRatio(mainCSSLayout, 1);

    buildWelcomeScreen = buildWelcomeScreen();
    buildAboutScreen = buildAboutScreen();
    buildUploadDataWindow = new UploadComponent(this);
    buildUploadDataWindow.setImmediate(true);
    buildUploadDataWindow.setEnabled(false);
    buildUploadDataWindow.addListener(this);
    buildUploadDataWindow.setWidth("100%");

    buildRetrieveWindow = new RetrieveComponent(this);
    buildRetrieveWindow.setImmediate(true);
    buildRetrieveWindow.setEnabled(false);
    buildRetrieveWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    buildDeleteWindow = new DeleteComponent(this);
    buildDeleteWindow.setImmediate(true);
    buildDeleteWindow.setEnabled(false);
    buildDeleteWindow.addListener(this);
    buildRetrieveWindow.setWidth("100%");

    _tabsheet.addComponent(buildWelcomeScreen);
    _tabsheet.addComponent(buildAboutScreen);
    _tabsheet.addComponent(buildUploadDataWindow);
    _tabsheet.addComponent(buildRetrieveWindow);
    _tabsheet.addComponent(buildDeleteWindow);

    /*if (null == _gdmsModel.getLoggedInUser()){
       buildUploadDataWindow.setEnabled(false);
       buildRetrieveWindow.setEnabled(false);
       buildDeleteWindow.setEnabled(false);
    } else {
       buildUploadDataWindow.setEnabled(true);
       buildRetrieveWindow.setEnabled(true);
       buildDeleteWindow.setEnabled(true);
    }*/

    if (null == _gdmsModel.getLoggedInUser()) {
        _tabsheet.getTab(1).setEnabled(false);
        _tabsheet.getTab(2).setEnabled(false);
        _tabsheet.getTab(3).setEnabled(false);
    } else {
        _tabsheet.getTab(1).setEnabled(true);
        _tabsheet.getTab(2).setEnabled(true);
        _tabsheet.getTab(3).setEnabled(true);
    }

    _tabsheet.addListener(new SelectedTabChangeListener() {

        private static final long serialVersionUID = 1L;

        public void selectedTabChange(SelectedTabChangeEvent event) {
            User loggedInUser = _gdmsModel.getLoggedInUser();
            //System.out.println("loggedInUser:"+loggedInUser);
            if (null == loggedInUser) {
                if (!(buildWelcomeScreen == _tabsheet.getSelectedTab())) {
                    getMainWindow().showNotification("Please login inorder to Upload, Retrieve or Delete data.",
                            Notification.TYPE_HUMANIZED_MESSAGE);
                    return;
                }
            } else {
                if (event.getTabSheet().getSelectedTab().getCaption() == "Upload") {
                    updateUploadTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "Retrieve") {
                    updateRetrieveTabComponent();
                } else if (event.getTabSheet().getSelectedTab().getCaption() == "View") {
                    updateDeleteTabComponent();
                }
            }

        }

    });

    CssLayout bottomPanelLayout = getBottomPanelLayout();
    VerticalLayout bottomContactLayout = new VerticalLayout();
    bottomContactLayout.addComponent(bottomPanelLayout);
    bottomContactLayout.setComponentAlignment(bottomPanelLayout, Alignment.BOTTOM_LEFT);
    bottomContactLayout.setMargin(false, true, false, true);
}

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

License:BSD License

protected void init() {
    this.setWidth("100%");
    this.setHeight("100%");

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);/*w  ww.j  av a  2  s .  c o m*/

    Panel securityAdministrationPanel = new Panel();
    securityAdministrationPanel.setStyleName("dashboard");
    securityAdministrationPanel.setWidth("100%");
    securityAdministrationPanel.setHeight("100%");

    GridLayout gridLayout = new GridLayout(2, 25);
    gridLayout.setSpacing(true);
    gridLayout.setWidth("100%");
    gridLayout.setHeight("100%");
    gridLayout.setMargin(true);
    gridLayout.setColumnExpandRatio(0, 0.3f);
    gridLayout.setColumnExpandRatio(1, 0.7f);

    authenticationMethodCombo.addItem(LOCAL_AUTHENTICATION);
    authenticationMethodCombo.setItemCaption(LOCAL_AUTHENTICATION, LOCAL_AUTHENTICATION.getCaption());
    authenticationMethodCombo.addItem(LDAP_LOCAL_AUTHENTICATION);
    authenticationMethodCombo.setItemCaption(LDAP_LOCAL_AUTHENTICATION, LDAP_LOCAL_AUTHENTICATION.getCaption());
    authenticationMethodCombo.addItem(LDAP_AUTHENTICATION);
    authenticationMethodCombo.setItemCaption(LDAP_AUTHENTICATION, LDAP_AUTHENTICATION.getCaption());

    authenticationMethodDropdownValuesMap.put(LOCAL_AUTHENTICATION.getValue(), LOCAL_AUTHENTICATION);
    authenticationMethodDropdownValuesMap.put(LDAP_LOCAL_AUTHENTICATION.getValue(), LDAP_LOCAL_AUTHENTICATION);
    authenticationMethodDropdownValuesMap.put(LDAP_AUTHENTICATION.getValue(), LDAP_AUTHENTICATION);

    final Label serverSettings = new Label("Server Settings");
    serverSettings.setStyleName("large-bold");

    gridLayout.addComponent(serverSettings, 0, 0);

    final Label directoryNameLabel = new Label("Directory Name:");
    directoryNameLabel.setSizeUndefined();
    this.directoryName = new TextField();
    this.directoryName.setWidth("400px");
    this.directoryName.setRequired(true);

    gridLayout.addComponent(directoryNameLabel, 0, 1);
    gridLayout.addComponent(this.directoryName, 1, 1);
    gridLayout.setComponentAlignment(directoryNameLabel, Alignment.MIDDLE_RIGHT);

    final Label ldapServerUrlLabel = new Label("LDAP Server URL:");
    ldapServerUrlLabel.setSizeUndefined();
    this.ldapServerUrl = new TextField();
    this.ldapServerUrl.setWidth("400px");

    gridLayout.addComponent(ldapServerUrlLabel, 0, 2);
    gridLayout.addComponent(this.ldapServerUrl, 1, 2);
    this.ldapServerUrl.setRequired(true);
    gridLayout.setComponentAlignment(ldapServerUrlLabel, Alignment.MIDDLE_RIGHT);

    Label hostnameExample = new Label("Hostname of server running LDAP. Example: ldap://ldap.example.com:389");
    gridLayout.addComponent(hostnameExample, 1, 3);

    final Label ldapBindUserDnLabel = new Label("Username:");
    ldapBindUserDnLabel.setSizeUndefined();
    this.ldapBindUserDn = new TextField();
    this.ldapBindUserDn.setWidth("400px");
    this.ldapBindUserDn.setRequired(true);

    gridLayout.addComponent(ldapBindUserDnLabel, 0, 4);
    gridLayout.addComponent(this.ldapBindUserDn, 1, 4);
    gridLayout.setComponentAlignment(ldapBindUserDnLabel, Alignment.MIDDLE_RIGHT);

    Label usernameExample = new Label("User to log into LDAP. Example: cn=user,DC=domain,DC=name");
    gridLayout.addComponent(usernameExample, 1, 5);

    final Label ldapBindUserPasswordLabel = new Label("Password:");
    ldapBindUserPasswordLabel.setSizeUndefined();
    this.ldapBindUserPassword = new PasswordField();
    this.ldapBindUserPassword.setWidth("100px");
    this.ldapBindUserPassword.setRequired(true);

    gridLayout.addComponent(ldapBindUserPasswordLabel, 0, 6);
    gridLayout.addComponent(this.ldapBindUserPassword, 1, 6);
    gridLayout.setComponentAlignment(ldapBindUserPasswordLabel, Alignment.MIDDLE_RIGHT);

    final Label ldapSchema = new Label("LDAP Schema");
    ldapSchema.setStyleName("large-bold");

    gridLayout.addComponent(ldapSchema, 0, 7);

    final Label ldapUserSearchDnLabel = new Label("User DN:");
    ldapUserSearchDnLabel.setSizeUndefined();
    this.ldapUserSearchDn = new TextField();
    this.ldapUserSearchDn.setRequired(true);
    this.ldapUserSearchDn.setWidth("400px");

    gridLayout.addComponent(ldapUserSearchDnLabel, 0, 8);
    gridLayout.setComponentAlignment(ldapUserSearchDnLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.ldapUserSearchDn, 1, 8);

    Label userDnExample = new Label("The base DN to use when searching for users.");
    gridLayout.addComponent(userDnExample, 1, 9);

    final Label applicationSecurityBaseDnLabel = new Label("Group DN:");
    applicationSecurityBaseDnLabel.setSizeUndefined();
    this.applicationSecurityBaseDn = new TextField();
    this.applicationSecurityBaseDn.setRequired(true);
    this.applicationSecurityBaseDn.setWidth("400px");
    gridLayout.addComponent(applicationSecurityBaseDnLabel, 0, 10);
    gridLayout.setComponentAlignment(applicationSecurityBaseDnLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.applicationSecurityBaseDn, 1, 10);

    Label groupDnExample = new Label("The base DN to use when searching for groups.");
    gridLayout.addComponent(groupDnExample, 1, 11);

    final Label ldapAttributes = new Label("LDAP Attributes");
    ldapAttributes.setStyleName("large-bold");

    CheckBox checkbox = new CheckBox("Populate default attributes");
    checkbox.setValue(false);

    checkbox.addValueChangeListener(new Property.ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            boolean value = (Boolean) event.getProperty().getValue();

            if (value == true) {
                ldapUserSearchFilter.setValue(LDAP_USER_SEARCH_FILTER);
                emailAttributeName.setValue(EMAIL_ATTRIBUTE_NAME);
                userAccountNameAttributeName.setValue(USER_ACCOUNT_NAME_ATTRIBUTE_NAME);
                accountTypeAttributeName.setValue(ACCOUNT_TYPE_ATTRIBUTE_NAME);
                firstNameAttributeName.setValue(FIRST_NAME_ATTRIBUTE_NAME);
                surnameAttributeName.setValue(SURNAME_ATTRIBUTE_NAME);
                departmentAttributeName.setValue(DEPARTMENT_ATTRIBUTE_NAME);
                ldapUserDescriptionAttributeName.setValue(LDAP_USER_DESCRIPTION_ATTRIBUTE_NAME);
                memberofAttributeName.setValue(MEMBER_OF_ATTRIBUTE_NAME);
                applicationSecurityGroupAttributeName.setValue(APPLICATION_SECURITY_GROUP_ATTRIBUTE_NAME);
                applicationSecurityDescriptionAttributeName
                        .setValue(APPLICATION_SECURITY_DESCRIPTION_ATTRIBUTE_NAME);
            } else {
                ldapUserSearchFilter.setValue("");
                emailAttributeName.setValue("");
                userAccountNameAttributeName.setValue("");
                accountTypeAttributeName.setValue("");
                firstNameAttributeName.setValue("");
                surnameAttributeName.setValue("");
                departmentAttributeName.setValue("");
                ldapUserDescriptionAttributeName.setValue("");
                memberofAttributeName.setValue("");
                applicationSecurityGroupAttributeName.setValue("");
                applicationSecurityDescriptionAttributeName.setValue("");
            }
        }
    });
    checkbox.setImmediate(true);

    gridLayout.addComponent(ldapAttributes, 0, 12);
    gridLayout.addComponent(checkbox, 1, 12);

    final Label userSearchFieldLabel = new Label("User Search Filter:");
    userSearchFieldLabel.setSizeUndefined();
    this.ldapUserSearchFilter = new TextField();
    this.ldapUserSearchFilter.setWidth("300px");
    this.ldapUserSearchFilter.setRequired(true);

    gridLayout.addComponent(userSearchFieldLabel, 0, 13);
    gridLayout.setComponentAlignment(userSearchFieldLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.ldapUserSearchFilter, 1, 13);

    final Label emailAttributeNameLabel = new Label("Email:");
    emailAttributeNameLabel.setSizeUndefined();
    this.emailAttributeName = new TextField();
    this.emailAttributeName.setWidth("300px");
    this.emailAttributeName.setRequired(true);

    gridLayout.addComponent(emailAttributeNameLabel, 0, 14);
    gridLayout.setComponentAlignment(emailAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.emailAttributeName, 1, 14);

    final Label userAccountNameAttributeNameLabel = new Label("Account Name:");
    userAccountNameAttributeNameLabel.setSizeUndefined();
    this.userAccountNameAttributeName = new TextField();
    this.userAccountNameAttributeName.setWidth("300px");
    this.userAccountNameAttributeName.setRequired(true);

    gridLayout.addComponent(userAccountNameAttributeNameLabel, 0, 15);
    gridLayout.setComponentAlignment(userAccountNameAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.userAccountNameAttributeName, 1, 15);

    final Label accountTypeAttributeNameLabel = new Label("Account Type:");
    accountTypeAttributeNameLabel.setSizeUndefined();
    this.accountTypeAttributeName = new TextField();
    this.accountTypeAttributeName.setWidth("300px");
    this.accountTypeAttributeName.setRequired(true);

    gridLayout.addComponent(accountTypeAttributeNameLabel, 0, 16);
    gridLayout.setComponentAlignment(accountTypeAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.accountTypeAttributeName, 1, 16);

    final Label firstNameAttributeNameLabel = new Label("First Name:");
    firstNameAttributeNameLabel.setSizeUndefined();
    this.firstNameAttributeName = new TextField();
    this.firstNameAttributeName.setWidth("300px");
    this.firstNameAttributeName.setRequired(true);

    gridLayout.addComponent(firstNameAttributeNameLabel, 0, 17);
    gridLayout.setComponentAlignment(firstNameAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.firstNameAttributeName, 1, 17);

    final Label surnameAttributeNameLabel = new Label("Surname:");
    surnameAttributeNameLabel.setSizeUndefined();
    this.surnameAttributeName = new TextField();
    this.surnameAttributeName.setWidth("300px");
    this.surnameAttributeName.setRequired(true);

    gridLayout.addComponent(surnameAttributeNameLabel, 0, 18);
    gridLayout.setComponentAlignment(surnameAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.surnameAttributeName, 1, 18);

    final Label departmentAttributeNameLabel = new Label("User Department:");
    departmentAttributeNameLabel.setSizeUndefined();
    this.departmentAttributeName = new TextField();
    this.departmentAttributeName.setWidth("300px");
    this.departmentAttributeName.setRequired(true);

    gridLayout.addComponent(departmentAttributeNameLabel, 0, 19);
    gridLayout.setComponentAlignment(departmentAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.departmentAttributeName, 1, 19);

    final Label ldapUserDescriptionAttributeNameLabel = new Label("User Description:");
    ldapUserDescriptionAttributeNameLabel.setSizeUndefined();
    this.ldapUserDescriptionAttributeName = new TextField();
    this.ldapUserDescriptionAttributeName.setWidth("300px");
    this.ldapUserDescriptionAttributeName.setRequired(true);

    gridLayout.addComponent(ldapUserDescriptionAttributeNameLabel, 0, 20);
    gridLayout.setComponentAlignment(ldapUserDescriptionAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.ldapUserDescriptionAttributeName, 1, 20);

    final Label memberOfAttributeNameLabel = new Label("Member Of:");
    memberOfAttributeNameLabel.setSizeUndefined();
    this.memberofAttributeName = new TextField();
    this.memberofAttributeName.setWidth("300px");
    this.memberofAttributeName.setRequired(true);

    gridLayout.addComponent(memberOfAttributeNameLabel, 0, 21);
    gridLayout.setComponentAlignment(memberOfAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.memberofAttributeName, 1, 21);

    final Label applicationSecurityGroupAttributeNameLabel = new Label("Group Name:");
    applicationSecurityGroupAttributeNameLabel.setSizeUndefined();
    this.applicationSecurityGroupAttributeName = new TextField();
    this.applicationSecurityGroupAttributeName.setWidth("300px");
    this.applicationSecurityGroupAttributeName.setRequired(true);

    gridLayout.addComponent(applicationSecurityGroupAttributeNameLabel, 0, 22);
    gridLayout.setComponentAlignment(applicationSecurityGroupAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.applicationSecurityGroupAttributeName, 1, 22);

    final Label applicationSecurityAttributeNameLabel = new Label("Group Description:");
    applicationSecurityAttributeNameLabel.setSizeUndefined();
    this.applicationSecurityDescriptionAttributeName = new TextField();
    this.applicationSecurityDescriptionAttributeName.setWidth("300px");
    this.applicationSecurityDescriptionAttributeName.setRequired(true);

    gridLayout.addComponent(applicationSecurityAttributeNameLabel, 0, 23);
    gridLayout.setComponentAlignment(applicationSecurityAttributeNameLabel, Alignment.MIDDLE_RIGHT);
    gridLayout.addComponent(this.applicationSecurityDescriptionAttributeName, 1, 23);

    final BeanItem<AuthenticationMethod> authenticationMethodItem = new BeanItem<AuthenticationMethod>(
            authenticationMethod);

    this.directoryName.setPropertyDataSource(authenticationMethodItem.getItemProperty("name"));
    this.ldapServerUrl.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapServerUrl"));
    this.ldapBindUserDn.setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserDn"));
    this.ldapBindUserPassword
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapBindUserPassword"));
    this.ldapUserSearchDn
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchBaseDn"));
    this.ldapUserSearchFilter
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("ldapUserSearchFilter"));
    this.emailAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("emailAttributeName"));
    this.userAccountNameAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("userAccountNameAttributeName"));
    this.accountTypeAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("accountTypeAttributeName"));
    this.applicationSecurityBaseDn
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("applicationSecurityBaseDn"));
    this.applicationSecurityGroupAttributeName.setPropertyDataSource(
            authenticationMethodItem.getItemProperty("applicationSecurityGroupAttributeName"));
    this.departmentAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("departmentAttributeName"));
    this.firstNameAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("firstNameAttributeName"));
    this.surnameAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("surnameAttributeName"));
    this.ldapUserDescriptionAttributeName.setPropertyDataSource(
            authenticationMethodItem.getItemProperty("ldapUserDescriptionAttributeName"));
    this.applicationSecurityDescriptionAttributeName.setPropertyDataSource(
            authenticationMethodItem.getItemProperty("applicationSecurityDescriptionAttributeName"));
    this.memberofAttributeName
            .setPropertyDataSource(authenticationMethodItem.getItemProperty("memberofAttributeName"));

    Button saveButton = new Button("Save");
    saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                logger.info("saving auth method: " + authenticationMethod);
                authenticationMethod.setMethod(SecurityConstants.AUTH_METHOD_LDAP);

                if (authenticationMethod.getOrder() == null) {
                    authenticationMethod.setOrder(securityService.getNumberOfAuthenticationMethods() + 1);
                }

                securityService.saveOrUpdateAuthenticationMethod(authenticationMethod);
            } catch (RuntimeException e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Error trying to save the authentication method!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);

                return;
            }

            Notification.show("Saved!");
        }
    });

    GridLayout buttonLayout = new GridLayout(1, 1);
    buttonLayout.setWidth("200px");
    buttonLayout.setHeight("20px");
    buttonLayout.addComponent(saveButton);

    gridLayout.addComponent(buttonLayout, 0, 24, 1, 24);

    VerticalLayout wrapperLayout = new VerticalLayout();
    wrapperLayout.addComponent(gridLayout);
    wrapperLayout.setComponentAlignment(gridLayout, Alignment.TOP_CENTER);

    securityAdministrationPanel.setContent(wrapperLayout);
    layout.addComponent(securityAdministrationPanel);
    this.setContent(layout);
}

From source file:org.ikasan.dashboard.ui.framework.window.ProgressBarWindow.java

License:BSD License

protected void init() {
    this.setModal(true);
    this.setWidth("15%");
    this.setHeight("15%");

    ProgressBar progressBar = new ProgressBar();
    progressBar.setIndeterminate(true);/*from w  w w.j a v a  2s. c  o m*/
    progressBar.setEnabled(true);

    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(progressBar);
    layout.setComponentAlignment(progressBar, Alignment.MIDDLE_CENTER);

    this.setContent(layout);
}

From source file:org.investovator.ui.nngaming.QuoteUI.java

License:Open Source License

private void setupUI() {

    //Trade Button
    tradeButton = new Button("Place Order");
    tradeButton.addClickListener(tradeButtonClickListener);
    tradeButton.setWidth("100%");

    //Price Layout
    price = new TextField("Price");
    price.addValueChangeListener(priceValueChangedListener);
    price.setImmediate(true);/*w  ww  . j a  va  2  s . c om*/
    price.setWidth("100%");

    amount = new Label();
    amount.setCaption("Amount");
    amount.addStyleName("outlined");
    amount.setWidth("100%");

    stocks = new TextField("Stocks");
    stocks.addValueChangeListener(stocksChangedListener);
    stocks.setImmediate(true);
    stocks.setWidth("100%");

    //Stock Select
    stockSelect = new ComboBox();
    stockSelect.setCaption("Select stock to trade");
    stockSelect.setNullSelectionAllowed(false);
    stockSelect.setImmediate(true);
    stockSelect.setWidth("100%");
    stockSelect.addValueChangeListener(selectSymbolValueChange);

    VerticalLayout column1 = new VerticalLayout();
    column1.setSpacing(true);
    column1.setWidth("100%");
    column1.addComponent(stockSelect);
    column1.setComponentAlignment(stockSelect, Alignment.MIDDLE_LEFT);
    column1.addComponent(price);
    column1.setComponentAlignment(price, Alignment.MIDDLE_LEFT);
    column1.addComponent(amount);
    column1.setComponentAlignment(amount, Alignment.MIDDLE_LEFT);

    //Side Select
    sideSelect = new ComboBox("Select Order Type");
    sideSelect.addItem("Buy Order");
    sideSelect.addItem("Sell Order");
    sideSelect.select("Buy Order");
    isBuy = true;
    sideSelect.setNullSelectionAllowed(false);
    sideSelect.addValueChangeListener(sideSelectValueChangeListener);
    sideSelect.setImmediate(true);
    sideSelect.setWidth("100%");

    VerticalLayout column2 = new VerticalLayout();

    column2.setSpacing(true);
    column2.setWidth("100%");
    column2.addComponent(sideSelect);
    column2.setComponentAlignment(sideSelect, Alignment.MIDDLE_RIGHT);
    column2.addComponent(stocks);
    column2.setComponentAlignment(stocks, Alignment.MIDDLE_RIGHT);
    column2.addComponent(tradeButton);
    column2.setComponentAlignment(tradeButton, Alignment.BOTTOM_RIGHT);

    HorizontalLayout layout = new HorizontalLayout();
    layout.addComponent(column1);
    layout.addComponent(column2);
    layout.setSpacing(true);

    this.addComponent(layout);
    this.setComponentAlignment(layout, Alignment.MIDDLE_RIGHT);
    this.setSpacing(true);
    this.setMargin(new MarginInfo(false, false, false, true));
    this.setImmediate(true);
    this.setWidth("100%");

}

From source file:org.investovator.ui.utils.dashboard.dataplayback.BasicMainView.java

License:Open Source License

private Component setupBuySellForm() {
    VerticalLayout formContent = new VerticalLayout();

    FormLayout form = new FormLayout();

    //account balance
    this.accBalance = new Label("");
    this.accBalance.setCaption("Account Balance");

    //stocks list
    final ComboBox stocksList = new ComboBox();
    stocksList.setCaption("Stock");
    stocksList.setNullSelectionAllowed(false);
    for (String stock : DataPlaybackEngineStates.playingSymbols) {
        stocksList.addItem(stock);/*from www .  j  a v a2s .c o m*/
    }
    //stocksList.setWidth("75%");

    //side
    final NativeSelect orderSide = new NativeSelect();
    orderSide.setCaption("Side");
    orderSide.addItem(OrderType.BUY);
    orderSide.addItem(OrderType.SELL);
    //orderSide.setWidth("90%");
    orderSide.setSizeFull();
    orderSide.select(OrderType.BUY);
    orderSide.setNullSelectionAllowed(false);
    orderSide.setImmediate(true);

    //Quantity
    final TextField quantity = new TextField("Amount");
    //quantity.setWidth("75%");

    form.addComponent(accBalance);
    form.addComponent(stocksList);
    form.addComponent(orderSide);
    form.addComponent(quantity);

    formContent.addComponent(form);

    HorizontalLayout bBar = getBuySellForumButtons(stocksList, quantity, orderSide);
    formContent.addComponent(bBar);
    formContent.setComponentAlignment(bBar, Alignment.BOTTOM_RIGHT);
    //content.setComponentAlignment(nextDayB, Alignment.MIDDLE_CENTER);

    return formContent;
}