Example usage for com.vaadin.ui GridLayout GridLayout

List of usage examples for com.vaadin.ui GridLayout GridLayout

Introduction

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

Prototype

public GridLayout(int columns, int rows) 

Source Link

Document

Constructor for a grid of given size (number of columns and rows).

Usage

From source file:org.ikasan.dashboard.ui.dashboard.panel.DashboardPanel.java

License:BSD License

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

    GridLayout gridLayout = new GridLayout(3, 2);
    gridLayout.setWidth("100%");
    gridLayout.setHeight("100%");
    gridLayout.setMargin(true);/*w ww  . j av a 2 s.  co  m*/

    VerticalLayout layout = new VerticalLayout();

    // Initialize the container as required by the container type
    container.addContainerProperty("Alert", String.class, null);
    container.addContainerProperty("Module", String.class, null);
    container.addContainerProperty("Details", PopupView.class, null);

    table.setContainerDataSource(container);
    table.setImmediate(true);
    table.addItemClickListener(new SearchResultTableItemClickListener());

    table.setHeight("100%");
    table.setWidth("100%");
    layout.setSizeFull();
    layout.addComponent(table);

    Panel p1 = new Panel("Alerts");
    p1.setStyleName("dashboard");
    p1.setWidth("90%");
    p1.setHeight("90%");
    p1.setContent(layout);

    gridLayout.addComponent(p1, 0, 0);

    Panel p2 = new Panel("Errors");
    p2.setStyleName("dashboard");
    p2.setWidth("90%");
    p2.setHeight("90%");

    gridLayout.addComponent(p2, 1, 0);

    VerticalLayout healthLayout = new VerticalLayout();

    // Initialize the container as required by the container type
    healthContainer.addContainerProperty("Health Alert", String.class, null);
    healthContainer.addContainerProperty("Module", String.class, null);

    healthTable.setContainerDataSource(healthContainer);
    healthTable.setImmediate(true);

    healthTable.setHeight("100%");
    healthTable.setWidth("100%");
    healthLayout.addComponent(healthTable);

    Panel p3 = new Panel("Health");
    p3.setStyleName("dashboard");
    p3.setWidth("90%");
    p3.setHeight("90%");
    p3.setContent(healthLayout);

    gridLayout.addComponent(p3, 2, 0);

    Panel p4 = new Panel("Topology");
    p4.setStyleName("dashboard");
    p4.setWidth("90%");
    p4.setHeight("90%");

    gridLayout.addComponent(p4, 0, 1);

    Panel p5 = new Panel("Dashboard Item 5");
    p5.setStyleName("dashboard");
    p5.setWidth("90%");
    p5.setHeight("90%");

    gridLayout.addComponent(p5, 1, 1);

    Panel p6 = new Panel("Dashboard Item 6");
    p6.setStyleName("dashboard");
    p6.setWidth("90%");
    p6.setHeight("90%");

    gridLayout.addComponent(p6, 2, 1);

    this.setContent(gridLayout);

    //        Broadcaster.register(this);
}

From source file:org.ikasan.dashboard.ui.framework.panel.ProfilePanel.java

