Example usage for com.vaadin.ui Button setStyleName

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

Introduction

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

Prototype

@Override
    public void setStyleName(String style) 

Source Link

Usage

From source file:org.jumpmind.vaadin.ui.common.PromptDialog.java

License:Open Source License

public PromptDialog(String caption, String text, String defaultValue, final IPromptListener promptListener) {
    setCaption(caption);/*from w  w  w.j  av a2  s  .  c o  m*/
    setModal(true);
    setResizable(false);
    setSizeUndefined();
    setClosable(false);

    VerticalLayout layout = new VerticalLayout();
    layout.setSpacing(true);
    layout.setMargin(true);
    setContent(layout);

    if (isNotBlank(text)) {
        layout.addComponent(new Label(text));
    }

    final TextField field = new TextField();
    field.setWidth(100, Unit.PERCENTAGE);
    field.setNullRepresentation("");
    field.setValue(defaultValue);
    if (defaultValue != null) {
        field.setSelectionRange(0, defaultValue.length());
    }
    layout.addComponent(field);

    HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.addStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
    buttonLayout.setSpacing(true);
    buttonLayout.setWidth(100, Unit.PERCENTAGE);

    Label spacer = new Label(" ");
    buttonLayout.addComponent(spacer);
    buttonLayout.setExpandRatio(spacer, 1);

    Button cancelButton = new Button("Cancel");
    cancelButton.setClickShortcut(KeyCode.ESCAPE);
    cancelButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            UI.getCurrent().removeWindow(PromptDialog.this);
        }
    });
    buttonLayout.addComponent(cancelButton);

    Button okButton = new Button("Ok");
    okButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.addClickListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            if (promptListener.onOk(field.getValue())) {
                UI.getCurrent().removeWindow(PromptDialog.this);
            }
        }
    });
    buttonLayout.addComponent(okButton);

    layout.addComponent(buttonLayout);

    field.focus();

}

From source file:org.milleni.dunning.ui.dpdetail.DunningProcessDetailListDetailPanel.java

License:Apache License

protected void initInstancesTable() {

    dpDetailTable = new Table() {
        @Override/*from   w w  w .j a va 2s.  com*/
        public boolean handleError(ComponentErrorEvent error) {

            return false;
        }

        @Override
        public void changeVariables(Object source, Map<String, Object> variables) {
            // TODO Auto-generated method stub
            try {
                super.changeVariables(source, variables);
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
            }
        }

    };

    dpDetailTable.setWidth(100, UNITS_PERCENTAGE);
    dpDetailTable.setHeight(600, UNITS_PIXELS);
    dpDetailTable.setEditable(false);
    dpDetailTable.setImmediate(true);
    dpDetailTable.setSelectable(true);
    dpDetailTable.setNullSelectionAllowed(false);
    dpDetailTable.setSortDisabled(true);

    container = new LazyLoadingContainer(lazyLoadingQuery, 50);
    container.setTableSizeActionListener(this);
    dpDetailTable.setContainerDataSource(container);

    dpDetailTable.addContainerProperty("finished", Component.class, null, "", null, Table.ALIGN_CENTER);
    dpDetailTable.setColumnWidth("finished", 22);
    dpDetailTable.addContainerProperty("name", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_CURRENT_STEP), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("startDate", Date.class, null,
            i18nManager.getMessage(Constants.DUNNING_START_DATE), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("endDate", Date.class, null,
            i18nManager.getMessage(Constants.DUNNING_END_DATE), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("status", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_STATUS), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("customerId", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_ID), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("customerName", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_NAME), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("customerStatus", String.class, null, "Musteri Durumu", null,
            Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("masterStatus", String.class, null, "Surec Durumu", null,
            Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("startDebit", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_CURRENT_DEBIT), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("currentDebit", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_DEBIT), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("dunningInvoiceDate", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_INVOICE_DATE), null, Table.ALIGN_LEFT);
    dpDetailTable.addContainerProperty("dunningInvoiceDueDate", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_INVOICE_SOT), null, Table.ALIGN_LEFT);

    dpDetailTable.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            DunningProcessDetailTableListItem item = (DunningProcessDetailTableListItem) dpDetailTable
                    .getItem(event.getProperty().getValue());

            if (item != null) {
                if (dunningProcessDetailLogLayout != null && stepLogTable != null)
                    dunningProcessDetailLogLayout.removeComponent(stepLogTable);
                stepLogTable = new DunningStepLogTableComponent(
                        dunningProcessDetailRepository.getDunningProcessDetailLog(item.getDpDetail()));
                stepLogTable.setHeight(150, UNITS_PIXELS);
                dunningProcessDetailLogLayout.addComponent(stepLogTable);
            }
        }
    });

    final ThemeResource export = new ThemeResource("../images/table-excel.png");
    final Button excelExportButton = new Button();
    excelExportButton.setIcon(export);
    excelExportButton.setStyleName(BaseTheme.BUTTON_LINK);
    instancesHeader.addComponent(excelExportButton);
    initInstancesTitle(instancesHeader);
    instancesLayout.addComponent(dpDetailTable);

    excelExportButton.addListener(new ClickListener() {
        private static final long serialVersionUID = -73954695086117200L;
        private ExcelExport excelExport;

        public void buttonClick(final ClickEvent event) {
            excelExport = new ExcelExport(dpDetailTable);
            container.setBatchSize(100000);
            excelExport.excludeCollapsedColumns();
            excelExport.setDisplayTotals(false);
            excelExport.setRowHeaders(true);
            excelExport.setDoubleDataFormat("0.00");
            excelExport.setExcelFormatOfProperty("konto", "0");
            excelExport.export();
            container.setBatchSize(50);
        }
    });

}

