Example usage for com.vaadin.ui VerticalLayout setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

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

License:BSD License

protected void createAlreadyCreatedView() {
    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setWidth("100%");
    verticalLayout.setHeight("100%");
    verticalLayout.setMargin(true);//from  www  .  ja  va 2s  . co m

    Label ikasanWelcomeLabel1 = new Label("Welcome to Ikasan!");
    ikasanWelcomeLabel1.setStyleName("xlarge");
    ikasanWelcomeLabel1.setWidth("100%");
    ikasanWelcomeLabel1.setHeight("30px");

    Label ikasanWelcomeLabel2 = new Label(
            "It appears as thoug the Ikasan database has already been created. If you believe that this is not the case there may be an issue. "
                    + "Please contact your local database administrator or Ikasan/Middleware support.");

    ikasanWelcomeLabel2.setStyleName("large");
    ikasanWelcomeLabel2.setWidth("60%");
    ikasanWelcomeLabel2.setHeight("60px");

    verticalLayout.addComponent(ikasanWelcomeLabel1);
    verticalLayout.addComponent(ikasanWelcomeLabel2);

    //        verticalLayout.addComponent(persistanceStoreTypeCombo);

    this.setContent(verticalLayout);
}

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();//  w  ww  .  j av  a2 s  .  co m

    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.investovator.ui.agentgaming.user.components.PortfolioSummary.java

License:Open Source License

public void setupUI() {

    this.setWidth("100%");
    this.setHeight("100%");
    this.setCaption("Portfolio Summary");
    addStyleName("center-caption");

    accountBalance = new Label();
    accountBalance.setCaption("Cash Balance");

    blockedAmount = new Label();
    blockedAmount.setCaption("Blocked Amount");

    createStocksTable();/*from w w  w. j ava2  s  .c  o  m*/

    unmatchedOrders = new OrderView();
    unmatchedOrders.setWidth("95%");
    unmatchedOrders.setHeight("200px");
    unmatchedOrders.setCaption("My Orders");

    VerticalLayout portSummary = new VerticalLayout();
    portSummary.setHeight("100%");

    portSummary.addComponent(stocksSummaryTable);
    portSummary.addComponent(accountBalance);
    portSummary.addComponent(blockedAmount);
    portSummary.setExpandRatio(stocksSummaryTable, 2);
    portSummary.setExpandRatio(accountBalance, 0.5f);
    portSummary.setExpandRatio(accountBalance, 0.5f);

    this.addComponent(portSummary);
    this.addComponent(unmatchedOrders);
    this.setExpandRatio(portSummary, 1);
    this.setExpandRatio(unmatchedOrders, 1);
}

From source file:org.lunifera.christmastree.control.DesktopControlComponent.java

License:Creative Commons License

protected AbsoluteLayout buildMainLayout() {
    // common part: create layout
    mainLayout = new AbsoluteLayout();
    mainLayout.setImmediate(false);//from  w w w. j a v  a 2  s  . c o m
    mainLayout.setWidth("100%");
    mainLayout.setHeight("100%");

    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    // title area
    ThemeResource resource = new ThemeResource("images/Title.png");
    Image title = new Image(" ", resource);
    title.setHeight("108px");
    title.setWidth("827px");
    mainLayout.addComponent(title, "top:22.0px;left:120.0px");

    VerticalLayout vl = new VerticalLayout();
    vl.setHeight("500px");
    vl.setWidth("400px");
    vl.setSpacing(true);
    mainLayout.addComponent(vl, "top:140.0px;left:100.0px;");

    contentLayout = buildContent();
    vl.addComponent(contentLayout);
    vl.setExpandRatio(contentLayout, 1.0f);

    // licenses
    PopupView licenseLink = new PopupView("Attributions",
            new Label("<div><i>Monitor/tablet/smartphone</i> and <i>tree</i> icons </br> made by "
                    + "<a href=\"http://www.freepik.com\" title=\"Freepik\">Freepik</a> "
                    + "from <a href=\"http://www.flaticon.com\" title=\"Flaticon\">www.flaticon.com</a> </br>"
                    + "is licensed under <a href=\"http://creativecommons.org/licenses/by/3.0/\" "
                    + "title=\"Creative Commons BY 3.0\">CC BY 3.0</a></div>", ContentMode.HTML));
    licenseLink.setPrimaryStyleName("attributions");
    vl.addComponent(licenseLink);

    Label image = new Label();
    image.setHeight("400px");
    image.setWidth("100%");
    // image.setValue("<div style=\"overflow:hidden; width: 400px;
    // margin-left: -60px;\">"
    // + "<img src=\"http://77.119.240.22:8081\"/>" + "</div>");
    image.setValue("<div style=\"overflow:hidden; width: 370px; margin-left: -60px;\">"
            + "<img src=\"http://192.168.0.108:8081\"/>" + "</div>");
    image.setContentMode(ContentMode.HTML);
    mainLayout.addComponent(image, "top:140.0px;left:600.0px;");

    return mainLayout;
}