License:BSD License

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

    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();/*from  w w w. j a  va2  s .  c om*/

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

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

    Label mappingConfigurationLabel = new Label("User Profile");
    mappingConfigurationLabel.setStyleName(ValoTheme.LABEL_HUGE);
    gridLayout.addComponent(mappingConfigurationLabel, 0, 0, 1, 0);

    Label usernameLabel = new Label("Username:");

    usernameField.setWidth("65%");

    firstName = new TextField();
    firstName.setWidth("65%");
    firstName.setNullRepresentation("");
    surname = new TextField();
    surname.setWidth("65%");
    surname.setNullRepresentation("");
    department.setWidth("65%");
    department.setNullRepresentation("");
    email.setWidth("65%");
    email.setNullRepresentation("");

    roleTable.addContainerProperty("Role", String.class, null);
    roleTable.addStyleName("ikasan");
    roleTable.addStyleName(ValoTheme.TABLE_SMALL);
    roleTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    roleTable.setHeight("520px");
    roleTable.setWidth("250px");

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

    formLayout.setColumnExpandRatio(0, .1f);
    formLayout.setColumnExpandRatio(1, .8f);

    usernameLabel.setSizeUndefined();
    formLayout.addComponent(usernameLabel, 0, 0);
    formLayout.setComponentAlignment(usernameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(usernameField, 1, 0);

    Label firstNameLabel = new Label("First name:");
    firstNameLabel.setSizeUndefined();
    formLayout.addComponent(firstNameLabel, 0, 1);
    formLayout.setComponentAlignment(firstNameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(firstName, 1, 1);

    Label surnameLabel = new Label("Surname:");
    surnameLabel.setSizeUndefined();
    formLayout.addComponent(surnameLabel, 0, 2);
    formLayout.setComponentAlignment(surnameLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(surname, 1, 2);

    Label departmentLabel = new Label("Department:");
    departmentLabel.setSizeUndefined();
    formLayout.addComponent(departmentLabel, 0, 3);
    formLayout.setComponentAlignment(departmentLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(department, 1, 3);

    Label emailLabel = new Label("Email address:");
    emailLabel.setSizeUndefined();
    formLayout.addComponent(emailLabel, 0, 4);
    formLayout.setComponentAlignment(emailLabel, Alignment.MIDDLE_RIGHT);
    formLayout.addComponent(email, 1, 4);

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

    Label rolesAndGroupsHintLabel1 = new Label();
    rolesAndGroupsHintLabel1.setCaptionAsHtml(true);
    rolesAndGroupsHintLabel1.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The Roles table below displays the Ikasan roles that the user has.");
    rolesAndGroupsHintLabel1.addStyleName(ValoTheme.LABEL_TINY);
    rolesAndGroupsHintLabel1.addStyleName(ValoTheme.LABEL_LIGHT);
    rolesAndGroupsHintLabel1.setWidth(300, Unit.PIXELS);
    gridLayout.addComponent(rolesAndGroupsHintLabel1, 0, 3, 1, 3);

    Label rolesAndGroupsHintLabel2 = new Label();
    rolesAndGroupsHintLabel2.setCaptionAsHtml(true);
    rolesAndGroupsHintLabel2.setCaption(VaadinIcons.QUESTION_CIRCLE_O.getHtml()
            + " The Groups table below displays all the LDAP groups that the user is a member of.");

    rolesAndGroupsHintLabel2.addStyleName(ValoTheme.LABEL_TINY);
    rolesAndGroupsHintLabel2.addStyleName(ValoTheme.LABEL_LIGHT);
    rolesAndGroupsHintLabel2.setWidth(300, Unit.PIXELS);
    gridLayout.addComponent(rolesAndGroupsHintLabel2, 0, 4, 1, 4);

    dashboadActivityTable.addContainerProperty("Action", String.class, null);
    dashboadActivityTable.addContainerProperty("Date/Time", String.class, null);
    dashboadActivityTable.addStyleName("ikasan");
    dashboadActivityTable.addStyleName(ValoTheme.TABLE_SMALL);
    dashboadActivityTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    dashboadActivityTable.setHeight("350px");
    dashboadActivityTable.setWidth("300px");

    this.permissionChangeTable.addContainerProperty("Action", String.class, null);
    this.permissionChangeTable.addContainerProperty("Date/Time", String.class, null);
    this.permissionChangeTable.addStyleName("ikasan");
    this.permissionChangeTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.permissionChangeTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    this.permissionChangeTable.setHeight("350px");
    this.permissionChangeTable.setWidth("300px");

    gridLayout.addComponent(roleTable, 0, 5);

    this.associatedPrincipalsTable.addContainerProperty("Groups", String.class, null);
    this.associatedPrincipalsTable.addItemClickListener(this.associatedPrincipalItemClickListener);
    this.associatedPrincipalsTable.addStyleName("ikasan");
    this.associatedPrincipalsTable.addStyleName(ValoTheme.TABLE_SMALL);
    this.associatedPrincipalsTable.setCellStyleGenerator(new IkasanSmallCellStyleGenerator());
    associatedPrincipalsTable.setHeight("520px");
    associatedPrincipalsTable.setWidth("400px");

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

    Panel roleMemberPanel = new Panel();

    roleMemberPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    roleMemberPanel.setHeight("100%");
    roleMemberPanel.setWidth("100%");

    GridLayout roleMemberLayout = new GridLayout();
    roleMemberLayout.setSpacing(true);
    roleMemberLayout.setWidth("100%");

    Label dashboardActivityLabel = new Label("Dashboard Activity");
    dashboardActivityLabel.setStyleName(ValoTheme.LABEL_HUGE);

    roleMemberLayout.addComponent(dashboardActivityLabel);
    roleMemberLayout.addComponent(this.dashboadActivityTable);

    Label permissionChangeLabel = new Label("User Security Changes");
    permissionChangeLabel.setStyleName(ValoTheme.LABEL_HUGE);

    roleMemberLayout.addComponent(permissionChangeLabel);
    roleMemberLayout.addComponent(this.permissionChangeTable);

    roleMemberPanel.setContent(roleMemberLayout);

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

    VerticalLayout roleMemberPanelLayout = new VerticalLayout();
    roleMemberPanelLayout.setWidth("100%");
    roleMemberPanelLayout.setHeight("100%");
    roleMemberPanelLayout.setMargin(true);
    roleMemberPanelLayout.addComponent(roleMemberPanel);
    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.framework.window.AdminPasswordDialog.java

License:BSD License

/**
 * Helper method to initialise this object.
 * /*w  w w .  j  a  v  a2  s . c om*/
 * @param userService
 * @param authProvider
 * @param visibilityGroup
 * @param userDetailsHelper
 * @param commitHandler
 */
protected void init() {
    super.setModal(true);
    super.setResizable(false);
    super.center();
    this.setWidth(300, Unit.PIXELS);
    this.setHeight(220, Unit.PIXELS);

    super.setClosable(false);

    GridLayout form = new GridLayout(2, 4);
    form.setColumnExpandRatio(0, .15f);
    form.setColumnExpandRatio(1, .85f);
    form.setWidth(100, Unit.PERCENTAGE);
    form.setMargin(true);
    form.setSpacing(true);

    Label newTypeLabel = new Label("Initial Administration Password");
    newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE);
    form.addComponent(newTypeLabel, 0, 0, 1, 0);

    Label passwordLabel = new Label("Password:");
    passwordLabel.setSizeUndefined();
    form.addComponent(passwordLabel, 0, 1);
    form.setComponentAlignment(passwordLabel, Alignment.MIDDLE_RIGHT);

    final PasswordField passwordField = new PasswordField();
    passwordField.addValidator(new StringLengthValidator("The username must not be empty", 1, null, true));
    passwordField.setValidationVisible(false);
    passwordField.setStyleName("ikasan");
    form.addComponent(passwordField, 1, 1);

    Label passwordConfirmLabel = new Label("Confirm Password:");
    passwordConfirmLabel.setSizeUndefined();
    form.addComponent(passwordConfirmLabel, 0, 2);
    form.setComponentAlignment(passwordConfirmLabel, Alignment.MIDDLE_RIGHT);

    final PasswordField passwordConfirmField = new PasswordField();
    passwordConfirmField.setStyleName("ikasan");
    passwordConfirmField
            .addValidator(new StringLengthValidator("The password must not be empty", 1, null, true));
    passwordConfirmField.setValidationVisible(false);
    form.addComponent(passwordConfirmField, 1, 2);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.addStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.setClickShortcut(KeyCode.ENTER);

    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                passwordField.validate();
                passwordConfirmField.validate();

                if (!passwordField.getValue().equals(passwordConfirmField.getValue())) {
                    Notification.show("Password and confirmation must be the same!", Type.ERROR_MESSAGE);

                    return;
                }
            } catch (InvalidValueException e) {
                passwordField.setValidationVisible(true);
                passwordConfirmField.setValidationVisible(true);
                return;
            }

            password = passwordField.getValue();

            passwordField.setValue("");
            passwordConfirmField.setValue("");
            close();

        }
    });
    buttons.addComponent(saveButton);

    form.addComponent(buttons, 0, 3, 1, 3);
    form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);

    this.setContent(form);
}

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

