Example usage for com.vaadin.ui Button setDescription

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

Introduction

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

Prototype

public void setDescription(String description) 

Source Link

Document

Sets the component's description.

Usage

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

License:Open Source License

MyCloudManage(Application ap) {

    apl = ap;/*w  ww .  j  a va2 s.  co  m*/
    //
    setIcon(Icons.EDITMINI.resource());

    setCaption(ViewProperties.getCaption("window.myCloudManage"));
    setModal(true);
    setWidth("550px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);

    // ?
    HorizontalLayout tbar = new HorizontalLayout();
    tbar.setWidth("100%");
    tbar.setSpacing(true);

    // ?
    Label tcaption = new Label(ViewProperties.getCaption("table.cloud"));
    tcaption.setWidth("300px");
    tbar.addComponent(tcaption);
    tbar.setComponentAlignment(tcaption, Alignment.MIDDLE_LEFT);

    // Edit
    Button editButton = new Button(ViewProperties.getCaption("button.editCloud"));
    editButton.setDescription(ViewProperties.getCaption("description.editCloud"));
    editButton.setIcon(Icons.EDITMINI.resource());
    editButton.setWidth("85px");
    editButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.editButtonClick(event);
        }
    });
    tbar.addComponent(editButton);
    tbar.setComponentAlignment(editButton, Alignment.BOTTOM_RIGHT);

    // Delete
    Button deleteButton = new Button(ViewProperties.getCaption("button.delete"));
    deleteButton.setDescription(ViewProperties.getCaption("description.delete"));
    deleteButton.setWidth("85px");
    deleteButton.setIcon(Icons.DELETEMINI.resource());
    deleteButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {

            MyCloudManage.this.deleteButtonClick(event);
        }
    });
    tbar.addComponent(deleteButton);
    tbar.setComponentAlignment(deleteButton, Alignment.BOTTOM_RIGHT);
    tbar.setExpandRatio(tcaption, 10);
    layout.addComponent(tbar);

    // ?
    Label spacer1 = new Label("");
    spacer1.setHeight("5px");
    layout.addComponent(spacer1);

    // 
    cloudTable = new CloudTable();
    layout.addComponent(cloudTable);

    // ?
    Label spacer2 = new Label("");
    spacer2.setHeight("7px");
    layout.addComponent(spacer2);

    // ??
    HorizontalLayout bbar = new HorizontalLayout();
    bbar.setWidth("100%");
    HorizontalLayout rlay = new HorizontalLayout();
    rlay.setSpacing(true);

    // New
    Button addButton = new Button(ViewProperties.getCaption("button.newCloud"));
    addButton.setDescription(ViewProperties.getCaption("description.newCloud"));
    addButton.setIcon(Icons.ADD.resource());
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.addButtonClick(event);
        }
    });
    bbar.addComponent(addButton);
    bbar.setComponentAlignment(addButton, Alignment.MIDDLE_LEFT);

    // Switch
    Button switchButton = new Button(ViewProperties.getCaption("button.switch"));
    switchButton.setDescription(ViewProperties.getCaption("description.mycloud.switch"));
    switchButton.setWidth("85px");
    switchButton.setIcon(Icons.SELECTMINI.resource());
    switchButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.switchButtonClick(event);
        }
    });
    // [Enter]?switchButton
    switchButton.setClickShortcut(KeyCode.ENTER);
    switchButton.focus();
    rlay.addComponent(switchButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.setWidth("85px");
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudManage.this.close();
        }
    });
    rlay.addComponent(cancelButton);

    bbar.addComponent(rlay);
    bbar.setComponentAlignment(rlay, Alignment.MIDDLE_RIGHT);

    layout.addComponent(bbar);

    // ???
    initData();

    //???/?
    if (ViewContext.getPowerUser()) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
        //??????????????
        if (ViewContext.getPowerUser()
                && !ViewContext.getPowerDefaultMaster().equals(ViewContext.getLoginUser())) {
            addButton.setEnabled(false);
        }

    } else if (ViewContext.getUserNo().equals(ViewContext.getLoginUser())) {
        addButton.setEnabled(true);
        deleteButton.setEnabled(true);
        editButton.setEnabled(true);
    } else {
        addButton.setEnabled(false);
        deleteButton.setEnabled(false);
        editButton.setEnabled(false);
    }

    // 
    showClouds();
}

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

License:Open Source License