From source file:org.opennms.features.topology.ssh.internal.SSHWindow.java

License:Open Source License

/**
 * The constructor for the SSH window/*w  w  w .j  ava2s  . c  om*/
 * 
 * @param session The current SSH session
 * @param width The width of the window
 * @param height The height of the window
 */
public SSHWindow(ClientSession session, int width, int height) {
    super("SSH");
    setImmediate(true);
    setResizeLazy(false);
    setWidth("" + width + "px");
    setHeight("" + height + "px");

    VerticalLayout vPanel = new VerticalLayout();
    vPanel.setWidth("100%");
    vPanel.setHeight("100%");

    if (session != null) {
        terminal = new SSHTerminal(this, session, TERM_WIDTH, TERM_HEIGHT);
        vPanel.addComponent(terminal);
        vPanel.setComponentAlignment(terminal, Alignment.TOP_CENTER);
    } else {
        vPanel.addComponent(errorLabel);
        vPanel.setComponentAlignment(errorLabel, Alignment.MIDDLE_CENTER);
    }
    setContent(vPanel);
}

From source file:org.opennms.features.vaadin.app.TopologyWidgetTestApplication.java

License:Open Source License

@Override
public void init() {
    //This timer is a hack at the moment to disable and enable menuItems
    m_timer.scheduleAtFixedRate(new TimerTask() {

        @Override//from  www .java 2 s .  c  o  m
        public void run() {
            List<MenuItem> items = m_menuBar.getItems();
            for (MenuItem item : items) {
                if (item.getText().equals("Device")) {
                    List<MenuItem> children = item.getChildren();
                    for (MenuItem child : children) {
                        if (m_graphContainer.getSelectedVertexIds().size() > 0) {
                            if (!child.isEnabled()) {
                                child.setEnabled(true);
                            }
                        } else {
                            if (child.isEnabled()) {
                                child.setEnabled(false);
                            }

                        }
                    }

                }
            }
        }
    }, 1000, 1000);

    m_commandManager.addCommand(new Command("Redo Layout") {
        ;

        @Override
        public void doCommand(Object target) {
            m_graphContainer.redoLayout();
        }

        @Override
        public boolean appliesToTarget(Object target) {
            //Applies to background as a whole
            return target == null;
        }
    }, true);

    m_commandManager.addCommand(new Command("Open") {

        @Override
        public void doCommand(Object target) {
            m_graphContainer.load("graph.xml");
        }

    }, false, "File");

    m_commandManager.addCommand(new Command("Save") {

        @Override
        public void doCommand(Object target) {
            m_graphContainer.save("graph.xml");
        }

    }, false, "File");

    m_commandManager.addCommand(new Command("Add Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                addRandomVertex();
            } else {
                connectNewVertexTo(vertexId.toString(), SERVER_ICON);
            }
            m_graphContainer.redoLayout();
        }

    }, true, "File");

    m_commandManager.addCommand(new Command("Lock") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            if (m_graphContainer.getVertexContainer().containsId(itemId)) {
                Item v = m_graphContainer.getVertexContainer().getItem(itemId);
                return !(Boolean) v.getItemProperty("locked").getValue();
            }
            return false;
        }

        @Override
        public void doCommand(Object vertexId) {
            Item v = m_graphContainer.getVertexContainer().getItem(vertexId);
            v.getItemProperty("locked").setValue(true);
        }

    }, true);

    m_commandManager.addCommand(new Command("Unlock") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            if (m_graphContainer.getVertexContainer().containsId(itemId)) {
                Item v = m_graphContainer.getVertexContainer().getItem(itemId);
                return (Boolean) v.getItemProperty("locked").getValue();
            }
            return false;
        }

        @Override
        public void doCommand(Object vertexId) {
            Item v = m_graphContainer.getVertexContainer().getItem(vertexId);
            v.getItemProperty("locked").setValue(false);
        }

    }, true);
    m_commandManager.addCommand(new Command("Add Switch Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                addRandomVertex();
            } else {
                connectNewVertexTo(vertexId.toString(), SWITCH_ICON);
            }
            m_graphContainer.redoLayout();
        }

    }, true);

    m_commandManager.addCommand(new Command("Remove Vertex") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getVertexContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object vertexId) {
            if (vertexId == null) {
                System.err.println("need to handle selection!!!");
            } else {
                m_graphContainer.removeVertex(vertexId.toString());
                m_graphContainer.redoLayout();
            }
        }

    }, true, "File");

    m_commandManager.addCommand(new Command("Connect") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return m_graphContainer.getSelectedVertexIds().size() == 2;
        }

        @Override
        public void doCommand(Object unused) {
            List<Object> endPoints = new ArrayList<Object>(m_graphContainer.getSelectedVertexIds());

            m_graphContainer.connectVertices(m_graphContainer.getNextEdgeId(), (String) endPoints.get(0),
                    (String) endPoints.get(1));
        }

    }, true, "File");
    m_commandManager.addCommand(new Command("Create Group") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return m_graphContainer.getSelectedVertexIds().size() > 0;
        }

        @Override
        public void doCommand(Object vertexId) {
            String groupId = m_graphContainer.getNextGroupId();
            m_graphContainer.addGroup(groupId, GROUP_ICON);
            m_graphContainer.getVertexContainer().setParent(groupId, ROOT_GROUP_ID);

            for (Object itemId : m_graphContainer.getSelectedVertexIds()) {
                m_graphContainer.getVertexContainer().setParent(itemId, groupId);
            }
        }

    }, true, "Edit");

    m_commandManager.addCommand(new Command("Manual Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new ManualLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Balloon Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new BalloonLayoutAlgorithm(CENTER_VERTEX_ID));
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Circle Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new CircleLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("DAG Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new DAGLayoutAlgorithm(CENTER_VERTEX_ID));
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Radial Tree Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new RadialTreeLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");
    m_commandManager.addCommand(new Command("Tree Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new TreeLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Simple Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new SimpleLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Spring Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new SpringLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("KK Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("ISOM Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new ISOMLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("FR Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new FRLayoutAlgorithm());
        }

    }, false, "Edit|Layout|JUNG");

    m_commandManager.addCommand(new Command("Other Layout") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            m_graphContainer.setLayoutAlgorithm(new AlternativeLayoutAlgorithm());
        }

    }, false, "Edit|Layout");

    m_commandManager.addCommand(new Command("Reset") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {

            resetView();
        }

    }, false, null);

    m_commandManager.addCommand(new Command("History") {

        @Override
        public boolean appliesToTarget(Object target) {
            return true;
        }

        @Override
        public void doCommand(Object target) {
            showHistoryList(m_commandManager.getHistoryList());
        }

    }, false, null);

    m_commandManager.addCommand(new Command("Show Map") {

        @Override
        public void doCommand(Object target) {
            getMainWindow().showNotification("This has not been implemented yet");

        }

    }, false, "View");

    m_commandManager.addCommand(new Command("Get Info") {

        @Override
        public boolean appliesToTarget(Object itemId) {
            return itemId == null || m_graphContainer.getEdgeContainer().containsId(itemId);
        }

        @Override
        public void doCommand(Object target) {
            getMainWindow().showNotification("This has not been implemented yet");
        }

    }, true, "Device");

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

    m_window = new Window("Topology Widget Test");
    m_window.setContent(layout);
    setMainWindow(m_window);

    m_graphContainer.addGroup(ROOT_GROUP_ID, GROUP_ICON);
    m_graphContainer.addVertex(CENTER_VERTEX_ID, 50, 50, SERVER_ICON);
    m_graphContainer.getVertexContainer().setParent(CENTER_VERTEX_ID, ROOT_GROUP_ID);
    m_graphContainer.setLayoutAlgorithm(new KKLayoutAlgorithm());

    m_topologyComponent = new TopologyComponent(m_graphContainer);
    m_commandManager.addActionHandlers(m_topologyComponent);
    m_topologyComponent.setSizeFull();

    final Property scale = m_graphContainer.getProperty("scale");
    final Slider slider = new Slider(1, 4);
    slider.setResolution(2);
    slider.setHeight("300px");
    slider.setOrientation(Slider.ORIENTATION_VERTICAL);

    slider.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            scale.setValue((Double) slider.getValue());
        }
    });

    slider.setImmediate(true);

    m_tree = createTree();
    Label semanticZoomLabel = new Label();
    final Property zoomLevel = m_graphContainer.getProperty("semanticZoomLevel");
    semanticZoomLabel.setPropertyDataSource(zoomLevel);

    Button zoomInBtn = new Button("Zoom In");
    zoomInBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) zoomLevel.getValue();
            szl++;
            zoomLevel.setValue(szl);
            m_graphContainer.redoLayout();
        }
    });

    Button zoomOutBtn = new Button("Zoom Out");
    zoomOutBtn.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            int szl = (Integer) zoomLevel.getValue();
            szl--;
            zoomLevel.setValue(szl);
            m_graphContainer.redoLayout();
        }
    });

    VerticalLayout vLayout = new VerticalLayout();
    vLayout.setWidth("100%");
    vLayout.setHeight("100%");
    vLayout.addComponent(m_tree);

    AbsoluteLayout mapLayout = new AbsoluteLayout();

    mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;");
    mapLayout.addComponent(slider, "top: 20px; left: 20px; z-index:1000;");
    mapLayout.addComponent(semanticZoomLabel, "bottom: 10px; right: 10px; z-index: 2000;");
    mapLayout.setSizeFull();

    HorizontalSplitPanel treeMapSplitPanel = new HorizontalSplitPanel();
    treeMapSplitPanel.setFirstComponent(vLayout);
    treeMapSplitPanel.setSecondComponent(mapLayout);
    treeMapSplitPanel.setSplitPosition(100, Sizeable.UNITS_PIXELS);
    treeMapSplitPanel.setSizeFull();

    VerticalSplitPanel bottomLayoutBar = new VerticalSplitPanel();
    bottomLayoutBar.setFirstComponent(treeMapSplitPanel);

    VerticalLayout zoomLayout = new VerticalLayout();
    zoomLayout.addComponent(zoomInBtn);
    zoomLayout.addComponent(zoomOutBtn);

    bottomLayoutBar.setSecondComponent(zoomLayout);
    bottomLayoutBar.setSplitPosition(80, Sizeable.UNITS_PERCENTAGE);
    bottomLayoutBar.setSizeFull();

    m_menuBar = m_commandManager.getMenuBar();
    m_menuBar.setWidth("100%");
    layout.addComponent(m_menuBar, "top: 0px; left: 0px; right:0px;");
    layout.addComponent(bottomLayoutBar, "top: 23px; left: 0px; right:0px; bottom:0px;");

}