License:BSD License

/**
 * Helper method to initialise this object.
 * /*from ww w  . j  a  v  a 2  s  .c o m*/
 * @param userService
 * @param authProvider
 * @param visibilityGroup
 * @param userDetailsHelper
 * @param commitHandler
 */
protected void init(AuthenticationService authenticationService, VisibilityGroup visibilityGroup,
        final NavigationPanel commitHandler) {
    super.setModal(true);
    super.setResizable(false);
    super.center();
    this.setWidth(300, Unit.PIXELS);
    this.setHeight(200, Unit.PIXELS);

    PropertysetItem item = new PropertysetItem();
    item.addItemProperty(LoginFieldGroup.USERNAME, new ObjectProperty<String>(""));
    item.addItemProperty(LoginFieldGroup.PASSWORD, new ObjectProperty<String>(""));

    GridLayout form = new GridLayout(2, 4);
    form.setColumnExpandRatio(0, .15f);
    form.setColumnExpandRatio(1, .85f);
    form.setWidth(100, Unit.PERCENTAGE);
    form.setMargin(true);
    form.setSpacing(true);

    Label newTypeLabel = new Label("Login");
    newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE);
    form.addComponent(newTypeLabel, 0, 0, 1, 0);

    Label usernameLabel = new Label("Username:");
    usernameLabel.setSizeUndefined();
    form.addComponent(usernameLabel, 0, 1);
    form.setComponentAlignment(usernameLabel, Alignment.MIDDLE_RIGHT);

    final TextField userNameField = new TextField();
    userNameField.addValidator(new StringLengthValidator("The username must not be empty", 1, null, true));
    userNameField.setValidationVisible(false);
    userNameField.setStyleName("ikasan");
    form.addComponent(userNameField, 1, 1);

    Label passwordLabel = new Label("Password:");
    passwordLabel.setSizeUndefined();
    form.addComponent(passwordLabel, 0, 2);
    form.setComponentAlignment(passwordLabel, Alignment.MIDDLE_RIGHT);

    final PasswordField passwordField = new PasswordField();
    passwordField.setStyleName("ikasan");
    passwordField.addValidator(new StringLengthValidator("The password must not be empty", 1, null, true));
    passwordField.setValidationVisible(false);
    form.addComponent(passwordField, 1, 2);

    final LoginFieldGroup binder = new LoginFieldGroup(item, visibilityGroup, authenticationService);
    binder.bind(userNameField, LoginFieldGroup.USERNAME);
    binder.bind(passwordField, LoginFieldGroup.PASSWORD);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);

    Button loginButton = new Button("Login");
    loginButton.addStyleName(ValoTheme.BUTTON_SMALL);
    loginButton.setClickShortcut(KeyCode.ENTER);

    loginButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                userNameField.validate();
                passwordField.validate();
            } catch (InvalidValueException e) {
                userNameField.setValidationVisible(true);
                passwordField.setValidationVisible(true);
                return;
            }

            try {
                binder.commit();
                userNameField.setValue("");
                passwordField.setValue("");
                close();
                commitHandler.postCommit();
            } catch (CommitException e) {
                Notification.show(e.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    });
    buttons.addComponent(loginButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
            binder.discard();
        }
    });
    buttons.addComponent(cancelButton);

    form.addComponent(buttons, 0, 3, 1, 3);
    form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);

    this.setContent(form);
}

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