From source file:org.milleni.dunning.ui.dpmaster.DunningProcessListDetailPanel.java

License:Apache License

protected void initInstancesTable() {

    dpMasterTable = new Table() {
        @Override/*from w w  w  .java2 s  .c  o m*/
        public boolean handleError(ComponentErrorEvent error) {

            return false;
        }

        @Override
        public void changeVariables(Object source, Map<String, Object> variables) {
            // TODO Auto-generated method stub
            try {
                super.changeVariables(source, variables);
            } catch (Exception ex) {

            }
        }

    };

    dpMasterTable.setWidth(100, UNITS_PERCENTAGE);
    dpMasterTable.setHeight(250, UNITS_PIXELS);
    dpMasterTable.setEditable(false);
    dpMasterTable.setImmediate(true);
    dpMasterTable.setSelectable(true);
    dpMasterTable.setNullSelectionAllowed(false);
    dpMasterTable.setSortDisabled(true);

    container = new LazyLoadingContainer(lazyLoadingQuery, 50);
    container.setTableSizeActionListener(this);
    dpMasterTable.setContainerDataSource(container);

    dpMasterTable.addContainerProperty("bpmProcessId", Button.class, null,
            i18nManager.getMessage(Constants.DUNNING_BPM_RPOCESS_ID), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("customerId", Date.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_ID), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("currentStep", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_CURRENT_STEP), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("lastStep", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_LAST_STEP), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("nextStep", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_NEXT_STEP), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("startDate", Date.class, null,
            i18nManager.getMessage(Constants.DUNNING_START_DATE), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("nextStepDate", Date.class, null,
            i18nManager.getMessage(Constants.DUNNING_NEXT_STEP_DATE), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("status", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_STATUS), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("startDebit", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_CURRENT_DEBIT), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("currentDebit", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_DEBIT), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("dunningInvoiceDate", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_INVOICE_DATE), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("dunningInvoiceDueDate", String.class, null,
            i18nManager.getMessage(Constants.DUNNING_INVOICE_SOT), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("statusDesc", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_STATUS), null, Table.ALIGN_LEFT);
    dpMasterTable.addContainerProperty("customerStatus", String.class, null,
            i18nManager.getMessage(Constants.CUSTOMER_STATUS), null, Table.ALIGN_LEFT);

    dpMasterTable.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        public void valueChange(ValueChangeEvent event) {
            DunningProcessTableListItem item = (DunningProcessTableListItem) dpMasterTable
                    .getItem(event.getProperty().getValue());

            if (item != null) {
                if (dunningProcessDetailLayout != null && processStepTable != null)
                    dunningProcessDetailLayout.removeComponent(processStepTable);
                if (detailHeader != null && detailHeader != null)
                    dunningProcessDetailLayout.removeComponent(detailHeader);

                List<DunningProcessDetail> dunningProcessDetails = dunningProcessDetailRepository
                        .findDunningProcessDetails(item.getDnngProcessMaster().getProcessId());
                processStepTable = new DunningStepTableComponent(dunningProcessDetails);
                processStepTable.setHeight(200, UNITS_PIXELS);

                detailHeader = new HorizontalLayout();
                detailHeader.setSpacing(true);
                detailHeader.setWidth(100, UNITS_PERCENTAGE);
                detailHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
                dunningProcessDetailLayout.addComponent(detailHeader);

                instancesLabel = new Label(i18nManager.getMessage(Constants.DUNNING_PROCESS_STEPS));
                instancesLabel.addStyleName(ExplorerLayout.STYLE_H3);
                detailHeader.addComponent(instancesLabel);

                dunningProcessDetailLayout.addComponent(processStepTable);

                processStepTable.addListener(new Property.ValueChangeListener() {
                    private static final long serialVersionUID = 1L;

                    public void valueChange(ValueChangeEvent event) {
                        DunningProcessDetail item = (DunningProcessDetail) event.getProperty().getValue();

                        if (item != null) {
                            if (dunningProcessDetailLogLayout != null && stepLogTable != null)
                                dunningProcessDetailLogLayout.removeComponent(stepLogTable);

                            stepLogTable = new DunningStepLogTableComponent(
                                    item.getDunningProcessDetailLogsCollection());
                            stepLogTable.setHeight(150, UNITS_PIXELS);
                            dunningProcessDetailLogLayout.addComponent(stepLogTable);
                        }
                    }
                });

            }
        }
    });

    final ThemeResource export = new ThemeResource("../images/table-excel.png");
    final Button excelExportButton = new Button();
    excelExportButton.setIcon(export);
    excelExportButton.setStyleName(BaseTheme.BUTTON_LINK);
    instancesHeader.addComponent(excelExportButton);
    initInstancesTitle(instancesHeader);
    instancesLayout.addComponent(dpMasterTable);

    excelExportButton.addListener(new ClickListener() {
        private static final long serialVersionUID = -73954695086117200L;
        private ExcelExport excelExport;

        public void buttonClick(final ClickEvent event) {
            excelExport = new ExcelExport(dpMasterTable);
            container.setBatchSize(100000);
            excelExport.excludeCollapsedColumns();
            excelExport.setDisplayTotals(false);
            excelExport.setRowHeaders(true);
            CellStyle cs = excelExport.getTitleStyle();
            cs.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index);
            excelExport.setTitleStyle(cs);
            excelExport.setDoubleDataFormat("0.00");
            excelExport.setExcelFormatOfProperty("konto", "0");
            excelExport.export();
            container.setBatchSize(50);
        }
    });

}

