Example usage for com.vaadin.ui CssLayout setWidth

List of usage examples for com.vaadin.ui CssLayout setWidth

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:gov.va.ehtac.appsonfhir.ui.LogoutView.java

License:Open Source License

private void buildView() {
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Logout / End Session");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    logoutAction = new Label(
            "<div style='color:#333;'><p>You have requested to end your session, if true continue by clicking the \"Ok\" button.</p></div>",
            Label.CONTENT_XHTML);
    Button okBTN = new Button("Ok");
    okBTN.addListener(new Button.ClickListener() {

        @Override/*from w  w  w.  j  av  a  2s.c o  m*/
        public void buttonClick(ClickEvent event) {
            ((HealthElementsTouchKitUI) UI.getCurrent()).getSession().close();
        }
    });
    vGroup.addComponent(logoutAction);
    vGroup.addComponent(okBTN);
    content.addComponent(vGroup);
    setContent(content);

}

From source file:gov.va.ehtac.appsonfhir.ui.ProfileView.java

License:Open Source License

private void buildView() {
    session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes();
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Profile View");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    profileAction = new Label(
            "<div style='color:#333;'><p>This screen allows the user to modify their <b>Privacy on FHIR</b> "
                    + "Purpose of Use, and Security Level for local Access Control Decisions.</d></div>",
            Label.CONTENT_XHTML);

    vGroup.addComponent(profileAction);// w w  w .j a  va  2 s. c o m

    //Label identityLBL = new Label("<b>Identity</b>", Label.CONTENT_XHTML);
    TextField providerIdFLD = new TextField("Provider ID/Email Address");
    providerIdFLD.setEnabled(false);
    TextField userIdFLD = new TextField("User ID");
    userIdFLD.setEnabled(false);
    PasswordField userpassFLD = new PasswordField("Password");
    userpassFLD.setEnabled(false);

    providerIdFLD.setValue(session.getProviderId());
    userIdFLD.setValue(session.getUserId());
    userpassFLD.setValue("ds4p");

    providerIdFLD.setWidth("400px");
    userIdFLD.setWidth("400px");
    userpassFLD.setWidth("400px");

    VerticalComponentGroup vGroup2 = new VerticalComponentGroup();
    vGroup2.setCaption("Identity");
    //vGroup.addComponent(identityLBL);
    vGroup2.addComponent(providerIdFLD);
    vGroup2.addComponent(userIdFLD);
    vGroup2.addComponent(userpassFLD);

    //Label permissionsLBL = new Label("<b>Access Control Setting and Permissions</b>", Label.CONTENT_XHTML);
    pouCBX = new ComboBox("Current Purpose of Use");
    NavigationButton resourceNavBTN = new NavigationButton("Resource Privileges");
    confCBX = new ComboBox("Security Level");
    NavigationButton sensitivityNavBTN = new NavigationButton("Sensitivity Privileges");

    pouCBX.setWidth("400px");
    confCBX.setWidth("400px");
    pouCBX.setTextInputAllowed(false);
    confCBX.setTextInputAllowed(false);

    populateConfCBX();
    populatePouCBX();

    confCBX.setEnabled(true);

    VerticalComponentGroup vGroup3 = new VerticalComponentGroup();
    vGroup3.setCaption("Use and Permission Settings");
    //vGroup.addComponent(permissionsLBL);
    vGroup3.addComponent(pouCBX);
    vGroup3.addComponent(resourceNavBTN);
    vGroup3.addComponent(confCBX);
    vGroup3.addComponent(sensitivityNavBTN);

    pouCBX.setValue(session.getPurposeOfUse());
    confCBX.setValue(session.getSecurityLevel());

    //Label organizationLBL = new Label("<b>Organization Info</b>", Label.CONTENT_XHTML);
    TextField organizationFLD = new TextField("Organization");
    TextField organizationUnitFLD = new TextField("Facility");
    TextField organizationIdFLD = new TextField("Home Community");

    organizationFLD.setValue("Military Health Systems");
    organizationUnitFLD.setValue("Navy Medical Center San Diego - NMCSD");
    organizationIdFLD.setValue("2.16.840.1.113883.4.349");

    organizationFLD.setEnabled(false);
    organizationUnitFLD.setEnabled(false);
    organizationIdFLD.setEnabled(false);

    organizationFLD.setWidth("400px");
    organizationUnitFLD.setWidth("400px");
    organizationIdFLD.setWidth("400px");

    VerticalComponentGroup vGroup4 = new VerticalComponentGroup();
    vGroup4.setCaption("Organization Info");
    //vGroup.addComponent(organizationLBL);
    vGroup4.addComponent(organizationFLD);
    vGroup4.addComponent(organizationUnitFLD);
    vGroup4.addComponent(organizationIdFLD);

    //Label locationLBL = new Label("<b>Location</b>", Label.CONTENT_XHTML);
    TextField cityFLD = new TextField("City");
    TextField stateFLD = new TextField("State");
    TextField zipFLD = new TextField("Zip Code");
    TextField countryFLD = new TextField("Country");

    //set defaults and disable
    cityFLD.setValue("San Diego");
    stateFLD.setValue("CA");
    zipFLD.setValue("92104");
    countryFLD.setValue("U.S.A");

    cityFLD.setEnabled(false);
    stateFLD.setEnabled(false);
    zipFLD.setEnabled(false);
    countryFLD.setEnabled(false);

    cityFLD.setWidth("400px");
    stateFLD.setWidth("400px");
    zipFLD.setWidth("400px");
    countryFLD.setWidth("400px");
    VerticalComponentGroup vGroup5 = new VerticalComponentGroup();
    vGroup5.setCaption("Location Info");
    //vGroup.addComponent(locationLBL);
    vGroup5.addComponent(cityFLD);
    vGroup5.addComponent(stateFLD);
    vGroup5.addComponent(zipFLD);
    vGroup5.addComponent(countryFLD);

    pouCBX.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String val = (String) pouCBX.getValue();
            session.setPurposeOfUse(val);
        }
    });

    confCBX.addListener(new ValueChangeListener() {

        @Override
        public void valueChange(ValueChangeEvent event) {
            String val = (String) confCBX.getValue();
            session.setSecurityLevel(val);
        }
    });

    pouCBX.setImmediate(true);
    confCBX.setImmediate(true);

    content.addComponent(vGroup);
    content.addComponent(vGroup2);
    content.addComponent(vGroup3);
    content.addComponent(vGroup4);
    content.addComponent(vGroup5);
    setContent(content);

}