License:BSD License

/**
 * Helper method to initialise this object.
 *//*from ww w . ja  va2 s  .co m*/
@SuppressWarnings("serial")
protected void init() {
    layout = new GridLayout(5, 6);
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setWidth("100%");

    this.addStyleName(ValoTheme.PANEL_BORDERLESS);

    paramQueriesLayout = new VerticalLayout();

    toolBarLayout = new HorizontalLayout();
    toolBarLayout.setWidth("100%");

    Button linkButton = new Button();

    linkButton.setIcon(VaadinIcons.REPLY_ALL);
    linkButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    linkButton.setDescription("Return to search results");
    linkButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    linkButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            Navigator navigator = new Navigator(UI.getCurrent(), menuLayout.getContentContainer());

            for (IkasanUIView view : topLevelNavigator.getIkasanViews()) {
                navigator.addView(view.getPath(), view.getView());
            }

            saveRequiredMonitor.manageSaveRequired("mappingView");

            navigator = new Navigator(UI.getCurrent(), mappingNavigator.getContainer());

            for (IkasanUIView view : mappingNavigator.getIkasanViews()) {
                navigator.addView(view.getPath(), view.getView());
            }
        }
    });

    toolBarLayout.addComponent(linkButton);
    toolBarLayout.setExpandRatio(linkButton, 0.865f);

    this.editButton.setIcon(VaadinIcons.EDIT);
    this.editButton.setDescription("Edit the mapping configuration");
    this.editButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.editButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.editButton.setVisible(false);
    this.editButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            setEditable(true);
            mappingConfigurationFunctionalGroup.editButtonPressed();
        }
    });

    toolBarLayout.addComponent(this.editButton);
    toolBarLayout.setExpandRatio(this.editButton, 0.045f);

    this.saveButton.setIcon(VaadinIcons.HARDDRIVE);
    this.saveButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.saveButton.setDescription("Save the mapping configuration");
    this.saveButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.saveButton.setVisible(false);
    this.saveButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            try {
                logger.info("Save button clicked!!");
                save();
                setEditable(false);
                Notification.show("Changes Saved!", "", Notification.Type.HUMANIZED_MESSAGE);
                mappingConfigurationFunctionalGroup.saveOrCancelButtonPressed();
            } catch (InvalidValueException e) {
                // We can ignore this one as we have already dealt with the
                // validation messages using the validation framework.
            } catch (Exception e) {
                StringWriter sw = new StringWriter();
                PrintWriter pw = new PrintWriter(sw);
                e.printStackTrace(pw);

                Notification.show("Cauget exception trying to save a Mapping Configuration!", sw.toString(),
                        Notification.Type.ERROR_MESSAGE);
            }
        }
    });

    toolBarLayout.addComponent(this.saveButton);
    toolBarLayout.setExpandRatio(this.saveButton, 0.045f);

    this.cancelButton.setIcon(VaadinIcons.CLOSE_CIRCLE);
    this.cancelButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.cancelButton.setDescription("Cancel the current edit");
    this.cancelButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    this.cancelButton.setVisible(false);
    this.cancelButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            setEditable(false);
            mappingConfigurationFunctionalGroup.saveOrCancelButtonPressed();

            Navigator navigator = new Navigator(UI.getCurrent(), menuLayout.getContentContainer());

            for (IkasanUIView view : topLevelNavigator.getIkasanViews()) {
                navigator.addView(view.getPath(), view.getView());
            }

            saveRequiredMonitor.manageSaveRequired("mappingView");

            navigator = new Navigator(UI.getCurrent(), mappingNavigator.getContainer());

            for (IkasanUIView view : mappingNavigator.getIkasanViews()) {
                navigator.addView(view.getPath(), view.getView());
            }
        }
    });

    toolBarLayout.addComponent(this.cancelButton);
    toolBarLayout.setExpandRatio(this.cancelButton, 0.045f);

    FileDownloader fd = new FileDownloader(this.getMappingConfigurationExportStream());
    fd.extend(exportMappingConfigurationButton);

    this.exportMappingConfigurationButton.setIcon(VaadinIcons.DOWNLOAD_ALT);
    this.exportMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.exportMappingConfigurationButton.setDescription("Export the current mapping configuration");
    this.exportMappingConfigurationButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    toolBarLayout.addComponent(this.exportMappingConfigurationButton);
    toolBarLayout.setExpandRatio(this.exportMappingConfigurationButton, 0.045f);

    final GridLayout contentLayout = new GridLayout(1, 2);
    contentLayout.setWidth("100%");

    contentLayout.addComponent(toolBarLayout);
    contentLayout.addComponent(createMappingConfigurationForm());

    VerticalSplitPanel vpanel = new VerticalSplitPanel(contentLayout, createTableLayout(false));
    vpanel.setStyleName(ValoTheme.SPLITPANEL_LARGE);

    paramQueriesLayout.setSpacing(true);

    Label configValueLabels = new Label("Source Configuration Value Queries:");
    layout.addComponent(configValueLabels, 2, 2, 3, 2);
    Panel queryParamsPanel = new Panel();
    queryParamsPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    queryParamsPanel.setHeight(100, Unit.PIXELS);
    queryParamsPanel.setWidth(100, Unit.PERCENTAGE);
    queryParamsPanel.setContent(paramQueriesLayout);
    this.layout.addComponent(queryParamsPanel, 2, 3, 3, 5);

    vpanel.setSplitPosition(325, Unit.PIXELS);
    this.setContent(vpanel);
    this.setSizeFull();
}

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