From source file:org.milleni.dunning.ui.prcstart.TaskViewPanel.java

License:Apache License

protected void addDunningProcessMaster() {

    List<Object[]> objects = dunningProcessMasterRepository.listTaskAndProcDefs();

    // dunningProcessLayout.addComponent(tasksHeader);

    lastChangesTable = new Table();
    lastChangesTable.addStyleName(ExplorerLayout.STYLE_PROCESS_INSTANCE_TASK_LIST);
    lastChangesTable.setWidth(100, UNITS_PERCENTAGE);
    lastChangesTable.setHeight(250, UNITS_PIXELS);
    lastChangesTable.setEditable(false);
    lastChangesTable.setImmediate(true);
    lastChangesTable.setSelectable(true);
    lastChangesTable.setNullSelectionAllowed(false);
    lastChangesTable.setSortDisabled(true);

    lastChangesTable.addContainerProperty("CustomerId", String.class, null, "Musteri", null, Table.ALIGN_LEFT);
    lastChangesTable.addContainerProperty("Desc", String.class, null, "Durum", null, Table.ALIGN_LEFT);

    for (Object[] obj : objects) {
        Object newItemId = lastChangesTable.addItem();
        Item row1 = lastChangesTable.getItem(newItemId);
        row1.getItemProperty("CustomerId").setValue(obj[0]);
        row1.getItemProperty("Desc").setValue(obj[1]);
    }/*from  w  w  w  .j a va 2s . c  o  m*/

    /*
    List<Map<String, Object>> rows = query.toArray();
     List<Item> items = new ArrayList<Item>();
     for (Map<String, Object> row : query) {
    Item tbItem = lastChangesTable.addItem(row);
    HashMap<String, Object> newRow = new HashMap<String, Object>();
    System.out.println(newRow);
     }
     panelLayout.addComponent(lastChangesTable);
     */

    final ThemeResource export = new ThemeResource("../images/table-excel.png");
    final Button excelExportButton = new Button();
    excelExportButton.setIcon(export);
    excelExportButton.setStyleName(BaseTheme.BUTTON_LINK);

    excelExportButton.addListener(new ClickListener() {
        private static final long serialVersionUID = -73954695086117200L;
        private ExcelExport excelExport;

        public void buttonClick(final ClickEvent event) {
            excelExport = new ExcelExport(lastChangesTable);
            excelExport.excludeCollapsedColumns();
            excelExport.setDisplayTotals(false);
            excelExport.setRowHeaders(true);
            CellStyle cs = excelExport.getTitleStyle();
            cs.setFillBackgroundColor(HSSFColor.GREY_25_PERCENT.index);
            excelExport.setTitleStyle(cs);
            excelExport.setDoubleDataFormat("0.00");
            excelExport.setExcelFormatOfProperty("konto", "0");
            excelExport.export();
        }
    });

    panelLayout.addComponent(excelExportButton);
    panelLayout.addComponent(lastChangesTable);
}