public void setButtonStatus(Instance instance) {
    for (Entry<Long, List<Button>> entry : map.entrySet()) {
        Long key = entry.getKey();
        if (key.equals(instance.getInstanceNo())) {
            for (Button button : entry.getValue()) {
                if ("".equals(instance.getStatus())
                        || InstanceStatus.STOPPED.toString().equals(instance.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(false);
                    } else if (("START".equals(button.getCaption()))) {
                        button.setIcon(Icons.PLAY.resource());
                        button.setDescription(ViewProperties.getCaption("description.startServer"));
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(true);
                    }/*from  w  w  w .  j  ava 2 s. co  m*/
                } else if (InstanceStatus.RUNNING.toString().equals(instance.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(true);
                    } else if (("START".equals(button.getCaption()))) {
                        button.setIcon(Icons.RELOAD.resource());
                        button.setDescription(ViewProperties.getCaption("description.reloadServer"));
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(false);
                    }
                } else if (InstanceStatus.WARNING.toString().equals(instance.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(false);
                    }
                } else {
                    button.setEnabled(false);
                }
            }
        } else {
            for (Button button : entry.getValue()) {
                button.setEnabled(false);
            }
        }
    }
}

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

License:Open Source License

public void setButtonStatus(ComponentDto dto) {
    //????????//from  w  w  w .j  a  va 2 s .  c om
    //  START,EDIT,STOP 
    // ? START,EDIT,DELETE 
    // ???
    // WARNINGEDIT,STOP 

    jp.primecloud.auto.entity.crud.Component component = dto.getComponent();
    for (Entry<Long, List<Button>> entry : map.entrySet()) {
        Long key = entry.getKey();
        if (key.equals(component.getComponentNo())) {
            for (Button button : entry.getValue()) {
                if ("".equals(dto.getStatus()) || "STOPPED".equals(dto.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(false);
                    } else if (("START".equals(button.getCaption()))) {
                        button.setIcon(Icons.PLAY.resource());
                        button.setDescription(ViewProperties.getCaption("description.startService"));
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(true);
                    }
                } else if ("RUNNING".equals(dto.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(true);
                    } else if (("START".equals(button.getCaption()))) {
                        button.setIcon(Icons.RELOAD.resource());
                        button.setDescription(ViewProperties.getCaption("description.reloadService"));
                        button.setEnabled(true);
                    } else if (("EDIT".equals(button.getCaption()))) {
                        button.setEnabled(true);
                    } else {
                        button.setEnabled(false);
                    }
                } else if ("WARNING".equals(dto.getStatus())) {
                    if (("STOP".equals(button.getCaption()))) {
                        button.setEnabled(true);
                    } else if ("START".equals(button.getCaption())) {
                        button.setIcon(Icons.RELOAD.resource());
                        button.setDescription(ViewProperties.getCaption("description.reloadService"));
                        button.setEnabled(true);
                    } else if ("EDIT".equals(button.getCaption())) {
                        // ????????????
                        boolean processing = false;
                        for (ComponentInstanceDto componentInstance : dto.getComponentInstances()) {
                            ComponentInstanceStatus status = ComponentInstanceStatus
                                    .fromStatus(componentInstance.getComponentInstance().getStatus());
                            if (status != ComponentInstanceStatus.RUNNING
                                    && status != ComponentInstanceStatus.WARNING
                                    && status != ComponentInstanceStatus.STOPPED) {
                                processing = true;
                                break;
                            }
                        }
                        button.setEnabled(!processing);
                    } else {
                        button.setEnabled(false);
                    }
                } else {
                    button.setEnabled(false);
                }
            }
        } else {
            for (Button button : entry.getValue()) {
                button.setEnabled(false);
            }
        }
    }
}

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

License:Open Source License