License:BSD License

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

    final Label typeLabel = new Label("Type:");
    final Label sourceContextLabel = new Label("Source Context:");
    final Label targetContextLabel = new Label("Target Context:");

    final GridLayout contentLayout = new GridLayout(4, 6);
    contentLayout.setColumnExpandRatio(0, .15f);
    contentLayout.setColumnExpandRatio(1, .35f);
    contentLayout.setColumnExpandRatio(2, .05f);
    contentLayout.setColumnExpandRatio(3, .45f);
    contentLayout.setWidth("100%");
    contentLayout.setSpacing(true);

    Label errorOccurrenceDetailsLabel = new Label("Mapping Configuration Search");
    errorOccurrenceDetailsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    contentLayout.addComponent(errorOccurrenceDetailsLabel, 0, 0, 1, 0);

    Label clientLabel = new Label("Client:");
    clientLabel.setSizeUndefined();
    contentLayout.addComponent(clientLabel, 0, 1);
    contentLayout.setComponentAlignment(clientLabel, Alignment.MIDDLE_RIGHT);

    this.clientComboBox.setWidth(80, Unit.PERCENTAGE);
    this.clientComboBox.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            if (event.getProperty() != null && event.getProperty().getValue() != null) {
                typeComboBox.refresh(((ConfigurationServiceClient) event.getProperty().getValue()).getName());
                sourceContextComboBox
                        .refresh(((ConfigurationServiceClient) event.getProperty().getValue()).getName(), null);
                targetContextComboBox.refresh(
                        ((ConfigurationServiceClient) event.getProperty().getValue()).getName(), null, null);

                typeLabel.setVisible(true);
                typeComboBox.setVisible(true);
            }
        }
    });
    contentLayout.addComponent(clientComboBox, 1, 1);

    typeLabel.setSizeUndefined();
    contentLayout.addComponent(typeLabel, 0, 2);
    contentLayout.setComponentAlignment(typeLabel, Alignment.MIDDLE_RIGHT);
    typeLabel.setVisible(false);

    this.typeComboBox.setWidth(80, Unit.PERCENTAGE);
    this.typeComboBox.setVisible(false);
    this.typeComboBox.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            String client = null;

            if (clientComboBox.getValue() != null) {
                client = ((ConfigurationServiceClient) clientComboBox.getValue()).getName();
            }

            if (event.getProperty() != null && event.getProperty().getValue() != null) {
                sourceContextComboBox.refresh(client,
                        ((ConfigurationType) event.getProperty().getValue()).getName());
                targetContextComboBox.refresh(client,
                        ((ConfigurationType) event.getProperty().getValue()).getName(), null);

                sourceContextLabel.setVisible(true);
                sourceContextComboBox.setVisible(true);
            }
        }
    });
    contentLayout.addComponent(this.typeComboBox, 1, 2);

    sourceContextLabel.setSizeUndefined();
    contentLayout.addComponent(sourceContextLabel, 0, 3);
    contentLayout.setComponentAlignment(sourceContextLabel, Alignment.MIDDLE_RIGHT);
    sourceContextLabel.setVisible(false);

    this.sourceContextComboBox.setWidth(80, Unit.PERCENTAGE);
    this.sourceContextComboBox.setVisible(false);
    this.sourceContextComboBox.addValueChangeListener(new ValueChangeListener() {
        public void valueChange(ValueChangeEvent event) {
            String type = null;
            String client = null;

            if (typeComboBox.getValue() != null) {
                type = ((ConfigurationType) typeComboBox.getValue()).getName();
            }

            if (clientComboBox.getValue() != null) {
                client = ((ConfigurationServiceClient) clientComboBox.getValue()).getName();
            }

            if (event.getProperty() != null && event.getProperty().getValue() != null) {
                targetContextComboBox.refresh(client, type,
                        ((ConfigurationContext) event.getProperty().getValue()).getName());

                targetContextLabel.setVisible(true);
                targetContextComboBox.setVisible(true);
            }
        }
    });
    contentLayout.addComponent(this.sourceContextComboBox, 1, 3);

    targetContextLabel.setSizeUndefined();
    contentLayout.addComponent(targetContextLabel, 0, 4);
    contentLayout.setComponentAlignment(targetContextLabel, Alignment.MIDDLE_RIGHT);
    targetContextLabel.setVisible(false);

    this.targetContextComboBox.setWidth(80, Unit.PERCENTAGE);
    this.targetContextComboBox.setVisible(false);
    contentLayout.addComponent(this.targetContextComboBox, 1, 4);

    Label actionsLabel = newActions.getActionsLabel();
    actionsLabel.setStyleName(ValoTheme.LABEL_HUGE);
    contentLayout.addComponent(actionsLabel, 2, 0, 3, 0);

    Label createNewClientLabel = newActions.getNewClientLabel();
    createNewClientLabel.setSizeUndefined();
    contentLayout.addComponent(createNewClientLabel, 2, 1);
    contentLayout.setComponentAlignment(createNewClientLabel, Alignment.MIDDLE_RIGHT);
    contentLayout.addComponent(newActions.getNewClientButton(), 3, 1);
    contentLayout.setComponentAlignment(newActions.getNewClientButton(), Alignment.MIDDLE_LEFT);

    Label createNewTypeLabel = newActions.getNewTypeLabel();
    createNewTypeLabel.setSizeUndefined();
    contentLayout.addComponent(createNewTypeLabel, 2, 2);
    contentLayout.setComponentAlignment(createNewTypeLabel, Alignment.MIDDLE_RIGHT);
    contentLayout.addComponent(newActions.getNewTypeButton(), 3, 2);
    contentLayout.setComponentAlignment(newActions.getNewTypeButton(), Alignment.MIDDLE_LEFT);

    Label createContextTypeLabel = newActions.getNewContextLabel();
    createContextTypeLabel.setSizeUndefined();
    contentLayout.addComponent(createContextTypeLabel, 2, 3);
    contentLayout.setComponentAlignment(createContextTypeLabel, Alignment.MIDDLE_RIGHT);
    contentLayout.addComponent(newActions.getNewContextButton(), 3, 3);
    contentLayout.setComponentAlignment(newActions.getNewContextButton(), Alignment.MIDDLE_LEFT);

    Label createMappingConfigurationLabel = newActions.getNewMappingConfigurationLabel();
    createMappingConfigurationLabel.setSizeUndefined();
    contentLayout.addComponent(createMappingConfigurationLabel, 2, 4);
    contentLayout.setComponentAlignment(createMappingConfigurationLabel, Alignment.MIDDLE_RIGHT);
    contentLayout.addComponent(newActions.getNewMappingConfigurationButton(), 3, 4);
    contentLayout.setComponentAlignment(newActions.getNewMappingConfigurationButton(), Alignment.MIDDLE_LEFT);

    Label importMappingConfigurationLabel = newActions.getImportMappingConfigurationLabel();
    importMappingConfigurationLabel.setSizeUndefined();
    contentLayout.addComponent(importMappingConfigurationLabel, 2, 5);
    contentLayout.setComponentAlignment(importMappingConfigurationLabel, Alignment.MIDDLE_RIGHT);
    contentLayout.addComponent(newActions.getImportMappingConfigurationButton(), 3, 5);
    contentLayout.setComponentAlignment(newActions.getImportMappingConfigurationButton(),
            Alignment.MIDDLE_LEFT);

    Button button = new Button("Search");
    button.setStyleName(ValoTheme.BUTTON_SMALL);
    button.addClickListener(searchButtonClickListener);

    contentLayout.addComponent(button, 1, 5);

    this.setContent(contentLayout);
}

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