From source file:gov.va.ehtac.myappsonfhir.ui.LogoutView.java

License:Open Source License

private void buildView() {
    CssLayout content = new CssLayout();
    content.setWidth("100%");
    setCaption("Logout / End Session");

    VerticalComponentGroup vGroup = new VerticalComponentGroup();
    logoutAction = new Label(
            "<div style='color:#333;'><p>You have requested to end your session, if true continue by clicking the \"Ok\" button.</p></div>",
            Label.CONTENT_XHTML);
    Button okBTN = new Button("Ok");
    okBTN.addListener(new Button.ClickListener() {

        @Override//from  www .j  a  va2 s.  co m
        public void buttonClick(ClickEvent event) {
            ((HealthElementsForPatientTouchKitUI) UI.getCurrent()).getSession().close();
        }
    });
    vGroup.addComponent(logoutAction);
    vGroup.addComponent(okBTN);
    content.addComponent(vGroup);
    setContent(content);

}

From source file:info.magnolia.messages.app.MessagesViewImpl.java

License:Open Source License

@Inject
public MessagesViewImpl(SimpleTranslator i18n) {

    this.i18n = i18n;

    // create form and data item
    final Message message = new Message(); // message POJO
    BeanItem<Message> messageItem = new BeanItem<Message>(message);

    final FieldGroup form = new FieldGroup();
    form.setItemDataSource(messageItem);

    Field<String> subjectField = createSubjectTextField();
    Field<String> messageBodyField = createMessageBodyTextField();
    Field<?> typeField = createTypeSelectionField();
    Field<?> scopeField = createScopeSelectionField();
    userOrGroupIdField = createUserOrGroupIdTextField();

    // disable user/group field if not necessary
    scopeField.addValueChangeListener(new ValueChangeListener() {

        @Override/*from   w w w. j  a v a  2s.c  o m*/
        public void valueChange(ValueChangeEvent event) {
            updateUserOrGroupField((String) event.getProperty().getValue());
        }
    });

    form.bind(subjectField, "title");
    form.bind(messageBodyField, "content");
    form.bind(typeField, "type");
    form.bind(scopeField, "scope");
    form.bind(userOrGroupIdField, "user");
    // FieldGroup overrides fields' own enabled property with its own.
    updateUserOrGroupField(message.getScope());

    FormLayout layout = new FormLayout();
    layout.addComponent(subjectField);
    layout.addComponent(messageBodyField);
    layout.addComponent(typeField);
    layout.addComponent(scopeField);
    layout.addComponent(userOrGroupIdField);

    layout.setSpacing(true);
    layout.setMargin(false);
    layout.setWidth("100%");

    // send button
    NativeButton sendButton = new NativeButton(i18n.translate("messages-app.app.button.sendMessage"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    try {
                        form.commit();
                        String subject = message.getTitle();
                        String content = message.getContent();
                        MessageType type = message.getType();
                        String scope = message.getScope();

                        if (MESSAGE_SCOPE_LOCAL.equals(scope)) {
                            listener.handleLocalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GLOBAL.equals(scope)) {
                            listener.handleGlobalMessage(type, subject, content);
                        } else if (MESSAGE_SCOPE_GROUP.equals(scope)) {
                            // message is bound to FieldGroup - hence the group name is to be retrieved from the user field of the message
                            final String groupName = message.getUser();
                            listener.handleGroupMessage(groupName, type, subject, content);
                        } else {
                            // User...
                            final String userName = message.getUser();
                            listener.handleUserMessage(userName, type, subject, content);
                        }
                    } catch (CommitException e) {

                    }
                }
            });
    sendButton.addStyleName("btn-dialog");
    sendButton.addStyleName("commit");

    // reset button
    NativeButton resetButton = new NativeButton(i18n.translate("messages-app.app.button.reset"),
            new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    message.reset();
                    form.discard();
                }
            });
    resetButton.addStyleName("btn-dialog");
    resetButton.addStyleName("cancel");

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addStyleName("buttons");
    buttons.setSpacing(true);
    buttons.addComponent(sendButton);
    buttons.addComponent(resetButton);
    layout.addComponent(buttons);

    // intro text
    Label intro = new Label(i18n.translate("messages-app.app.label.intro"), ContentMode.HTML);
    intro.addStyleName("intro");

    CssLayout container = new CssLayout();
    container.setSizeFull();
    container.addStyleName("small-app-panel");
    container.addComponent(layout);

    CssLayout root = new CssLayout();
    root.setSizeFull();
    root.setWidth("900px");
    root.setStyleName("small-app");
    root.addComponent(intro);
    root.addComponent(container);

    component = root;
}