From source file:org.openeos.erp.sales.ui.VaadinPrintDocumentUsertaskUI.java

License:Apache License

@SuppressWarnings("unchecked")
@Override/*from   ww w .ja va 2  s  .c  o m*/
protected VerticalLayout createVaadinComponent(UserTask userTask,
        UIApplication<IUnoVaadinApplication> application) {

    EntityInfo info = extractEntity(userTask);

    String documentName = userTask.getMetaData(METADATA_PRINT_DOCUMENT_NAME);
    if (documentName == null || documentName.trim().length() == 0) {
        throw new IllegalArgumentException("The user task has not document meta data");
    }

    System.out.print(info.classDefinition);

    final EntityDocument document = entityDocumentService
            .findDocument((Class<Object>) info.classDefinition.getClassDefined(), info.entity, documentName);
    if (document == null) {
        throw new RuntimeException("Document not found");
    }

    final StreamSource streamSource = new StreamSource() {

        @Override
        public InputStream getStream() {
            try {
                return document.openInputStream();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    };
    final StreamResource resource = new StreamResource(streamSource, document.getName(),
            application.getConcreteApplication().getMainWindow().getApplication());

    VerticalLayout layout = super.createVaadinComponent(userTask, application);

    Panel panel = createPanel("Documents");
    panel.setWidth("100%");

    Button buttonDocument = new Button();
    buttonDocument.setStyleName(Reindeer.BUTTON_LINK);
    buttonDocument.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            event.getButton().getWindow().open(resource, document.getName());
        }
    });
    buttonDocument.setCaption(documentName);

    panel.addComponent(buttonDocument);
    layout.addComponent(panel);

    return layout;
}

From source file:org.openeos.services.ui.vaadin.internal.notifications.VaadinNotificationManager.java

License:Apache License

private void refreshLayout(final IUnoVaadinApplication application, HorizontalLayout layout) {
    layout.removeAllComponents();/*  w w w  . j  a  va  2 s.co m*/
    for (final Notification notification : resolveAndSortNotifications(application)) {
        VerticalLayout vLayout = new VerticalLayout();
        vLayout.setMargin(false);
        vLayout.setSpacing(false);
        Button button = new Button();
        button.addListener(new Button.ClickListener() {

            private static final long serialVersionUID = 3202745949615598633L;

            @Override
            public void buttonClick(ClickEvent event) {
                notification.onClick(applicationFactory.createApplication(application));
                ;
            }
        });
        button.setStyleName(Reindeer.BUTTON_LINK);
        button.setIcon(createIconResource(application, notification));
        button.setDescription(notification.getText());
        //createOverlay(application, notification, button, layout);
        vLayout.addComponent(button);
        if (notification.getNumber() != null) {
            Label label = new Label(notification.getNumber().toString());
            label.setSizeUndefined();
            vLayout.addComponent(label);
            vLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
        }
        layout.addComponent(vLayout);
    }
}

From source file:org.openeos.usertask.ui.internal.vaadin.TasksWindow.java

License:Apache License