License:BSD License

/**
 * Helper method to initialise this object.
 */// w ww  .  ja v a2s  . 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);
}

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

License:BSD License

/**
 * Helper method to initialise this object.
 */// w  ww  .  j a  v  a  2 s .  co  m
@SuppressWarnings("serial")
protected void init() {
    layout = new GridLayout(5, 6);
    layout.setSpacing(true);
    layout.setMargin(true);
    layout.setWidth("100%");

    this.addStyleName(ValoTheme.PANEL_BORDERLESS);

    this.parameterQueryTextFields = new ArrayList<TextField>();

    this.typeComboBox.setReadOnly(false);
    this.clientComboBox.setReadOnly(false);
    this.sourceContextComboBox.setReadOnly(false);
    this.targetContextComboBox.setReadOnly(false);
    super.clientComboBox.unselect(super.clientComboBox.getValue());
    super.sourceContextComboBox.unselect(super.sourceContextComboBox.getValue());
    super.targetContextComboBox.unselect(super.targetContextComboBox.getValue());
    super.typeComboBox.unselect(super.typeComboBox.getValue());

    super.mappingConfigurationFunctionalGroup.editButtonPressed();

    super.mappingConfiguration = new MappingConfiguration();
    this.mappingConfigurationConfigurationValuesTable.populateTable(mappingConfiguration);

    HorizontalLayout toolBarLayout = new HorizontalLayout();
    toolBarLayout.setWidth("100%");

    Label spacerLabel = new Label("");
    toolBarLayout.addComponent(spacerLabel);
    toolBarLayout.setExpandRatio(spacerLabel, 0.865f);

    this.editButton.setIcon(VaadinIcons.EDIT);
    this.editButton.setDescription("Edit the mapping configuration");
    this.editButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.editButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(editButton);
    toolBarLayout.setExpandRatio(editButton, 0.045f);

    this.saveButton.setIcon(VaadinIcons.HARDDRIVE);
    this.saveButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.saveButton.setDescription("Save the mapping configuration");
    this.saveButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(saveButton);
    toolBarLayout.setExpandRatio(saveButton, 0.045f);

    this.cancelButton.setIcon(VaadinIcons.CLOSE_CIRCLE);
    this.cancelButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    this.cancelButton.setDescription("Cancel the current edit");
    this.cancelButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    toolBarLayout.addComponent(this.cancelButton);
    toolBarLayout.setExpandRatio(this.cancelButton, 0.045f);

    final VerticalLayout contentLayout = new VerticalLayout();

    contentLayout.addComponent(toolBarLayout);
    contentLayout.addComponent(createMappingConfigurationForm());

    VerticalSplitPanel vpanel = new VerticalSplitPanel(contentLayout, createTableLayout(false));
    vpanel.setStyleName(ValoTheme.SPLITPANEL_LARGE);

    Button addParametersButton = new Button();
    addParametersButton.setIcon(VaadinIcons.FORM);
    addParametersButton.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    addParametersButton.setDescription(
            "Add new key location queries. The number of fields created corresponds to the number of query parameters.");
    addParametersButton.addStyleName(ValoTheme.BUTTON_BORDERLESS);

    addParametersButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            addParamQueryFields();
        }
    });

    paramQueriesLayout.removeAllComponents();
    //        paramQueriesLayout.addComponent(addParametersButton);
    paramQueriesLayout.setSpacing(true);

    Label configValueLabels = new Label("Source Configuration Value Queries:");
    layout.addComponent(configValueLabels, 2, 2);
    layout.addComponent(addParametersButton, 3, 2);

    Panel queryParamsPanel = new Panel();
    queryParamsPanel.addStyleName(ValoTheme.PANEL_BORDERLESS);
    queryParamsPanel.setHeight(140, Unit.PIXELS);
    queryParamsPanel.setWidth(100, Unit.PERCENTAGE);
    queryParamsPanel.setContent(paramQueriesLayout);
    this.layout.addComponent(queryParamsPanel, 2, 3, 3, 5);

    vpanel.setSplitPosition(325, Unit.PIXELS);
    this.setContent(vpanel);
    this.setSizeFull();

}