From source file:info.magnolia.ui.form.field.upload.basic.BasicUploadProgressIndicator.java

License:Open Source License

public BasicUploadProgressIndicator(String inProgressCaption, String inProgressRatioCaption,
        SimpleTranslator i18n) {//from  w w  w .  j  av a 2s  .c  om
    this.inProgressCaption = inProgressCaption;
    this.inProgressRatioCaption = inProgressRatioCaption;
    this.i18n = i18n;

    uploadFileLocation = new Label("");
    uploadFileLocation.setSizeUndefined();
    uploadFileLocation.addStyleName("uploading-file");

    uploadFileRatio = new Label("");
    uploadFileRatio.setSizeUndefined();
    uploadFileRatio.addStyleName("uploaded-file");

    uploadFileProgress = new Label("");
    uploadFileProgress.setSizeUndefined();
    uploadFileProgress.addStyleName("uploading-file-progress");

    progressIndicator = new ProgressBar();
    progressIndicator.setVisible(false);
    progressIndicator.setWidth("100%");

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

    mainLayout.addComponent(uploadFileLocation);

    CssLayout progressLayout = new CssLayout();
    progressLayout.addStyleName("progress-layout");
    progressLayout.addComponent(progressIndicator);
    progressLayout.addComponent(uploadFileProgress);
    progressLayout.setWidth("100%");
    mainLayout.addComponent(progressLayout);
    mainLayout.addComponent(uploadFileRatio);

    Iterator<Component> it = mainLayout.iterator();
    while (it.hasNext()) {
        Component c = it.next();
        mainLayout.setComponentAlignment(c, Alignment.MIDDLE_CENTER);
    }
    mainLayout.setMargin(new MarginInfo(false, true, false, true));

    setCompositionRoot(mainLayout);
    addStyleName("uploading-progress-indicator");

}