@Override
public void attach() {
    addStyleName("TopBar");
    setWidth("100%");
    setHeight("30px");
    setMargin(false, true, false, false);

    // PrimeCloud
    Label plbl = new Label(IconUtils.createImageTag(getApplication(), Icons.PCCLOGO), Label.CONTENT_XHTML);
    plbl.addStyleName("logo");
    addComponent(plbl);/*  w w w.  jav a 2s  .  c  o m*/

    // ??
    String versionProp = Config.getVersionProperty("version");
    if (StringUtils.isNotEmpty(versionProp)) {
        StringBuilder version = new StringBuilder();
        version.append("ver").append(versionProp);
        Label versionNo = new Label("<p>" + version.toString() + "</p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNo");
        addComponent(versionNo);
    } else {
        Label versionNo = new Label("<p></p>", Label.CONTENT_XHTML);
        versionNo.addStyleName("versionNoNone");
        addComponent(versionNo);
    }

    // myCloud?
    Button myCloudButton = new Button(ViewProperties.getCaption("button.myCloudManage"));
    myCloudButton.setDescription(ViewProperties.getCaption("description.myCloudManage"));
    myCloudButton.addStyleName("borderless");
    myCloudButton.addStyleName("mycloud");
    myCloudButton.setIcon(Icons.CLOUDBIG.resource());
    myCloudButton.setVisible(true);
    myCloudButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            showCloudEditWindow();
        }
    });
    addComponent(myCloudButton);

    // (Zabbix)
    String useZabbix = Config.getProperty("zabbix.useZabbix");
    if (useZabbix == null || BooleanUtils.toBoolean(useZabbix)) {
        String url = Config.getProperty("zabbix.display");
        Link zabbix = new Link(ViewProperties.getCaption("link.zabbix"), new ExternalResource(url));
        zabbix.setDescription(ViewProperties.getCaption("description.link.zabbix"));
        zabbix.setIcon(Icons.MNGSYSTEM.resource());
        zabbix.setTargetName("_blank");
        zabbix.addStyleName("zabbix");
        addComponent(zabbix);
    }

    // 
    Button eventLogButton = new Button(ViewProperties.getCaption("link.eventlog"));
    eventLogButton.setDescription(ViewProperties.getCaption("description.link.eventlog"));
    eventLogButton.addStyleName("borderless");
    eventLogButton.addStyleName("eventlog");
    eventLogButton.setIcon(Icons.CUSTOM.resource());
    eventLogButton.setVisible(true);
    eventLogButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            WinLogView window = new WinLogView();
            getApplication().addWindow(window);
            getApplication().getMainWindow().open(new ExternalResource(window.getURL()), "_blank");
        }
    });
    addComponent(eventLogButton);

    // 
    Boolean usePayment = BooleanUtils.toBooleanObject(Config.getProperty("payment.usePayment"));
    if (BooleanUtils.isTrue(usePayment)) {
        String url2 = Config.getProperty("payment.display");
        Link payment = new Link(ViewProperties.getCaption("link.payment"), new ExternalResource(url2));
        payment.setDescription(ViewProperties.getCaption("description.link.payment"));
        payment.setIcon(Icons.PAYSYSTEM.resource());
        payment.setTargetName("_payment");
        payment.addStyleName("payment");
        addComponent(payment);
    }

    // 
    Button logoutButton = new Button(ViewProperties.getCaption("button.logout"));
    logoutButton.setDescription(ViewProperties.getCaption("description.logout"));
    logoutButton.addStyleName("borderless");
    logoutButton.addStyleName("logout");
    logoutButton.setIcon(Icons.LOGOUT.resource());
    logoutButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.dialogConfirm"),
                    ViewMessages.getMessage("IUI-000001"), Buttons.OKCancel);
            Callback callback = new Callback() {
                @Override
                public void onDialogResult(Result result) {
                    if (result == Result.OK) {
                        // ?
                        LoggingUtils.removeContext();
                        ContextUtils.invalidateSession();
                        accountButton.setVisible(false);

                        // ????
                        getApplication().close();
                    }
                }
            };
            dialog.setCallback(callback);
            getApplication().getMainWindow().addWindow(dialog);
        }
    });
    addComponent(logoutButton);

    // ?
    accountButton = new Button(ViewProperties.getCaption("button.account"));
    accountButton.setDescription(ViewProperties.getCaption("description.account"));
    accountButton.addStyleName("borderless");
    accountButton.addStyleName("account");
    accountButton.setIcon(Icons.USER.resource());
    accountButton.setVisible(false);
    addComponent(accountButton);
}

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

License:Open Source License