From source file:org.ikasan.dashboard.ui.mappingconfiguration.window.NewClientWindow.java

License:BSD License

/**
 * Helper method to initialise this object.
 *///  w  w w. j av a 2  s .c o  m
protected void init() {
    this.setStyleName("dashboard");
    this.setModal(true);
    this.setWidth(800, Unit.PIXELS);
    this.setHeight(180, Unit.PIXELS);

    PropertysetItem item = new PropertysetItem();
    item.addItemProperty(NewClientFieldGroup.NAME, new ObjectProperty<String>(""));
    item.addItemProperty(NewClientFieldGroup.KEY_LOCATION_QUERY_PROCESSOR_TYPE, new ObjectProperty<String>(
            "org.ikasan.mapping.keyQueryProcessor.impl.XPathKeyLocationQueryProcessor"));

    GridLayout form = new GridLayout(2, 4);
    form.setWidth(100, Unit.PERCENTAGE);
    form.setMargin(true);
    form.setSpacing(true);

    Label newClientLabel = new Label("New Mapping Configuration Client");
    newClientLabel.setStyleName(ValoTheme.LABEL_HUGE);
    form.addComponent(newClientLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    form.addComponent(nameLabel, 0, 1);
    form.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);

    nameField.addValidator(new StringLengthValidator("The name must not be blank!", 1, 256, true));
    nameField.setValidationVisible(false);
    nameField.setStyleName("ikasan");
    form.addComponent(nameField, 1, 1);

    Label keyLocationLabel = new Label("Key Location Query Processor Type:");
    keyLocationLabel.setSizeUndefined();
    form.addComponent(keyLocationLabel, 0, 2);
    form.setComponentAlignment(keyLocationLabel, Alignment.MIDDLE_RIGHT);

    TextField keyLocationQueryProcessorTypeField = new TextField();
    keyLocationQueryProcessorTypeField.setStyleName("ikasan");
    keyLocationQueryProcessorTypeField.setWidth(500, Unit.PIXELS);
    form.addComponent(keyLocationQueryProcessorTypeField, 1, 2);

    final NewClientFieldGroup binder = new NewClientFieldGroup(item, this.refreshGroup,
            this.mappingConfigurationService, this.systemEventService);
    binder.bind(nameField, "name");
    binder.bind(keyLocationQueryProcessorTypeField, "keyLocationQueryProcessorType");

    keyLocationQueryProcessorTypeField.setReadOnly(true);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.setStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                nameField.validate();
            } catch (InvalidValueException e) {
                nameField.setValidationVisible(true);
                return;
            }

            try {
                binder.commit();
                UI.getCurrent().getNavigator().navigateTo("emptyPanel");

                nameField.setValue("");

                Notification.show("New Mapping Configuration Client Successfully Created!");
                saveRequiredMonitor.setSaveRequired(false);

                close();
            } catch (CommitException e) {
                Notification.show("An error has occurred saving a new client: " + e.getMessage());
            }
        }
    });
    buttons.addComponent(saveButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo("emptyPanel");
            binder.discard();
            saveRequiredMonitor.setSaveRequired(false);

            close();
        }
    });
    buttons.addComponent(cancelButton);

    form.addComponent(buttons, 0, 3, 1, 3);
    form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
    this.setContent(form);
}