From source file:org.opennms.features.vaadin.pmatrix.ui.PmatrixApplication.java

License:Open Source License

@Override
protected void init(VaadinRequest request) {
    final VerticalLayout layout = new VerticalLayout();
    layout.setWidth("-1px");
    layout.setHeight("-1px");
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    layout.setMargin(true);//from  ww  w .j  a v  a  2 s . co m
    setContent(layout);

    //used to test that detach events are happening
    addDetachListener(new DetachListener() {
        @Override
        public void detach(DetachEvent event) {
            LOG.debug("Pmatrix UI instance detached:" + this);
        }
    });

    Component uiComponent = uiComponentFactory.getUiComponent(request);

    if (uiComponent == null) {

        StringBuilder sb = new StringBuilder(
                "Error: Cannot create the UI because the URL request parameters are not recognised<BR>\n"
                        + "you need to provide atleast '?" + UiComponentFactory.COMPONENT_REQUEST_PARAMETER
                        + "=" + UiComponentFactory.DEFAULT_COMPONENT_REQUEST_VALUE + "'<BR>\n"
                        + "Parameters passed in URL:<BR>\n");
        for (Entry<String, String[]> entry : request.getParameterMap().entrySet()) {
            sb.append("parameter:'" + entry.getKey() + "' value:'");
            for (String s : entry.getValue()) {
                sb.append("{" + s + "}");
            }
            sb.append("'<BR>\n");
        }
        Label label = new Label();
        label.setWidth("600px");
        label.setContentMode(ContentMode.HTML);
        label.setValue(sb.toString());
        layout.addComponent(label);

    } else {
        layout.addComponent(uiComponent);

        // refresh interval to apply to the UI
        int pollInterval = uiComponentFactory.getRefreshRate();
        setPollInterval(pollInterval);

        // display poll interval in seconds
        DecimalFormat dformat = new DecimalFormat("##.##");
        Label label = new Label();
        label.setCaption("(refresh rate:" + dformat.format(pollInterval / 1000) + " seconds)");
        layout.addComponent(label);
    }

}

