Example usage for com.vaadin.ui Alignment TOP_RIGHT

List of usage examples for com.vaadin.ui Alignment TOP_RIGHT

Introduction

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

Prototype

Alignment TOP_RIGHT

To view the source code for com.vaadin.ui Alignment TOP_RIGHT.

Click Source Link

Usage

From source file:org.escidoc.browser.ui.listeners.OnContextAdminDescriptor.java

License:Open Source License

@SuppressWarnings("serial")
public void adminDescriptorForm() {
    final Window subwindow = new Window("A modal subwindow");
    subwindow.setModal(true);//from   www.j a  va2  s .c  o m
    subwindow.setWidth("650px");
    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    final TextField txtName = new TextField("Name");
    txtName.setImmediate(true);
    txtName.setValidationVisible(true);
    final TextArea txtContent = new TextArea("Content");
    txtContent.setColumns(30);
    txtContent.setRows(40);

    Button addAdmDescButton = new Button("Add Description");
    addAdmDescButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {

            if (txtName.getValue().toString() == null) {
                router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME,
                        Notification.TYPE_ERROR_MESSAGE);
            } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) {
                router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED,
                        Notification.TYPE_ERROR_MESSAGE);
            } else {
                AdminDescriptor newAdmDesc = controller.addAdminDescriptor(txtName.getValue().toString(),
                        txtContent.getValue().toString());
                (subwindow.getParent()).removeWindow(subwindow);
                router.getMainWindow().showNotification("Addedd Successfully",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }
        }
    });

    subwindow.addComponent(txtName);
    subwindow.addComponent(txtContent);
    subwindow.addComponent(addAdmDescButton);

    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.listeners.OnContextAdminDescriptor.java

License:Open Source License

/**
 * Editing since it has a parameter/*w w  w .ja  v a  2 s . c o  m*/
 * 
 * @param adminDescriptor
 */
public void adminDescriptorForm(AdminDescriptor adminDescriptor) {

    // Editing
    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);

    final TextField txtName = new TextField("Name");
    txtName.setValue(adminDescriptor.getName());
    txtName.setImmediate(true);
    txtName.setValidationVisible(true);
    final TextArea txtContent = new TextArea("Content");
    txtContent.setColumns(30);
    txtContent.setRows(40);
    try {
        txtContent.setValue(adminDescriptor.getContentAsString());
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    txtContent.setColumns(30);

    Button addAdmDescButton = new Button("Add Description");
    addAdmDescButton.addListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {

            if (txtName.getValue().toString() == null) {
                router.getMainWindow().showNotification(ViewConstants.PLEASE_ENTER_A_NAME,
                        Notification.TYPE_ERROR_MESSAGE);

            } else if (!XmlUtil.isWellFormed(txtContent.getValue().toString())) {
                router.getMainWindow().showNotification(ViewConstants.XML_IS_NOT_WELL_FORMED,
                        Notification.TYPE_ERROR_MESSAGE);
            } else {
                controller.addAdminDescriptor(txtName.getValue().toString(), txtContent.getValue().toString());
                (subwindow.getParent()).removeWindow(subwindow);
                router.getMainWindow().showNotification("Addedd Successfully",
                        Notification.TYPE_HUMANIZED_MESSAGE);
            }
        }
    });

    subwindow.addComponent(txtName);
    subwindow.addComponent(txtContent);
    subwindow.addComponent(addAdmDescButton);

    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.maincontent.ContainerMetadataRecordsView.java

License:Open Source License

@SuppressWarnings("serial")
private Panel lblAddtionalResources() {
    final Panel pnl = new Panel();
    pnl.setSizeFull();//from  w  w  w  .j  ava 2s .com
    VerticalLayout hl = new VerticalLayout();
    hl.setSizeFull();
    final Button btnVersionHistoryContainer = new Button("Container Version History",
            new VersionHistoryClickListener(resourceProxy, mainWindow, repositories));
    btnVersionHistoryContainer.setStyleName(BaseTheme.BUTTON_LINK);
    btnVersionHistoryContainer.setDescription("Show Version history in a Pop-up");

    final CssLayout cssLayout = new CssLayout();
    buildPanelHeader(cssLayout, "Additional Resources");
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    final Button addResourceButton = new Button();
    addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
    addResourceButton.addStyleName("floatright paddingtop3");
    addResourceButton.setWidth("20px");
    addResourceButton.setIcon(ICON);
    addResourceButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            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);

            subwindow.addComponent(new Label("Not yet implemented"));
            Button close = new Button("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);

        }

    });
    cssLayout.addComponent(addResourceButton);
    hl.addComponent(cssLayout);

    hl.addComponent(btnVersionHistoryContainer);
    pnl.setContent(hl);
    return pnl;
}

From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java

License:Open Source License

