Java Code Examples for com.vaadin.ui.Panel#addComponent()

The following examples show how to use com.vaadin.ui.Panel#addComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WinLoadBalancerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, true, true);
    setSpacing(false);

    // メインフォーム
    Form mainForm = new Form();
    addComponent(mainForm);

    // 監視プロトコル
    checkProtocolSelect = new ComboBox(ViewProperties.getCaption("field.checkProtocol"));
    checkProtocolSelect.setWidth(TEXT_WIDTH);
    checkProtocolSelect.setImmediate(true);
    checkProtocolSelect.setNullSelectionAllowed(false);
    checkProtocolSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            checkProtocolValueChange(event);
        }
    });
    mainForm.getLayout().addComponent(checkProtocolSelect);

    // 監視ポート
    checkPortField = new TextField(ViewProperties.getCaption("field.checkPort"));
    checkPortField.setWidth(TEXT_WIDTH);
    mainForm.getLayout().addComponent(checkPortField);

    // 監視Path
    checkPathField = new TextField(ViewProperties.getCaption("field.checkPath"));
    checkPathField.setImmediate(true);
    mainForm.getLayout().addComponent(checkPathField);

    // ヘルスチェック詳細設定パネル
    Panel panel = new Panel(ViewProperties.getCaption("field.healthCheckDetail"));
    ((Layout) panel.getContent()).setMargin(false, false, false, true);
    ((Layout) panel.getContent()).setHeight("200px");
    ((Layout) panel.getContent()).setWidth("315px");
    mainForm.getLayout().addComponent(panel);

    // サブフォーム
    Form subForm = new Form();
    subForm.setStyleName("panel-healthcheck-setting");
    subForm.getLayout().setMargin(false, false, false, false);
    panel.addComponent(subForm);

    // タイムアウト時間
    checkTimeoutField = new TextField(ViewProperties.getCaption("field.checkTimeout"));
    checkTimeoutField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(checkTimeoutField);

    // ヘルスチェック間隔
    checkIntervalField = new TextField(ViewProperties.getCaption("field.checkInterval"));
    checkIntervalField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(checkIntervalField);

    // 障害閾値
    unhealthyThresholdField = new TextField(ViewProperties.getCaption("field.checkDownThreshold"));
    unhealthyThresholdField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(unhealthyThresholdField);

    // 復帰閾値
    healthyThresholdField = new TextField(ViewProperties.getCaption("field.checkRecoverThreshold"));
    healthyThresholdField.setWidth(TEXT_WIDTH);
    subForm.getLayout().addComponent(healthyThresholdField);

    // UltraMonkeyロードバランサの場合、復帰閾値は設定できない
    if (PCCConstant.LOAD_BALANCER_ULTRAMONKEY.equals(loadBalancerType)) {
        healthyThresholdField.setEnabled(false);
    }

    initValidation();
}
 
Example 2
Source File: WinServerEdit.java    From primecloud-controller with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void attach() {
    setHeight(TAB_HEIGHT);
    setMargin(false, true, false, true);
    setSpacing(false);

    Form form = new Form();
    form.setSizeFull();
    form.addStyleName("win-server-edit-form");

    // サーバ名
    serverNameField = new TextField(ViewProperties.getCaption("field.serverName"));
    form.getLayout().addComponent(serverNameField);

    // ホスト名
    hostNameField = new TextField(ViewProperties.getCaption("field.hostName"));
    hostNameField.setWidth("100%");
    form.getLayout().addComponent(hostNameField);

    // コメント
    commentField = new TextField(ViewProperties.getCaption("field.comment"));
    commentField.setWidth("100%");
    form.getLayout().addComponent(commentField);

    // プラットフォーム
    CssLayout cloudLayout = new CssLayout();
    cloudLayout.setWidth("100%");
    cloudLayout.setCaption(ViewProperties.getCaption("field.cloud"));
    cloudLabel = new Label();
    cloudLayout.addComponent(cloudLabel);
    form.getLayout().addComponent(cloudLayout);

    // サーバ種別
    CssLayout imageLayout = new CssLayout();
    imageLayout.setWidth("100%");
    imageLayout.setCaption(ViewProperties.getCaption("field.image"));
    imageLabel = new Label();
    imageLayout.addComponent(imageLabel);
    form.getLayout().addComponent(imageLayout);

    // OS
    CssLayout osLayout = new CssLayout();
    osLayout.setWidth("100%");
    osLayout.setCaption(ViewProperties.getCaption("field.os"));
    osLabel = new Label();
    osLayout.addComponent(osLabel);
    form.getLayout().addComponent(osLayout);

    // ロードバランサでない場合
    if (BooleanUtils.isNotTrue(instance.getInstance().getLoadBalancer())) {
        // サービスを有効にするかどうか
        String enableService = Config.getProperty("ui.enableService");

        // サービスを有効にする場合
        if (StringUtils.isEmpty(enableService) || BooleanUtils.toBoolean(enableService)) {
            // 利用可能サービス
            Panel panel = new Panel();
            serviceTable = new AvailableServiceTable();
            panel.addComponent(serviceTable);
            form.getLayout().addComponent(panel);
            panel.setSizeFull();

            // サービス選択ボタン
            Button attachServiceButton = new Button(ViewProperties.getCaption("button.serverAttachService"));
            attachServiceButton.setDescription(ViewProperties.getCaption("description.serverAttachService"));
            attachServiceButton.setIcon(Icons.SERVICETAB.resource());
            attachServiceButton.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    attachServiceButtonClick(event);
                }
            });

            HorizontalLayout layout = new HorizontalLayout();
            layout.setSpacing(true);
            layout.addComponent(attachServiceButton);
            Label label = new Label(ViewProperties.getCaption("label.serverAttachService"));
            layout.addComponent(label);
            layout.setComponentAlignment(label, Alignment.MIDDLE_LEFT);
            form.getLayout().addComponent(layout);
        }
    }

    addComponent(form);
}