From source file:org.ow2.sirocco.cloudmanager.ConfirmDialog.java

License:Open Source License

private ConfirmDialog(final String caption, final String question, final String option, final String okLabel,
        final String cancelLabel, final ConfirmationDialogCallback callback) {

    super(caption);
    this.center();
    this.setClosable(false);
    this.setModal(true);
    this.setResizable(false);

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);// w ww.j a  va 2  s.  com
    content.setWidth("400px");
    content.setHeight("150px");

    this.callback = callback;

    if (question != null) {
        Label label = new Label(question);
        content.addComponent(label);
    }
    if (option != null) {
        this.optionBox = new CheckBox(option);
        content.addComponent(this.optionBox);
    }

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    this.okButton = new Button(okLabel, this);
    this.cancelButton = new Button(cancelLabel, this);
    this.cancelButton.focus();
    buttonLayout.addComponent(this.okButton);
    buttonLayout.addComponent(this.cancelButton);
    content.addComponent(buttonLayout);
    content.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    this.setContent(content);

}

From source file:org.ow2.sirocco.cloudmanager.KeyPairImportDialog.java

License:Open Source License

public KeyPairImportDialog(final DialogCallback callback) {
    super("Import Key Pair");
    this.callback = callback;
    this.center();
    this.setClosable(false);
    this.setModal(true);
    this.setResizable(false);

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();//  w w  w.  jav a  2 s  . c  om
    content.setMargin(true);
    content.setSpacing(true);
    content.setWidth("500px");
    content.setHeight("250px");

    FormLayout form = new FormLayout();
    form.setWidth("100%");
    form.setMargin(true);
    form.setSpacing(true);

    this.nameField = new TextField("Name");
    this.nameField.setWidth("50%");
    this.nameField.setRequired(true);
    this.nameField.setRequiredError("Please enter a name for your key pair");
    form.addComponent(this.nameField);

    this.publicKeyField = new TextArea("Public Key");
    this.publicKeyField.setWidth("100%");
    this.publicKeyField.setRequired(true);
    this.publicKeyField.setRequiredError("Please enter a name for your key pair");
    form.addComponent(this.publicKeyField);

    content.addComponent(form);

    final HorizontalLayout buttonLayout = new HorizontalLayout();
    buttonLayout.setSpacing(true);
    this.okButton = new Button("Ok", this);
    this.cancelButton = new Button("Cancel", this);
    this.cancelButton.focus();
    buttonLayout.addComponent(this.okButton);
    buttonLayout.addComponent(this.cancelButton);
    content.addComponent(buttonLayout);
    content.setComponentAlignment(buttonLayout, Alignment.BOTTOM_RIGHT);

    this.setContent(content);

}

