Example usage for com.vaadin.ui Button setIcon

List of usage examples for com.vaadin.ui Button setIcon

Introduction

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

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

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

License:Open Source License

private Button buildRemoveButton(int rowNumber, Grant grant) {
    Button removeButton = new Button();
    removeButton.setIcon(new ThemeResource("images/assets/minus.png"));
    removeButton.setData(Integer.valueOf(rowNumber));
    removeButton.addListener(new OnRemoveGrant(grant, groupId, repositories, router.getMainWindow()));
    return removeButton;
}

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();//ww w  .ja  v a2  s  .c  om
    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.ContainerMetadataRecordsView.java

License:Open Source License

private Panel lblMetadaRecs() {
    panel.setSizeFull();//from  w  w w  .j  a  v a 2s .c  o  m
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.METADATA);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (containerController.hasAccess()) {
        final Button btnAddNew = new Button();
        btnAddNew.addListener(new OnAddContainerMetadata(mainWindow, repositories, resourceProxy));
        btnAddNew.setStyleName(BaseTheme.BUTTON_LINK);
        btnAddNew.addStyleName("floatright paddingtop3");
        btnAddNew.setWidth("20px");
        btnAddNew.setIcon(ICON);
        cssLayout.addComponent(btnAddNew);
    }
    vl.addComponent(cssLayout);
    ContainerMetadataTable metadataTable = new ContainerMetadataTable(resourceProxy.getMetadataRecords(),
            containerController, router, resourceProxy, repositories);
    metadataTable.buildTable();
    vl.addComponent(metadataTable);
    vl.setComponentAlignment(metadataTable, Alignment.TOP_LEFT);
    vl.setExpandRatio(metadataTable, 0.9f);
    panel.setContent(vl);

    return panel;
}

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

License:Open Source License

@SuppressWarnings("serial")
private Panel buildAdminDescription() {
    final Panel admDescriptors = new Panel();
    admDescriptors.setWidth("100%");
    admDescriptors.setHeight("100%");
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();//  w  w  w  .j  a  va 2  s.c om
    final CssLayout cssLayout = new CssLayout();
    buildPanelHeader(cssLayout, ViewConstants.ADMIN_DESCRIPTION);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");
    if (contextController.canUpdateContext()) {
        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") ClickEvent event) {
                new OnContextAdminDescriptor(router, contextController).adminDescriptorForm();
            }
        });
        cssLayout.addComponent(addResourceButton);
    }
    vl.addComponent(cssLayout);

    VerticalLayout vl2 = new VerticalLayout();
    final AdminDescriptors admDesc = resourceProxy.getAdminDescription();
    final AdminDescriptorsTable adminDescriptorTable = new AdminDescriptorsTable(contextController, admDesc,
            router);
    adminDescriptorTable.buildTable();
    vl2.addComponent(adminDescriptorTable);
    vl.addComponent(vl2);
    vl.setExpandRatio(vl2, 9);
    admDescriptors.setContent(vl);
    return admDescriptors;
}

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();//from w w w  .  j a  v  a  2 s  . co  m
    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.ItemContent.java

License:Open Source License

private void initView() {
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.COMPONENTS);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    if (true) {//from w w w .  j  av a  2  s.c  o  m
        final Button btnAddNew = new Button();
        btnAddNew.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                Window modalWindow = new Window("Select a file to add.");
                modalWindow.setWidth("25%");
                modalWindow.setHeight("20%");
                modalWindow.setModal(true);
                modalWindow.addComponent(new ComponentUploadView(repositories, controller, itemProxy,
                        ItemContent.this, mainWindow));
                mainWindow.addWindow(modalWindow);
            }
        });
        btnAddNew.setStyleName(BaseTheme.BUTTON_LINK);
        btnAddNew.addStyleName("floatright paddingtop3");
        btnAddNew.setWidth("20px");
        btnAddNew.setIcon(ICON);
        cssLayout.addComponent(btnAddNew);
    }

    verticalLayout.addComponent(cssLayout);
    wrap(verticalLayout);
    if (controller.hasComponents()) {
        verticalLayout.addComponent(buildTable());
    } else {
        final Label lblNoComponents = new Label(
                "No components in this Item. You can drag n'drop some file from your computer to this box to add new components!");
        lblNoComponents.setWidth("90%");
        lblNoComponents.setStyleName("skybluetext");
        verticalLayout.addComponent(lblNoComponents);
    }
}

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

License:Open Source License