@SuppressWarnings("serial")
private Panel buildOrganizationUnit() {
    final Panel pnlOrgUnit = new Panel();
    pnlOrgUnit.setSizeFull();/*  www. j  a  v a2 s.c om*/
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

    final CssLayout cssLayout = new CssLayout();
    buildPanelHeader(cssLayout, ViewConstants.ORGANIZATIONAL_UNIT);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (contextController.canAddOUs()) {
        final Button addResourceButton = new Button();
        addResourceButton.setStyleName(BaseTheme.BUTTON_LINK);
        addResourceButton.addStyleName("floatright paddingtop3");
        addResourceButton.setWidth("20px");
        addResourceButton.setIcon(ICON);
        addResourceButton.addListener(new ClickListener() {

            @Override
            public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) {
                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, contextController,
                            resourceProxy.getOrganizationalUnit()));
                } catch (EscidocClientException e) {
                    contextController.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);

            }

        });
        cssLayout.addComponent(addResourceButton);
    }
    vl.addComponent(cssLayout);

    OrganizationalUnitsTableVH orgUnitTable = new OrganizationalUnitsTableVH(contextController,
            resourceProxy.getOrganizationalUnit(), router, resourceProxy);
    orgUnitTable.buildTable();
    vl.addComponent(orgUnitTable);
    vl.setComponentAlignment(orgUnitTable, Alignment.TOP_LEFT);
    vl.setExpandRatio(orgUnitTable, 9f);

    pnlOrgUnit.setContent(vl);
    return pnlOrgUnit;
}

From source file:org.escidoc.browser.ui.maincontent.FolderView.java

License:Open Source License

private VerticalLayout buildVlContentPanel() {
    // common part: create layout
    vlContentPanel = new VerticalLayout();
    vlContentPanel.setImmediate(false);/* w  ww. j  a va  2  s  . c  om*/
    vlContentPanel.setWidth("100.0%");
    vlContentPanel.setHeight("100.0%");
    vlContentPanel.setMargin(false, true, false, true);
    vlContentPanel.addStyleName("red");

    // breadCrumpPanel
    Panel breadCrumb = buildBreadCrumpPanel();
    vlContentPanel.addComponent(breadCrumb);
    vlContentPanel.setComponentAlignment(breadCrumb, Alignment.TOP_RIGHT);
    // Permanent Link
    new CreateResourceLinksVH(router.getMainWindow().getURL().toString(), resourceProxy, vlContentPanel,
            router);

    // resourcePropertiesPanel
    Panel resourcePropertiesPanel = buildResourcePropertiesPanel();
    vlContentPanel.addComponent(resourcePropertiesPanel);
    vlContentPanel.setComponentAlignment(resourcePropertiesPanel, Alignment.TOP_RIGHT);
    //
    // // metaViewsPanel contains Panel for the DirectMembers & for the Metas
    Panel membersPanel = buildMembersPanel();
    vlContentPanel.addComponent(membersPanel);
    vlContentPanel.setComponentAlignment(membersPanel, Alignment.TOP_RIGHT);

    return vlContentPanel;
}

From source file:org.escidoc.browser.ui.maincontent.ParentsView.java

License:Open Source License

@SuppressWarnings("serial")
private Component buildParentsList() {
    // ViewConstants.PARENTS
    final Panel panel = new Panel();
    panel.setSizeFull();//from   w  ww.ja  v a 2 s  .  c o  m
    panel.setStyleName(Runo.PANEL_LIGHT);

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.PARENTS);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    Button btnAdd = new Button();
    btnAdd.setStyleName(BaseTheme.BUTTON_LINK);
    btnAdd.addStyleName("floatright paddingtop3");
    btnAdd.setWidth("20px");
    btnAdd.setIcon(ICON);
    btnAdd.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {

            final Window subwindow = new Window("Manage Organizational Unit Parents");
            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, orgUnitController));
            } catch (EscidocClientException e) {
                orgUnitController.showError(e);
            }
            Button close = new Button("Close", new Button.ClickListener() {

                @Override
                public void buttonClick(@SuppressWarnings("unused") com.vaadin.ui.Button.ClickEvent event) {
                    (subwindow.getParent()).removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            mainWindow.addWindow(subwindow);
        }
    });
    cssLayout.addComponent(btnAdd);
    vl.addComponent(cssLayout);
    List<ResourceModel> l = orgUnitProxy.getParentList();
    OUParentTableVH parentTable = new OUParentTableVH(orgUnitProxy, router, orgUnitController);
    parentTable.buildTable();
    vl.addComponent(parentTable);
    vl.setExpandRatio(parentTable, 9f);
    // TODO here comes table
    panel.setContent(vl);
    return panel;
}

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);//  w w w .j av a2  s.c om
    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);/*  w ww . ja v  a2s. 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/*w w w.  j  a  v a2s  .  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 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  w w  .  j a  v  a 2  s.  c  o  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 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);
        }
    });

}