WinLogin() {
    // Window/*from  w  ww  .  ja v  a 2 s.c  o  m*/
    setIcon(Icons.LOGIN.resource());
    setCaption(ViewProperties.getCaption("window.login"));
    setModal(true);
    setWidth("300px");
    setResizable(false);
    setClosable(false);

    // Layout
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Form
    form = new Form();
    form.addStyleName("form-login");
    usernameField = new TextField(ViewProperties.getCaption("field.userName"));
    usernameField.setWidth("90%");
    passwordField = new TextField(ViewProperties.getCaption("field.password"));
    passwordField.setSecret(true);
    passwordField.setWidth("90%");

    form.getLayout().addComponent(usernameField);
    form.getLayout().addComponent(passwordField);
    layout.addComponent(form);

    //
    usernameField.focus();

    // Button
    Button ok = new Button(ViewProperties.getCaption("button.login"));
    ok.setDescription(ViewProperties.getCaption("description.login"));

    ok.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            loginButtonClick(event);
        }
    });

    // [Enter]?OK
    ok.setClickShortcut(KeyCode.ENTER);

    layout.addComponent(ok);
    layout.setComponentAlignment(ok, "right");

    // ??
    initValidation();
}

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

License:Open Source License

WinServerAdd(Application ap) {
    apl = ap;//from w  ww.  j  av  a 2 s.  c o m

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.winServerAdd"));
    setModal(true);
    setWidth("620px");
    //setHeight("600px");

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new BasicForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.addServer"));

    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            addButtonClick(event);
        }
    });

    // [Enter]?addButton
    addButton.setClickShortcut(KeyCode.ENTER);
    addButton.focus();
    okbar.addComponent(addButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ???
    initData();

    // ?
    showClouds();
}

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

License:Open Source License

WinServerAddSimple(Application ap, Long componentTypeNo) {

    apl = ap;/*  ww w. jav  a  2 s .co m*/
    this.componentTypeNo = componentTypeNo;

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.winServerAddSimple"));
    setModal(true);
    setWidth("450px");
    setResizable(false);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true, true, false, true);
    layout.setSpacing(false);

    // 
    layout.addComponent(new ServerAddForm());

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.add"));
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            final List<String> serverNames = getServerNames();
            DialogConfirm dialog = null;
            String message = "";
            if (serverNames == null) {
                return;
            } else if (serverNames.size() > 1) {
                message = ViewMessages.getMessage("IUI-000043", serverNames.get(0),
                        serverNames.get(serverNames.size() - 1), serverNames.size());
            } else {
                message = ViewMessages.getMessage("IUI-000042", serverNames.get(0), serverNames.size());
            }
            dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message, Buttons.OKCancel);
            dialog.setCallback(new DialogConfirm.Callback() {
                @Override
                public void onDialogResult(Result result) {
                    if (result != Result.OK) {
                        return;
                    } else {
                        addButtonClick(serverNames);
                    }

                }
            });
            getApplication().getMainWindow().addWindow(dialog);
        }
    });
    okbar.addComponent(addButton);

    // Cancel
    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);

    // ??
    initValidation();

    // ???
    initData();

    // ?
    showClouds();
}

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

License:Open Source License

WinServerDataDiskConfig(Application ap, Long instanceNo, DataDiskDto dataDiskDto) {
    this.ap = ap;
    this.instanceNo = instanceNo;
    this.dataDiskDto = dataDiskDto;

    // Window/*www.  j  a v  a2 s  . c om*/
    isAddMode = (this.dataDiskDto == null) ? true : false;
    if (isAddMode) {
        //?
        setIcon(Icons.ADD.resource());
        setCaption(ViewProperties.getCaption("window.WinServerAddDataDisk"));
    } else {
        //?
        setIcon(Icons.EDIT.resource());
        setCaption(ViewProperties.getCaption("window.WinServerEditDataDisk"));
    }
    setModal(true);
    setWidth("400px");
    setResizable(false);

    // Layout
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Form
    Form form = new Form();
    txtDiskSize = new TextField(ViewProperties.getCaption("field.diskSize"));
    txtDiskSize.setWidth("90%");

    form.getLayout().addComponent(txtDiskSize);
    layout.addComponent(form);

    // ??
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.setMargin(false, true, true, false);
    layout.addComponent(buttonBar);
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    // OK Button
    Button btnOk = new Button(ViewProperties.getCaption("button.ok"));
    btnOk.setDescription(ViewProperties.getCaption("description.ok"));
    btnOk.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    buttonBar.addComponent(btnOk);
    // [Enter]?OK
    btnOk.setClickShortcut(KeyCode.ENTER);

    //Cancel Button
    Button btnCancel = new Button(ViewProperties.getCaption("button.cancel"));
    btnCancel.setDescription(ViewProperties.getCaption("description.cancel"));
    btnCancel.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttonBar.addComponent(btnCancel);

    //
    showData();

    // ??
    initValidation();
}

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