From source file:org.ikasan.dashboard.ui.mappingconfiguration.window.NewMappingConfigurationContextWindow.java

License:BSD License

/**
 * Helper method to initialise this object.
 *///from  www. j  a va 2 s .  c o  m
protected void init() {
    this.setStyleName("dashboard");
    this.setModal(true);
    this.setWidth(500, Unit.PIXELS);
    this.setHeight(250, Unit.PIXELS);

    PropertysetItem item = new PropertysetItem();
    item.addItemProperty(NewContextFieldGroup.NAME, new ObjectProperty<String>(""));
    item.addItemProperty(NewContextFieldGroup.DESCRIPTION, new ObjectProperty<String>(""));

    GridLayout form = new GridLayout(2, 4);
    form.setColumnExpandRatio(0, .15f);
    form.setColumnExpandRatio(1, .85f);
    form.setWidth(100, Unit.PERCENTAGE);
    form.setMargin(true);
    form.setSpacing(true);

    Label newTypeLabel = new Label("New Mapping Configuration Context");
    newTypeLabel.setStyleName(ValoTheme.LABEL_HUGE);
    form.addComponent(newTypeLabel, 0, 0, 1, 0);

    Label nameLabel = new Label("Name:");
    nameLabel.setSizeUndefined();
    form.addComponent(nameLabel, 0, 1);
    form.setComponentAlignment(nameLabel, Alignment.MIDDLE_RIGHT);

    nameField.setStyleName("ikasan");
    nameField.addValidator(new StringLengthValidator("The name must not be blank!", 1, 256, true));
    nameField.setValidationVisible(false);
    nameField.setWidth(70, Unit.PERCENTAGE);
    form.addComponent(nameField, 1, 1);

    Label descriptionLabel = new Label("Description:");
    descriptionLabel.setSizeUndefined();
    form.addComponent(descriptionLabel, 0, 2);
    form.setComponentAlignment(descriptionLabel, Alignment.TOP_RIGHT);

    descriptionField.setStyleName("ikasan");
    descriptionField
            .addValidator(new StringLengthValidator("The description must not be blank!", 1, 256, true));
    descriptionField.setValidationVisible(false);
    descriptionField.setWidth(90, Unit.PERCENTAGE);
    descriptionField.setRows(5);

    form.addComponent(descriptionField, 1, 2);

    final NewContextFieldGroup binder = new NewContextFieldGroup(item, this.refreshGroup,
            this.mappingConfigurationService, this.systemEventService);
    binder.bind(nameField, NewContextFieldGroup.NAME);
    binder.bind(descriptionField, NewContextFieldGroup.DESCRIPTION);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);

    Button saveButton = new Button("Save");
    saveButton.setStyleName(ValoTheme.BUTTON_SMALL);
    saveButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            try {
                nameField.validate();
                descriptionField.validate();
            } catch (InvalidValueException e) {
                nameField.setValidationVisible(true);
                descriptionField.setValidationVisible(true);
                return;
            }

            try {
                binder.commit();
                UI.getCurrent().getNavigator().navigateTo("emptyPanel");
                nameField.setValue("");
                descriptionField.setValue("");
                Notification.show("New Mapping Configuration Context Successfully Created!");
                saveRequiredMonitor.setSaveRequired(false);

                close();
            } catch (CommitException e) {
                Notification.show("An error occurred saving a new context! " + e.getMessage(),
                        Type.ERROR_MESSAGE);
            }
        }
    });
    buttons.addComponent(saveButton);

    Button cancelButton = new Button("Cancel");
    cancelButton.setStyleName(ValoTheme.BUTTON_SMALL);
    cancelButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().getNavigator().navigateTo("emptyPanel");
            binder.discard();
            saveRequiredMonitor.setSaveRequired(false);

            close();
        }
    });
    buttons.addComponent(cancelButton);

    form.addComponent(buttons, 0, 3, 1, 3);
    form.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);

    this.setContent(form);
}