From source file:jp.primecloud.auto.ui.LoadBalancerPanel.java

License:Open Source License

@Override
public void attach() {
    setSizeFull();/*from   w w w.j  ava 2  s.c om*/
    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.addStyleName("loadbalancer-tab");
    layout.setSpacing(false);
    layout.setMargin(false);

    // ?
    SplitPanel splitPanel = new SplitPanel();
    splitPanel.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splitPanel.setSplitPosition(40);
    splitPanel.setSizeFull();
    layout.addComponent(splitPanel);

    // ?
    VerticalLayout upperLayout = new VerticalLayout();
    upperLayout.setSizeFull();
    upperLayout.setSpacing(false);
    upperLayout.setMargin(false);

    CssLayout upperTopLayout = new CssLayout();
    Label label = new Label(ViewProperties.getCaption("label.loadbalancer"));
    upperTopLayout.setWidth("100%");
    upperTopLayout.setMargin(true);
    upperTopLayout.addStyleName("loadbalancer-table-label");
    upperTopLayout.addComponent(label);
    upperTopLayout.setHeight("28px");
    upperLayout.addComponent(upperTopLayout);

    loadBalancerTable = new LoadBalancerTable(sender);
    loadBalancerTable.setContainerDataSource(new LoadBalancerDtoContainer());
    upperLayout.addComponent(loadBalancerTable);
    loadBalancerTable.addListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event) {
            tableRowSelected(event);
        }
    });

    loadBalancerButtonsBottom = new LoadBalancerButtonsBottom(sender);
    upperLayout.addComponent(loadBalancerButtonsBottom);
    upperLayout.setExpandRatio(loadBalancerTable, 10);
    splitPanel.addComponent(upperLayout);

    // ?
    loadBalancerDesc = new LoadBalancerDesc(sender);
    splitPanel.addComponent(loadBalancerDesc);
}

From source file:jp.primecloud.auto.ui.MainView.java

License:Open Source License