License:Open Source License

WinServerEdit(Application ap, Long instanceNo) {
    apl = ap;//from  w w w.j  a v a  2s.co  m
    this.instanceNo = instanceNo;

    // ???
    initData();

    //
    setCaption(ViewProperties.getCaption("window.winServerEdit"));
    setModal(true);
    setWidth("600px");
    setIcon(Icons.EDITMINI.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(false, true, false, true);
    layout.setSpacing(true);

    //Tab?
    basicTab = new BasicTab();
    tab.addTab(basicTab, ViewProperties.getCaption("tab.basic"), Icons.BASIC.resource());
    layout.addComponent(tab);
    // ??
    basicTab.initValidation();
    // ?
    basicTab.showData();

    //Tab?
    String platformType = platformDto.getPlatform().getPlatformType();
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformType)) {
        awsDetailTab = new AWSDetailTab();
        tab.addTab(awsDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        awsDetailTab.initValidation();
        // ?
        awsDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platformType)) {
        vmwareDetailTab = new VMWareDetailTab();
        tab.addTab(vmwareDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        // ??
        vmwareDetailTab.initValidation();
        // ?
        vmwareDetailTab.showData();

        boolean enableVmwareStaticIp = BooleanUtils.toBoolean(Config.getProperty("ui.enableVmwareEditIp"));
        if (BooleanUtils.isTrue(enableVmwareStaticIp)) {
            this.vmwareEditIpTab = new VmwareEditIpTab();
            tab.addTab(vmwareEditIpTab, ViewProperties.getCaption("tab.editIp"), Icons.DETAIL.resource());
            this.vmwareEditIpTab.showData();
            this.vmwareEditIpTab.initValidation();
        }

        layout.addComponent(tab);

    } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platformType)) {
        niftyDetailTab = new NiftyDetailTab();
        tab.addTab(niftyDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        niftyDetailTab.initValidation();
        // ?
        niftyDetailTab.showData();

    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformType)) {
        cloudStackDetailTab = new CloudStackDetailTab();
        tab.addTab(cloudStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        cloudStackDetailTab.initValidation();
        // ?
        cloudStackDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platformType)) {
        //
        vcloudDetailTab = new VcloudDetailTab();
        tab.addTab(vcloudDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        // ??
        vcloudDetailTab.initValidation();
        // ?
        vcloudDetailTab.showData();

        //?
        vcloudNetworkTab = new VcloudNetworkTab();
        tab.addTab(vcloudNetworkTab, ViewProperties.getCaption("tab.network"), Icons.DETAIL.resource());
        vcloudNetworkTab.showData();

        layout.addComponent(tab);
    } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platformType)) {
        azureDetailTab = new AzureDetailTab();
        tab.addTab(azureDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        azureDetailTab.initValidation();
        // ?
        azureDetailTab.showData();
    } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platformType)) {
        openStackDetailTab = new OpenStackDetailTab();
        tab.addTab(openStackDetailTab, ViewProperties.getCaption("tab.detail"), Icons.DETAIL.resource());
        layout.addComponent(tab);
        // ??
        openStackDetailTab.initValidation();
        // ?
        openStackDetailTab.showData();
    }

    //        tab.addTab(new UserTab(), "", new ThemeResource("icons/user.png"));
    //        layout.addComponent(tab);

    // ??
    HorizontalLayout okbar = new HorizontalLayout();
    okbar.setSpacing(true);
    okbar.setMargin(false, false, true, false);
    layout.addComponent(okbar);
    layout.setComponentAlignment(okbar, Alignment.BOTTOM_RIGHT);

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editServer.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    okbar.addComponent(okButton);
    // [Enter]?okButton
    okButton.setClickShortcut(KeyCode.ENTER);
    okButton.focus();

    Button cancelButton = new Button(ViewProperties.getCaption("button.cancel"));
    cancelButton.setDescription(ViewProperties.getCaption("description.cancel"));
    cancelButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    okbar.addComponent(cancelButton);
}

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

License:Open Source License

