Example usage for com.vaadin.ui VerticalLayout setComponentAlignment

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

Introduction

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

Prototype

@Override
    public void setComponentAlignment(Component childComponent, Alignment alignment) 

Source Link

Usage

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

License:Open Source License

MyCloudAdd(Application ap) {
    apl = ap;/*w ww. j  ava2s  .  com*/

    //
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.myCloudAdd"));
    setModal(true);
    setWidth("550px");

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

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

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

    // Add
    Button addButton = new Button(ViewProperties.getCaption("button.add"));
    addButton.setDescription(ViewProperties.getCaption("description.mycloud.add"));
    addButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudAdd.this.addButtonClick(event);
        }
    });
    okbar.addComponent(addButton);

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

    // ??
    initValidation();

    // ???
    initData();

    // 
    showTemplates();
}

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

License:Open Source License

MyCloudEdit(Application apl, Long farmNo) {
    this.apl = apl;
    this.farmNo = farmNo;

    ///* ww  w .  jav  a 2 s  . c  om*/
    setIcon(Icons.ADD.resource());
    setCaption(ViewProperties.getCaption("window.myCloudEdit"));
    setModal(true);
    setWidth("450px");

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

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

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

    // OK
    Button okButton = new Button(ViewProperties.getCaption("button.ok"));
    okButton.setDescription(ViewProperties.getCaption("description.editCloud.ok"));
    okButton.addListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            MyCloudEdit.this.editButtonClick(event);
        }
    });
    okbar.addComponent(okButton);

    // 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) {
            MyCloudEdit.this.close();
        }
    });
    okbar.addComponent(cancelButton);

    //???
    initData();

    // ??
    initValidation();

}

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

License:Open Source License

private void startButtonClick(Button.ClickEvent event) {
    final InstanceDto instance = (InstanceDto) sender.serverPanel.serverTable.getValue();
    PlatformDto platform = instance.getPlatform();

    // AWS??//from   w ww. j  a v  a2 s . c o  m
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platform.getPlatform().getPlatformType())) {
        // ????????
        if (BooleanUtils.isTrue(platform.getPlatformAws().getVpc())
                && StringUtils.isEmpty(instance.getAwsInstance().getSubnetId())) {
            throw new AutoApplicationException("IUI-000111");
        }
    }
    // Azure??
    else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platform.getPlatform().getPlatformType())) {
        // ????????
        if (StringUtils.isEmpty(instance.getAzureInstance().getSubnetId())) {
            throw new AutoApplicationException("IUI-000111");
        }

        // ?
        ProcessService processService = BeanContext.getBean(ProcessService.class);
        boolean startupErrFlg = processService.checkStartup(platform.getPlatform().getPlatformType(),
                instance.getAzureInstance().getInstanceName(), instance.getAzureInstance().getInstanceNo());
        if (startupErrFlg == true) {
            // ????????????
            // ?No???
            throw new AutoApplicationException("IUI-000133");
        }
    }

    // ?
    VerticalLayout optionLayout = null;
    final CheckBox checkBox;
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        optionLayout = new VerticalLayout();
        checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false);
        checkBox.setImmediate(true);
        optionLayout.addComponent(checkBox);
        optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER);
    } else {
        checkBox = null;
    }

    // ?
    String actionName = event.getButton().getDescription();
    String message = ViewMessages.getMessage("IUI-000013",
            new Object[] { instance.getInstance().getInstanceName(), actionName });
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancel, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            boolean startService = (checkBox == null) ? false : (Boolean) checkBox.getValue();
            start(instance.getInstance().getInstanceNo(), startService);
        }
    });

    getApplication().getMainWindow().addWindow(dialog);
}

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

License:Open Source License

private void startAllButtonClick(ClickEvent event) {
    // ?/*  ww w . ja va  2s .c  o m*/
    VerticalLayout optionLayout = null;
    final CheckBox checkBox;
    String enableService = Config.getProperty("ui.enableService");
    if (enableService == null || BooleanUtils.toBoolean(enableService)) {
        optionLayout = new VerticalLayout();
        checkBox = new CheckBox(ViewMessages.getMessage("IUI-000035"), false);
        checkBox.setImmediate(true);
        optionLayout.addComponent(checkBox);
        optionLayout.setComponentAlignment(checkBox, Alignment.MIDDLE_CENTER);
    } else {
        checkBox = null;
    }

    // ?
    String message = ViewMessages.getMessage("IUI-000011");
    DialogConfirm dialog = new DialogConfirm(ViewProperties.getCaption("dialog.confirm"), message,
            Buttons.OKCancelConfirm, optionLayout);
    dialog.setCallback(new DialogConfirm.Callback() {
        @Override
        public void onDialogResult(Result result) {
            if (result != Result.OK) {
                return;
            }

            boolean startService = (checkBox == null) ? false : (Boolean) checkBox.getValue();
            startAll(startService);
        }
    });

    getApplication().getMainWindow().addWindow(dialog);
}

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

License:Open Source License

WinLogin() {
    // Window//from  w ww  . ja va2 s. co  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.WinPassword.java

License:Open Source License

public WinPassword(InstanceDto instanceDto, final Long instanceNo) {
    setCaption(ViewProperties.getCaption("description.getPassword"));
    setModal(true);//w w w.  ja v a2  s.co m
    setWidth("580px");
    setIcon(Icons.EDITMINI.resource());

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setStyleName("win-password");

    //
    PlatformDto platformDto = instanceDto.getPlatform();
    String keyName = "";
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getAwsInstance().getKeyName();
    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformDto.getPlatform().getPlatformType())) {
        keyName = instanceDto.getCloudstackInstance().getKeyName();
    }

    Label privateKeyLabel = new Label(ViewMessages.getMessage("IUI-000099", keyName));
    layout.addComponent(privateKeyLabel);

    privateKeyField = new TextField();
    privateKeyField.setSizeFull();
    privateKeyField.setRows(10);

    privateKeyField.setStyleName("privatekey");
    layout.addComponent(privateKeyField);

    passwordField = new TextField("");
    passwordField.setColumns(20);

    passwordField.setCaption(ViewProperties.getCaption("label.password"));
    passwordField.setStyleName("password");
    layout.addComponent(passwordField);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.setMargin(true);
    horizontalLayout.setSpacing(true);

    passwordButton = new Button(ViewProperties.getCaption("button.getPassword"));
    passwordButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            getPassword(instanceNo);
        }
    });

    horizontalLayout.addComponent(passwordButton);

    closeButton = new Button(ViewProperties.getCaption("button.close"));
    closeButton.addListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            close();
        }
    });
    horizontalLayout.addComponent(closeButton);

    layout.addComponent(horizontalLayout);
    layout.setComponentAlignment(horizontalLayout, Alignment.BOTTOM_RIGHT);
    layout.setComponentAlignment(passwordField, Alignment.MIDDLE_CENTER);

    initValidation();
}

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

License:Open Source License

WinServerAdd(Application ap) {
    apl = ap;/*from w  w  w .  ja  va 2  s. c  om*/

    //
    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;/*from   w ww  .  j  a  v  a 2 s . c om*/
    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//from   w  w w  .  ja  v a  2 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  ww  .j  a v  a  2  s. 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);
}