@Override
public void attach() {
    setSizeFull();//  w  w  w .  jav  a  2s  .  c o  m
    addStyleName("mycloud-panel");
    setMargin(false);
    setSpacing(false);

    // ???
    topBar = new TopBar(this);
    addComponent(topBar);

    // ???
    CssLayout topLayout = new CssLayout();
    topLayout.setWidth("100%");
    topLayout.setHeight("28px");
    topLayout.addStyleName("mycloud-name");
    topLayout.setMargin(true);
    addComponent(topLayout);

    // myCloud??
    myCloudField = new TextField();
    myCloudField.setWidth("80%");
    myCloudField.addStyleName("mycloud-label");
    myCloudField.setEnabled(false);
    myCloudField.setReadOnly(true);
    topLayout.addComponent(myCloudField);

    // Reload
    reloadButton = new Button(ViewProperties.getCaption("button.reload"));
    reloadButton.setDescription(ViewProperties.getCaption("description.reload"));
    reloadButton.addStyleName("sync-button");
    reloadButton.addStyleName("borderless");
    reloadButton.setIcon(Icons.SYNC.resource());
    reloadButton.setEnabled(false);
    reloadButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            refresh();
        }
    });
    topLayout.addComponent(reloadButton);

    // myCloud
    VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();
    mainLayout.setSpacing(false);
    mainLayout.setMargin(false);

    Panel mainPanel = new Panel(mainLayout);
    mainPanel.setSizeFull();
    mainPanel.addStyleName(Reindeer.PANEL_LIGHT);
    addComponent(mainPanel);
    setExpandRatio(mainPanel, 100);

    // 
    tab = new TabSheet();
    tab.setSizeFull();
    tab.setEnabled(false);
    tab.addStyleName(Reindeer.TABSHEET_BORDERLESS);
    mainLayout.addComponent(tab);
    mainLayout.setExpandRatio(tab, 100);

    // 
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        servicePanel = new ServicePanel(this);
        tab.addTab(servicePanel, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource());
    }

    // ?
    serverPanel = new ServerPanel(this);
    tab.addTab(serverPanel, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource());

    // ?
    String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer");
    if (enableLoadBalancer == null || BooleanUtils.toBoolean(enableLoadBalancer)) {
        loadBalancerPanel = new LoadBalancerPanel(this);
        tab.addTab(loadBalancerPanel, ViewProperties.getCaption("tab.loadbalancer"),
                Icons.LOADBALANCER_TAB.resource());
    }

    // ???????
    tab.addListener(new SelectedTabChangeListener() {
        @Override
        public void selectedTabChange(SelectedTabChangeEvent event) {
            MainView.this.selectedTabChange(event);
        }
    });

    // ?
    Refresher timer = new Refresher();
    timer.setRefreshInterval(15 * 1000); //(msec)
    timer.addListener(new Refresher.RefreshListener() {
        @Override
        public void refresh(Refresher source) {
            if (needsRefresh()) {
                refreshTableOnly();
            }
        }
    });
    mainLayout.addComponent(timer);

    // ?
    showLogin();
}

From source file:jp.primecloud.auto.ui.MyCloud.java

License:Open Source License

public MyCloud() {
    setWidth("100%");
    setHeight("100%");
    addStyleName("mycloud-panel");

    VerticalLayout layout = this;
    layout.setMargin(false);//  w w w .  j  a va  2s  . com
    layout.setSpacing(false);

    CssLayout hlay = new CssLayout();
    hlay.setWidth("100%");
    hlay.setHeight("28px");
    hlay.addStyleName("mycloud-name");
    hlay.setMargin(true);

    //??
    lblMycloud = new TextField();
    lblMycloud.setWidth("80%");
    lblMycloud.addStyleName("mycloud-label");
    lblMycloud.setEnabled(false);
    lblMycloud.setReadOnly(true);
    hlay.addComponent(lblMycloud);

    //
    reloadb = new Button(ViewProperties.getCaption("button.reload"));
    reloadb.setDescription(ViewProperties.getCaption("description.reload"));
    reloadb.addStyleName("sync-button");
    reloadb.addStyleName("borderless");
    reloadb.setIcon(Icons.SYNC.resource());
    reloadb.setEnabled(false);
    reloadb.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            // ????
            Component c = MyCloud.this.myCloudTabs.tabDesc.getSelectedTab();
            refresh();
            MyCloud.this.myCloudTabs.tabDesc.setSelectedTab(c);
        }
    });
    hlay.addComponent(reloadb);
    layout.addComponent(hlay);
    //myCloud?
    layout.addComponent(myCloudTabs);

    layout.setExpandRatio(myCloudTabs, 100);

}

From source file:jp.primecloud.auto.ui.MyCloudTabs.java

License:Open Source License