WinServerNetworkConfig(Application ap, Long instanceNo, Long platformNo, InstanceNetworkDto instanceNetworkDto,
        List<InstanceNetworkDto> instanceNetworkDtos) {
    this.ap = ap;
    this.instanceNo = instanceNo;
    this.platformNo = platformNo;
    this.instanceNetworkDto = instanceNetworkDto;
    this.isAddMode = (this.instanceNetworkDto == null) ? true : false;
    this.instanceNetworkDtos = instanceNetworkDtos;

    // Window//from  w  ww  . ja va  2  s . c  o  m
    if (isAddMode) {
        //?
        setIcon(Icons.ADD.resource());
        setCaption(ViewProperties.getCaption("window.WinServerAddNetwork"));
    } else {
        //?
        setIcon(Icons.EDIT.resource());
        setCaption(ViewProperties.getCaption("window.WinServerEditNetwork"));
    }
    setModal(true);
    setWidth("380px");
    setResizable(false);

    // Layout
    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Form
    Form form = new Form();

    //??
    networkSelect = new ComboBox(ViewProperties.getCaption("field.netWork"));
    networkSelect.setWidth(COMBOBOX_WIDTH);
    networkSelect.setNullSelectionAllowed(false);
    networkSelect.setItemCaptionPropertyId(CID_NETWORK);
    networkSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    networkSelect.setImmediate(true);
    networkSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            changeNetwork(event);
        }
    });

    //IP?
    ipModeSelect = new ComboBox(ViewProperties.getCaption("caption.field.ipMode"));
    ipModeSelect.setWidth(COMBOBOX_WIDTH);
    ipModeSelect.setNullSelectionAllowed(false);
    ipModeSelect.setItemCaptionPropertyId(CID_IP_MODE);
    ipModeSelect.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    ipModeSelect.setImmediate(true);
    ipModeSelect.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            changeIpMode(event);
        }
    });

    //IP
    ipAddressField = new TextField(ViewProperties.getCaption("field.ipAddress"));
    ipAddressField.setWidth("100%");
    ipAddressField.setImmediate(true);

    //?
    netmaskField = new TextField(ViewProperties.getCaption("field.netmask"));
    netmaskField.setWidth("100%");
    netmaskField.setReadOnly(true);
    netmaskField.setImmediate(true);

    //
    gateWayField = new TextField(ViewProperties.getCaption("field.gateway"));
    gateWayField.setWidth("100%");
    gateWayField.setReadOnly(true);
    gateWayField.setImmediate(true);

    //DNS1
    dns1Field = new TextField(ViewProperties.getCaption("field.dns1"));
    dns1Field.setWidth("100%");
    dns1Field.setReadOnly(true);
    dns1Field.setImmediate(true);

    //DNS2
    dns2Field = new TextField(ViewProperties.getCaption("field.dns2"));
    dns2Field.setWidth("100%");
    dns2Field.setReadOnly(true);
    dns2Field.setImmediate(true);

    //Primary
    primaryOpg = new OptionGroup(ViewProperties.getCaption("field.primary"));
    primaryOpg.addItem(CID_PRIMARY);
    primaryOpg.setItemCaption(CID_PRIMARY, "");
    primaryOpg.setNullSelectionAllowed(false);
    primaryOpg.setImmediate(true);

    form.getLayout().addComponent(networkSelect);
    form.getLayout().addComponent(ipModeSelect);
    form.getLayout().addComponent(ipAddressField);
    form.getLayout().addComponent(netmaskField);
    form.getLayout().addComponent(gateWayField);
    form.getLayout().addComponent(dns1Field);
    form.getLayout().addComponent(dns2Field);
    form.getLayout().addComponent(primaryOpg);
    layout.addComponent(form);

    // ??
    HorizontalLayout buttonBar = new HorizontalLayout();
    buttonBar.setSpacing(true);
    buttonBar.setMargin(false, true, true, false);
    layout.addComponent(buttonBar);
    layout.setComponentAlignment(buttonBar, Alignment.BOTTOM_RIGHT);

    // OK Button
    Button btnOk = new Button(ViewProperties.getCaption("button.ok"));
    btnOk.setDescription(ViewProperties.getCaption("description.ok"));
    btnOk.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            okButtonClick(event);
        }
    });
    buttonBar.addComponent(btnOk);
    // [Enter]?OK
    btnOk.setClickShortcut(KeyCode.ENTER);

    //Cancel Button
    Button btnCancel = new Button(ViewProperties.getCaption("button.cancel"));
    btnCancel.setDescription(ViewProperties.getCaption("description.cancel"));
    btnCancel.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    buttonBar.addComponent(btnCancel);

    //?
    initData();

    //
    showData();

    // ??
    initValidation();
}