From source file:org.processbase.ui.bpm.admin.ProcessDefinitionWindow.java

License:Open Source License

public void initUI() {
    try {/*from  w w w.j av  a  2s  .c  o m*/
        String caption = processDefinition.getLabel() != null ? processDefinition.getLabel()
                : processDefinition.getName();
        setCaption(caption + " (v." + processDefinition.getVersion() + ")");
        VerticalLayout layout = (VerticalLayout) this.getContent();
        layout.setMargin(true);
        layout.setSpacing(true);
        layout.setStyleName(Reindeer.LAYOUT_WHITE);

        v1.setMargin(true, false, false, false);
        v1.setSizeFull();

        if (processDefinition.getLabel() != null) {
            Label pdLabel = new Label("<b>" + processDefinition.getLabel() + "</b>");
            pdLabel.setContentMode(Label.CONTENT_XHTML);
            v1.addComponent(pdLabel);
        }

        if (processDefinition.getDescription() != null) {
            Label pdDescription = new Label(processDefinition.getDescription());
            pdDescription.setContentMode(Label.CONTENT_XHTML);
            v1.addComponent(pdDescription);
            v1.setExpandRatio(pdDescription, 1);
        }

        tabSheet.addTab(v1, ProcessbaseApplication.getCurrent().getPbMessages().getString("tabDescription"),
                null);

        activitiesTable.setSizeFull();

        v2.setMargin(false, false, false, false);
        v2.addComponent(activitiesTable);
        v2.setSizeFull();
        tabSheet.addTab(v2, ProcessbaseApplication.getCurrent().getPbMessages().getString("tabCustomUI"), null);

        // prepare membership
        prepareTableMembership();
        addBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnAdd"), this);
        addBtn.setStyleName(Runo.BUTTON_SMALL);
        v3.setMargin(false, false, false, false);
        v3.setSpacing(true);
        v3.addComponent(addBtn);
        v3.setComponentAlignment(addBtn, Alignment.MIDDLE_RIGHT);
        v3.addComponent(tableMembership);
        v3.setSizeFull();
        tabSheet.addTab(v3, ProcessbaseApplication.getCurrent().getPbMessages().getString("processAccess"),
                null);
        refreshTableMembership();

        tabSheet.setStyleName(Reindeer.TABSHEET_MINIMAL);
        tabSheet.setSizeFull();
        tabSheet.addListener((TabSheet.SelectedTabChangeListener) this);
        layout.addComponent(tabSheet);
        layout.setExpandRatio(tabSheet, 1);

        closeBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnClose"), this);
        applyBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSaveCustomUI"),
                this);
        saveAccessBtn = new Button(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("btnSaveProcessAccess"), this);
        deleteAllBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDeleteAll"),
                this);
        deleteInstancesBtn = new Button(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDeleteInstances"), this);
        downloadBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnDownload"),
                this);
        enableBtn = new CheckBox(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnEnable"),
                this);
        archiveBtn = new Button(ProcessbaseApplication.getCurrent().getPbMessages().getString("btnArchive"),
                this);

        deleteAllBtn.setDescription(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteProcessDefinition"));
        buttons.addButton(deleteAllBtn);
        buttons.setComponentAlignment(deleteAllBtn, Alignment.MIDDLE_RIGHT);
        deleteInstancesBtn.setDescription(
                ProcessbaseApplication.getCurrent().getPbMessages().getString("deleteProcessInstances"));
        buttons.addButton(deleteInstancesBtn);
        buttons.setComponentAlignment(deleteInstancesBtn, Alignment.MIDDLE_RIGHT);

        Label expand = new Label("");
        buttons.addComponent(expand);
        buttons.setExpandRatio(expand, 1);

        enableBtn.setValue(processDefinition.getState().equals(ProcessState.ENABLED));
        buttons.addButton(enableBtn);
        buttons.setComponentAlignment(enableBtn, Alignment.MIDDLE_RIGHT);

        buttons.addButton(archiveBtn);
        buttons.setComponentAlignment(archiveBtn, Alignment.MIDDLE_RIGHT);

        applyBtn.setVisible(false);
        buttons.addButton(applyBtn);
        buttons.setComponentAlignment(applyBtn, Alignment.MIDDLE_RIGHT);
        buttons.addButton(saveAccessBtn);
        saveAccessBtn.setVisible(false);
        buttons.setComponentAlignment(saveAccessBtn, Alignment.MIDDLE_RIGHT);
        buttons.addButton(closeBtn);
        buttons.setComponentAlignment(closeBtn, Alignment.MIDDLE_RIGHT);
        buttons.setMargin(false);
        buttons.setHeight("30px");
        buttons.setWidth("100%");
        layout.addComponent(buttons);
        layout.setWidth("800px");
        layout.setHeight("400px");
        setResizable(false);
        setModal(true);

        //        activitiesTable.addContainerProperty("activityUUID", String.class, null, "UUID", null, null);
        //        activitiesTable.setColumnWidth("activityUUID", 0);
        activitiesTable.addContainerProperty("activityLabel", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tableCaptionActivityName"), null,
                null);
        activitiesTable.addContainerProperty("url", String.class, null,
                ProcessbaseApplication.getCurrent().getPbMessages().getString("tabCaptionTaskURL"), null, null);
        activitiesTable.setColumnWidth("url", 300);
        activitiesTable.setTableFieldFactory(new PbTableFieldFactory());
        activitiesTable.setEditable(true);
        activitiesTable.setImmediate(true);

        refreshTable();
    } catch (Exception ex) {
        ex.printStackTrace();
        showError(ex.getMessage());
    }
}