MyCloudTabs() {

    // ??///from  w w  w .  ja v  a2 s  .  com
    String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer");
    this.enableLoadBalancer = (enableLoadBalancer == null) || (BooleanUtils.toBoolean(enableLoadBalancer));

    setSizeFull();

    // ??disable??????
    tabDesc.setSizeFull();
    tabDesc.setEnabled(false);
    tabDesc.addStyleName(Reindeer.TABSHEET_BORDERLESS);

    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.setSpacing(false);
    layout.setMargin(false);

    //
    pnService.setSizeFull();
    pnService.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlService = (VerticalLayout) pnService.getContent();
    vlService.setSizeFull();
    vlService.addStyleName("service-tab");
    vlService.setSpacing(false);
    vlService.setMargin(false);

    //?
    SplitPanel splService = new SplitPanel();
    splService.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splService.setSplitPosition(40);
    splService.setSizeFull();
    vlService.addComponent(splService);
    vlService.setExpandRatio(splService, 10);
    //?
    VerticalLayout layServiceUpper = new VerticalLayout();
    layServiceUpper.setSizeFull();
    layServiceUpper.setSpacing(false);
    layServiceUpper.setMargin(false);
    layServiceUpper.addComponent(serviceButtonsTop);
    layServiceUpper.addComponent(serviceTable);
    layServiceUpper.addComponent(serviceButtonsBottom);
    layServiceUpper.setExpandRatio(serviceTable, 10);
    splService.addComponent(layServiceUpper);
    //?
    splService.addComponent(serviceDesc);

    tabDesc.addTab(pnService, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource());

    //?
    pnServer.setSizeFull();
    pnServer.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlServer = (VerticalLayout) pnServer.getContent();
    vlServer.setSizeFull();
    vlServer.addStyleName("server-tab");
    vlServer.setSpacing(false);
    vlServer.setMargin(false);

    //?
    SplitPanel splServer = new SplitPanel();
    splServer.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splServer.setSplitPosition(40);
    splServer.setSizeFull();
    vlServer.addComponent(splServer);
    //?
    VerticalLayout layServerUpper = new VerticalLayout();
    layServerUpper.setSizeFull();
    layServerUpper.setSpacing(false);
    layServerUpper.setMargin(false);
    layServerUpper.addComponent(serverButtonsTop);
    layServerUpper.addComponent(serverTable);
    layServerUpper.addComponent(serverButtonsBottom);
    layServerUpper.setExpandRatio(serverTable, 10);
    splServer.addComponent(layServerUpper);
    //?
    splServer.addComponent(serverDesc);

    tabDesc.addTab(pnServer, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource());

    //?
    pnLoadBalancer.setSizeFull();
    pnLoadBalancer.addStyleName(Reindeer.PANEL_LIGHT);
    VerticalLayout vlLBalancer = (VerticalLayout) pnLoadBalancer.getContent();
    vlLBalancer.setSizeFull();
    vlLBalancer.addStyleName("loadbalancer-tab");
    vlLBalancer.setSpacing(false);
    vlLBalancer.setMargin(false);

    CssLayout hLBalancer = new CssLayout();
    Label lLBalancer = new Label(ViewProperties.getCaption("label.loadbalancer"));
    hLBalancer.setWidth("100%");
    hLBalancer.setMargin(true);
    hLBalancer.addStyleName("loadbalancer-table-label");
    hLBalancer.addComponent(lLBalancer);
    hLBalancer.setHeight("28px");

    //?
    SplitPanel splLBalancer = new SplitPanel();
    splLBalancer.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splLBalancer.setSplitPosition(40);
    splLBalancer.setSizeFull();
    vlLBalancer.addComponent(splLBalancer);
    //?
    VerticalLayout layLBUpper = new VerticalLayout();
    layLBUpper.setSizeFull();
    layLBUpper.setSpacing(false);
    layLBUpper.setMargin(false);
    layLBUpper.addComponent(hLBalancer);
    layLBUpper.addComponent(loadBalancerTable);
    layLBUpper.addComponent(loadBalancerTableOpe);
    layLBUpper.setExpandRatio(loadBalancerTable, 10);
    splLBalancer.addComponent(layLBUpper);
    //?
    splLBalancer.addComponent(loadBalancerDesc);

    if (this.enableLoadBalancer) {
        tabDesc.addTab(pnLoadBalancer, ViewProperties.getCaption("tab.loadbalancer"),
                Icons.LOADBALANCER_TAB.resource());
    }

    //
    tabDesc.addListener(TabSheet.SelectedTabChangeEvent.class, this, "selectedTabChange");
    layout.addComponent(tabDesc);

    Refresher timer = new Refresher();
    timer.setRefreshInterval(15 * 1000); //(msec)
    timer.addListener(new Refresher.RefreshListener() {
        @Override
        public void refresh(Refresher source) {
            if (needsRefresh()) {
                refreshTableOnly();
            }
        }
    });
    layout.addComponent(timer);
    layout.setExpandRatio(tabDesc, 100);

}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private void initView() {
    setCompositionRoot(root);//w  w  w  .j a v a 2  s. c o m
    root.setSizeFull();
    root.setSplitPosition(15);
    root.setStyleName("small previews");

    previewArea.setWidth("100%");
    previewTabs = new VerticalLayout();
    previewTabs.setSizeFull();
    previewTabs.setHeight(null);

    compoundTabs = new VerticalLayout();
    compoundTabs.setSizeFull();
    compoundTabs.setHeight(null);

    bennuStylesTabs = new VerticalLayout();
    bennuStylesTabs.setSizeFull();
    bennuStylesTabs.setHeight(null);

    VerticalLayout menu = new VerticalLayout();
    menu.setSizeFull();
    menu.setStyleName("sidebar-menu");

    Button syncThemes = new Button("Sync Themes", new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            syncThemes();
        }
    });
    menu.addComponent(syncThemes);
    menu.addComponent(new Label("Single Components"));
    menu.addComponent(previewTabs);
    menu.addComponent(new Label("Compound Styles"));
    menu.addComponent(compoundTabs);

    menu.addComponent(new Label("Bennu Styles"));
    menu.addComponent(bennuStylesTabs);

    root.setFirstComponent(menu);

    CssLayout toolbar = new CssLayout();
    toolbar.setWidth("100%");
    toolbar.setStyleName("toolbar");
    toolbar.addComponent(editorToggle);

    final Window downloadWindow = new Window("Download Theme");
    GridLayout l = new GridLayout(3, 2);
    l.setSizeUndefined();
    l.setMargin(true);
    l.setSpacing(true);
    downloadWindow.setContent(l);
    downloadWindow.setModal(true);
    downloadWindow.setResizable(false);
    downloadWindow.setCloseShortcut(KeyCode.ESCAPE, null);
    downloadWindow.addStyleName("opaque");
    Label caption = new Label("Theme Name");
    l.addComponent(caption);
    l.setComponentAlignment(caption, Alignment.MIDDLE_CENTER);
    final TextField name = new TextField();
    name.setValue("my-chameleon");
    name.addValidator(new RegexpValidator("[a-zA-Z0-9\\-_\\.]+", "Only alpha-numeric characters allowed"));
    name.setRequired(true);
    name.setRequiredError("Please give a name for the theme");
    downloadWindow.addComponent(name);
    Label info = new Label(
            "This is the name you will use to set the theme in your application code, i.e. <code>setTheme(\"my-cameleon\")</code>.",
            Label.CONTENT_XHTML);
    info.addStyleName("tiny");
    info.setWidth("200px");
    l.addComponent(info, 1, 1, 2, 1);

    Button download = new Button(null, new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            getApplication().getMainWindow().addWindow(downloadWindow);
            name.focus();
        }
    });
    download.setDescription("Donwload the current theme");
    download.setIcon(new ThemeResource("download.png"));
    download.setStyleName("icon-only");
    toolbar.addComponent(download);

    menu.addComponent(toolbar);
    menu.setExpandRatio(toolbar, 1);
    menu.setComponentAlignment(toolbar, Alignment.BOTTOM_CENTER);

}