private void addToolbarButtons(HorizontalLayout hLayout) {
    HorizontalLayout newLayout = new HorizontalLayout();
    newLayout.setMargin(false);//ww w . ja v  a  2s .co m
    Button buttonRefresh = new Button();
    buttonRefresh.setStyleName(Reindeer.BUTTON_LINK);
    buttonRefresh.setIcon(Resources.ICON_32_REFRESH);
    buttonRefresh.setDescription("Refresh");
    buttonRefresh.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    newLayout.addComponent(buttonRefresh);

    Button buttonNew = new Button();
    buttonNew.setStyleName(Reindeer.BUTTON_LINK);
    buttonNew.setIcon(Resources.ICON_32_NEW);
    buttonNew.setDescription("New task");
    buttonNew.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(ClickEvent event) {
            newTask();
        }
    });
    newLayout.addComponent(buttonNew);

    hLayout.addComponent(newLayout);
}

From source file:org.openeos.usertask.ui.VaadinEntityUsertaskUI.java

License:Apache License

@Override
protected VerticalLayout createVaadinComponent(UserTask userTask,
        UIApplication<IUnoVaadinApplication> application) {

    EntityInfo info = extractEntity(userTask);

    Panel panel = createPanel("Entities");
    StringBuilder captionBuilder = new StringBuilder();
    captionBuilder.append(info.classDefinition.getSingularEntityName());
    captionBuilder.append(": ");
    captionBuilder.append(info.classDefinition.getStringRepresentation(info.entity));
    Button button = new Button(captionBuilder.toString());
    button.setStyleName(Reindeer.BUTTON_LINK);
    panel.addComponent(button);//from w  w  w.java2 s.  c  o  m
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setMargin(false);
    mainLayout.setSpacing(true);
    mainLayout.setWidth("100%");
    mainLayout.addComponent(panel);
    return mainLayout;
}

From source file:org.opennms.features.topology.app.internal.TopologyWidgetTestApplication.java

License:Open Source License