private Panel lblMetadaRecs() {
    pnl.setSizeFull();/*from  ww w . j  a  va2s . c  o  m*/
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.METADATA);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    ItemMetadataTable metadataItem = new ItemMetadataTable(itemController, router, resourceProxy, repositories);
    metadataItem.buildTable();
    if (itemController.hasAccess()) {
        final Button btnAddNew = new Button();
        btnAddNew.addListener(new AddMetaDataFileItemBehaviour(mainWindow, repositories, resourceProxy));
        btnAddNew.setStyleName(BaseTheme.BUTTON_LINK);
        btnAddNew.addStyleName("floatright paddingtop3");
        btnAddNew.setWidth("20px");
        btnAddNew.setIcon(ICON);
        cssLayout.addComponent(btnAddNew);
    }
    vl.addComponent(cssLayout);
    vl.addComponent(metadataItem);
    vl.setExpandRatio(metadataItem, 9f);
    pnl.setContent(vl);
    return pnl;
}

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

License:Open Source License

@SuppressWarnings("serial")
private Component buildMetaDataTab() {
    Panel innerPanel = new Panel();
    innerPanel.setSizeFull();//  w w  w  .jav  a2s.com
    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

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

    if (canAddMetadata()) {
        final Button addNewOrgUnitBtn = new Button();
        addNewOrgUnitBtn.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                OnAddOrgUnitMetadata view = new OnAddOrgUnitMetadata(controller, router.getMainWindow());
                view.showAddWindow();
            }
        });
        addNewOrgUnitBtn.setStyleName(BaseTheme.BUTTON_LINK);
        addNewOrgUnitBtn.addStyleName("floatright paddingtop3");
        addNewOrgUnitBtn.setWidth("20px");
        addNewOrgUnitBtn.setIcon(ICON);
        cssLayout.addComponent(addNewOrgUnitBtn);
    }
    vl.addComponent(cssLayout);
    OrgUnitMetadataTable metadataTable = new OrgUnitMetadataTable(orgUnit.getMetadataRecords(), controller,
            router);
    metadataTable.buildTable();
    vl.addComponent(metadataTable);
    vl.setExpandRatio(metadataTable, 9);
    innerPanel.setContent(vl);
    return innerPanel;
}

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 w  w  .java2 s  .com
    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.useraccount.OnAddPreference.java

License:Open Source License

@Override
public void buttonClick(@SuppressWarnings("unused") final com.vaadin.ui.Button.ClickEvent event) {
    addPreference.setEnabled(false);//from  w w w.  j  a  va 2s  .  c o  m
    final HorizontalLayout hl = new HorizontalLayout();
    final TextField key = new TextField();
    key.setCaption("Name");
    key.setImmediate(false);
    key.setWidth("-1px");
    key.setHeight("-1px");
    key.setInvalidAllowed(false);
    key.setRequired(true);

    final TextField value = new TextField();
    value.setCaption("Value");
    value.setImmediate(false);
    value.setWidth("-1px");
    value.setHeight("-1px");
    value.setInvalidAllowed(false);
    value.setRequired(true);

    final Button addButton = new Button();
    addButton.setIcon(new ThemeResource("images/assets/plus.png"));
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(@SuppressWarnings("unused") final com.vaadin.ui.Button.ClickEvent event) {
            if (UserAccountView.isNotValid(key, value)) {
                OnAddPreference.this.userAccountView.showMessage();
            } else {
                try {
                    OnAddPreference.this.userAccountView.ur.createPreference(
                            OnAddPreference.this.userAccountView.userProxy,
                            new Preference(key.getValue().toString(), value.getValue().toString()));
                    OnAddPreference.this.userAccountView.router.getMainWindow().showNotification(
                            "Preference added successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION);
                    hl.removeAllComponents();
                    addPreference.setEnabled(true);
                    userPrefTable.createItem(userPrefTable.getTableContainer(), key.getValue().toString(),
                            key.getValue().toString(), value.getValue().toString());
                } catch (final EscidocClientException e) {
                    OnAddPreference.this.userAccountView.router.getMainWindow().showNotification(
                            ViewConstants.ERROR_CREATING_USER_PREFERENCE + e.getLocalizedMessage(),
                            Window.Notification.TYPE_ERROR_MESSAGE);
                }
            }
        }

    });
    hl.addComponent(key);
    hl.addComponent(value);
    hl.addComponent(addButton);
    hl.setComponentAlignment(addButton, Alignment.BOTTOM_RIGHT);
    preferencePanel.addComponent(hl);
}