@SuppressWarnings("serial")
@Override/*from   w w w .  ja  v a2  s  . co m*/
public void init() {
    setTheme("topo_default");

    m_rootLayout = new AbsoluteLayout();
    m_rootLayout.setSizeFull();

    m_window = new Window("OpenNMS Topology");
    m_window.setContent(m_rootLayout);
    setMainWindow(m_window);

    m_uriFragUtil = new UriFragmentUtility();
    m_window.addComponent(m_uriFragUtil);
    m_uriFragUtil.addListener(this);

    m_layout = new AbsoluteLayout();
    m_layout.setSizeFull();
    m_rootLayout.addComponent(m_layout);

    if (m_showHeader) {
        HEADER_HEIGHT = 100;
        Panel header = new Panel("header");
        header.setCaption(null);
        header.setSizeUndefined();
        header.addStyleName("onmsheader");
        m_rootLayout.addComponent(header, "top: 0px; left: 0px; right:0px;");

        try {
            CustomLayout customLayout = new CustomLayout(getHeaderLayout());
            header.setContent(customLayout);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    } else {
        HEADER_HEIGHT = 0;
    }

    Refresher refresher = new Refresher();
    refresher.setRefreshInterval(5000);
    getMainWindow().addComponent(refresher);

    m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm());

    final Property scale = m_graphContainer.getScaleProperty();

    m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, m_selectionManager,
            this);
    m_topologyComponent.setSizeFull();
    m_topologyComponent.addMenuItemStateListener(this);
    m_topologyComponent.addVertexUpdateListener(this);

    final Slider slider = new Slider(0, 1);

    slider.setPropertyDataSource(scale);
    slider.setResolution(1);
    slider.setHeight("300px");
    slider.setOrientation(Slider.ORIENTATION_VERTICAL);

    slider.setImmediate(true);

    final Button zoomInBtn = new Button();
    zoomInBtn.setIcon(new ThemeResource("images/plus.png"));
    zoomInBtn.setDescription("Expand Semantic Zoom Level");
    zoomInBtn.setStyleName("semantic-zoom-button");
    zoomInBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) m_graphContainer.getSemanticZoomLevel();
            szl++;
            m_graphContainer.setSemanticZoomLevel(szl);
            setSemanticZoomLevel(szl);
            saveHistory();
        }
    });

    Button zoomOutBtn = new Button();
    zoomOutBtn.setIcon(new ThemeResource("images/minus.png"));
    zoomOutBtn.setDescription("Collapse Semantic Zoom Level");
    zoomOutBtn.setStyleName("semantic-zoom-button");
    zoomOutBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) m_graphContainer.getSemanticZoomLevel();
            if (szl > 0) {
                szl--;
                m_graphContainer.setSemanticZoomLevel(szl);
                setSemanticZoomLevel(szl);
                saveHistory();
            }

        }
    });

    final Button panBtn = new Button();
    panBtn.setIcon(new ThemeResource("images/cursor_drag_arrow.png"));
    panBtn.setDescription("Pan Tool");
    panBtn.setStyleName("toolbar-button down");

    final Button selectBtn = new Button();
    selectBtn.setIcon(new ThemeResource("images/selection.png"));
    selectBtn.setDescription("Selection Tool");
    selectBtn.setStyleName("toolbar-button");
    selectBtn.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            selectBtn.setStyleName("toolbar-button down");
            panBtn.setStyleName("toolbar-button");
            m_topologyComponent.setActiveTool("select");
        }
    });

    panBtn.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            panBtn.setStyleName("toolbar-button down");
            selectBtn.setStyleName("toolbar-button");
            m_topologyComponent.setActiveTool("pan");
        }
    });

    VerticalLayout toolbar = new VerticalLayout();
    toolbar.setWidth("31px");
    toolbar.addComponent(panBtn);
    toolbar.addComponent(selectBtn);

    HorizontalLayout semanticLayout = new HorizontalLayout();
    semanticLayout.addComponent(zoomInBtn);
    semanticLayout.addComponent(m_zoomLevelLabel);
    semanticLayout.addComponent(zoomOutBtn);
    semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER);

    AbsoluteLayout mapLayout = new AbsoluteLayout();

    mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;");
    mapLayout.addComponent(slider, "top: 5px; left: 20px; z-index:1000;");
    mapLayout.addComponent(toolbar, "top: 324px; left: 12px;");
    mapLayout.addComponent(semanticLayout, "top: 380px; left: 2px;");
    mapLayout.setSizeFull();

    m_treeMapSplitPanel = new HorizontalSplitPanel();
    m_treeMapSplitPanel.setFirstComponent(createWestLayout());
    m_treeMapSplitPanel.setSecondComponent(mapLayout);
    m_treeMapSplitPanel.setSplitPosition(222, Sizeable.UNITS_PIXELS);
    m_treeMapSplitPanel.setSizeFull();

    m_commandManager.addCommandUpdateListener(this);

    menuBarUpdated(m_commandManager);
    if (m_widgetManager.widgetCount() != 0) {
        updateWidgetView(m_widgetManager);
    } else {
        m_layout.addComponent(m_treeMapSplitPanel, getBelowMenuPosition());
    }

    if (m_treeWidgetManager.widgetCount() != 0) {
        updateAccordionView(m_treeWidgetManager);
    }
}

From source file:org.opennms.features.topology.app.internal.ui.info.NodeInfoPanelItem.java

License:Open Source License

@Override
protected Component getComponent(VertexRef ref, GraphContainer container) {
    if (ref instanceof AbstractVertex && ((AbstractVertex) ref).getNodeID() != null) {
        AbstractVertex vertex = ((AbstractVertex) ref);
        OnmsNode node = nodeDao.get(vertex.getNodeID());

        if (node != null) {
            FormLayout formLayout = new FormLayout();
            formLayout.setSpacing(false);
            formLayout.setMargin(false);

            formLayout.addComponent(createLabel("Node ID", "" + node.getId()));

            final HorizontalLayout nodeButtonLayout = new HorizontalLayout();
            Button nodeButton = createButton(node.getLabel(), null, null,
                    event -> new NodeInfoWindow(vertex.getNodeID()).open());
            nodeButton.setStyleName(BaseTheme.BUTTON_LINK);
            nodeButtonLayout.addComponent(nodeButton);
            nodeButtonLayout.setCaption("Node Label");
            formLayout.addComponent(nodeButtonLayout);

            if (!Strings.isNullOrEmpty(node.getSysObjectId())) {
                formLayout.addComponent(createLabel("Enterprise OID", node.getSysObjectId()));
            }//from www . j av  a2s. com

            return formLayout;
        }
    }

    return null;
}