Example usage for com.vaadin.ui Label setHeight

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

Introduction

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

Prototype

@Override
    public void setHeight(String height) 

Source Link

Usage

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

License:Open Source License

private void showTemplates() {
    templateTable.removeAllItems();/*w  w  w.  j  ava2s.co  m*/

    // ????
    for (int i = 0; i < templates.size(); i++) {
        TemplateDto template = templates.get(i);

        // ??
        String name = template.getTemplate().getTemplateNameDisp();
        Icons nameIcon = Icons.CUSTOM;
        Label slbl = new Label(
                "<img src=\"" + VaadinUtils.getIconPath(apl, nameIcon) + "\"><div>" + name + "</div>",
                Label.CONTENT_XHTML);
        slbl.setHeight(COLUMN_HEIGHT);

        templateTable.addItem(new Object[] { (i + 1), slbl }, template);
    }

    // ???
    templateTable.select(templateTable.firstItemId());
}

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

License:Open Source License

MyCloudManage(Application ap) {

    apl = ap;//from  w ww .  j  a v  a2  s .  c  o 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.MyCloudManage.java

License:Open Source License

private void showClouds() {
    cloudTable.removeAllItems();//from  w ww  . j  a v  a  2s. co m

    // ????
    for (int i = 0; i < farms.size(); i++) {
        FarmDto farm = farms.get(i);

        // ??

        Icons nameIcon = Icons.CLOUD;
        Label slbl = new Label("<img src=\"" + VaadinUtils.getIconPath(apl, nameIcon) + "\"><div>"
                + farm.getFarm().getFarmName() + "</div>", Label.CONTENT_XHTML);
        slbl.setHeight(COLUMN_HEIGHT);

        // 
        String comment = farm.getFarm().getComment();
        cloudTable.addItem(new Object[] { (i + 1), slbl, comment }, farm);

    }
    // ?????????????
    Long curFarmNo = ViewContext.getFarmNo();
    if (curFarmNo != null) {
        for (int i = 0; i < farms.size(); i++) {
            FarmDto farm = farms.get(i);
            if (farm.getFarm().getFarmNo().longValue() == curFarmNo.longValue()) {
                cloudTable.select(farm);
                break;
            }
        }
    }

}

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

License:Open Source License

public ServerDescBasic() {
    setHeight("100%");
    addStyleName(Reindeer.PANEL_LIGHT);/*from   w w  w .j  a  v  a 2s.  c  o  m*/

    VerticalLayout panel = (VerticalLayout) getContent();
    panel.setWidth("100%");
    panel.setHeight("100%");
    panel.setMargin(true);
    panel.setSpacing(false);
    panel.addStyleName("server-desc-basic");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("server-desc-basic");
    //        setContent(hlPanels);

    left.setWidth("100%");
    right.setHeight("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    hlPanels.addComponent(left);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(right);
    hlPanels.setExpandRatio(left, 40);
    hlPanels.setExpandRatio(right, 60);

    panel.addComponent(hlPanels);
    panel.setExpandRatio(hlPanels, 1.0f);

}

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

License:Open Source License

ServerTable(String caption, Container container, final MyCloudTabs sender) {
    super(caption, container);

    this.sender = sender;
    setVisibleColumns(new Object[] {});

    setWidth("100%");
    if (this.isEnabled()) {
        setHeight("100%");
    }//from w w  w.ja va2  s  . c o  m

    setPageLength(0);
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setImmediate(true);
    setStyleName("server-table");
    setNullSelectionAllowed(false);
    setCacheRate(0.1);

    addGeneratedColumn("no", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(String.valueOf(p.getInstance().getInstanceNo()));
            return nlbl;
        }
    });

    addGeneratedColumn("name", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;

            PlatformDto platformDto = p.getPlatform();
            //????
            Icons icon = CommonUtils.getPlatformIcon(platformDto);

            Label nlbl = new Label("<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>"
                    + p.getInstance().getInstanceName() + "</div>", Label.CONTENT_XHTML);
            nlbl.setHeight(COLUMN_HEIGHT);
            return nlbl;
        }
    });

    addGeneratedColumn("fqdn", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Label nlbl = new Label(p.getInstance().getFqdn());
            return nlbl;
        }
    });

    addGeneratedColumn("publicIp", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            Boolean showPublicIp = BooleanUtils.toBooleanObject(Config.getProperty("ui.showPublicIp"));
            Label ipaddr;
            if (BooleanUtils.isTrue(showPublicIp)) {
                //ui.showPublicIp = true???PublicIp
                ipaddr = new Label(p.getInstance().getPublicIp());
            } else {
                //ui.showPublicIp = false???PrivateIp
                ipaddr = new Label(p.getInstance().getPrivateIp());
            }
            return ipaddr;
        }
    });

    addGeneratedColumn("status", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            InstanceDto p = (InstanceDto) itemId;
            String a = p.getInstance().getStatus().substring(0, 1).toUpperCase()
                    + p.getInstance().getStatus().substring(1).toLowerCase();
            Icons icon = Icons.fromName(a);
            Label slbl = new Label(
                    "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, icon) + "\"><div>" + a + "</div>",
                    Label.CONTENT_XHTML);
            slbl.setHeight(COLUMN_HEIGHT);
            return slbl;
        }
    });

    addGeneratedColumn("services", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {

            InstanceDto p = (InstanceDto) itemId;

            String context = "<div>";
            for (ComponentDto dto : sender.getComponents(p.getComponentInstances())) {
                ComponentType componentType = dto.getComponentType();
                String name = componentType.getComponentTypeNameDisp();
                Icons nameIcon = Icons.fromName(componentType.getComponentTypeName());
                // Master
                if (MySQLConstants.COMPONENT_TYPE_NAME.equals(componentType.getComponentTypeName())) {
                    Long masterInstanceNo = null;
                    for (InstanceConfig config : dto.getInstanceConfigs()) {
                        if (MySQLConstants.CONFIG_NAME_MASTER_INSTANCE_NO.equals(config.getConfigName())) {
                            if (StringUtils.isEmpty(config.getConfigValue())) {
                                masterInstanceNo = config.getInstanceNo();
                                break;
                            }
                        }
                    }
                    if (masterInstanceNo != null) {
                        if (masterInstanceNo.equals(p.getInstance().getInstanceNo())) {
                            name = name + "_master";
                            nameIcon = Icons.MYSQL_MASTER;
                        } else {
                            name = name + "_slave";
                            nameIcon = Icons.MYSQL_SLAVE;
                        }
                    } else {
                        name = name + "_slave";
                        nameIcon = Icons.MYSQL_SLAVE;
                    }
                }

                context = context + "<img style=\"width: 5px;\" src=\" "
                        + VaadinUtils.getIconPath(ServerTable.this, Icons.fromName("SPACER")) + "\" >"
                        + "<img src=\"" + VaadinUtils.getIconPath(ServerTable.this, nameIcon) + "\" + "
                        + " title=\"" + name + "\">";
            }
            context = context + "</div>";

            Label slayout = new Label(context, Label.CONTENT_XHTML);
            slayout.setHeight(COLUMN_HEIGHT);
            return slayout;
        }

    });

    //        addGeneratedColumn("operation", new ColumnGenerator() {
    //            public Component generateCell(Table source, Object itemId, Object columnId) {
    //
    //                List<Button> list = new ArrayList<Button>();
    //
    //                CssLayout blayout = new CssLayout();
    //
    //                blayout.setWidth("100%");
    //                blayout.setHeight(COLUMN_HEIGHT);
    //                blayout.setMargin(false);
    //
    //                InstanceDto p = (InstanceDto) itemId;
    //
    //                Button playButton = new Button(ViewProperties.getCaption("button.startServer"));
    //                playButton.setDescription(ViewProperties.getCaption("description.startServer"));
    //                playButton.addStyleName("borderless");
    //                playButton.setIcon(Icons.PLAY.resource());
    //                playButton.setEnabled(false);
    //                playButton.addListener(Button.ClickEvent.class, ServerTable.this, "playButtonClick");
    //                blayout.addComponent(playButton);
    //                list.add(playButton);
    //
    //                Button stopButton = new Button(ViewProperties.getCaption("button.stopServer"));
    //                stopButton.setDescription(ViewProperties.getCaption("description.stopServer"));
    //                stopButton.addStyleName("borderless");
    //                stopButton.setIcon(Icons.STOP.resource());
    //                stopButton.setEnabled(false);
    //                stopButton.addListener(Button.ClickEvent.class, ServerTable.this, "stopButtonClick");
    //                blayout.addComponent(stopButton);
    //                list.add(stopButton);
    //
    //                Button editButton = new Button(ViewProperties.getCaption("button.editServer"));
    //                editButton.setDescription(ViewProperties.getCaption("description.editServer"));
    //                editButton.addStyleName("borderless");
    //                editButton.setIcon(Icons.EDIT.resource());
    //                editButton.setEnabled(false);
    //                editButton.addListener(Button.ClickEvent.class, ServerTable.this, "editButtonClick");
    //                blayout.addComponent(editButton);
    //                list.add(editButton);
    //
    //                Button delButton = new Button(ViewProperties.getCaption("button.deleteServer"));
    //                delButton.setDescription(ViewProperties.getCaption("description.deleteServer"));
    //                delButton.addStyleName("borderless");
    //                delButton.setIcon(Icons.DELETE.resource());
    //                delButton.setEnabled(false);
    //                delButton.addListener(Button.ClickEvent.class, ServerTable.this, "delButtonClick");
    //                blayout.addComponent(delButton);
    //                list.add(delButton);
    //
    //                map.put(p.getInstance().getInstanceNo(), list);
    //
    //                return blayout;
    //            }
    //
    //        });

    //???
    setColumnHeaders(CAPNAME);

    //????StyleName
    setCellStyleGenerator(new Table.CellStyleGenerator() {
        public String getStyle(Object itemId, Object propertyId) {

            if (propertyId == null) {
                return "";
            } else {
                return propertyId.toString().toLowerCase();
            }
        }
    });

    //        setColumnExpandRatio("name", 100);
    setColumnExpandRatio("fqdn", 100);
    addListener(Table.ValueChangeEvent.class, sender, "tableRowSelected");

    //        alwaysRecalculateColumnWidths = true;
}

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

License:Open Source License

public ServiceDescBasic() {

    addStyleName(Reindeer.PANEL_LIGHT);/*w  w  w .ja va 2 s.c  o  m*/

    setHeight("100%");

    HorizontalLayout hlPanels = new HorizontalLayout();
    hlPanels.setWidth("100%");
    hlPanels.setHeight("100%");
    hlPanels.setMargin(true);
    hlPanels.setSpacing(true);
    hlPanels.addStyleName("service-desc-basic");
    setContent(hlPanels);

    left.setWidth("100%");
    right.setWidth("100%");

    //????
    Label padding = new Label(" ");
    padding.setWidth("7px");
    padding.setHeight("99%");
    padding.addStyleName("desc-padding");

    Label padding2 = new Label("");
    padding2.setWidth("1px");

    VerticalLayout layLeft = new VerticalLayout();
    layLeft.setMargin(false);
    layLeft.setSpacing(false);
    layLeft.setWidth("100%");
    layLeft.setHeight("100%");
    layLeft.addComponent(left);
    layLeft.setExpandRatio(left, 1.0f);

    VerticalLayout layRight = new VerticalLayout();
    layRight.setMargin(false);
    layRight.setSpacing(false);
    layRight.setWidth("100%");
    layRight.setHeight("100%");
    layRight.addComponent(right);
    layRight.addComponent(serverOpe);
    layRight.setExpandRatio(right, 1.0f);

    hlPanels.addComponent(layLeft);
    hlPanels.addComponent(padding);
    hlPanels.addComponent(padding2);
    hlPanels.addComponent(layRight);
    hlPanels.setExpandRatio(layLeft, 40);
    hlPanels.setExpandRatio(layRight, 60);
}

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

License:Open Source License

public ServiceTable(String caption, Container container, MyCloudTabs sender) {
    super(caption, container);
    this.sender = sender;
    setVisibleColumns(new Object[] {});

    setWidth("100%");
    setHeight("100%");

    setPageLength(0);/*w w w  .  j a  v a 2 s  .com*/
    setSortDisabled(true);
    setColumnReorderingAllowed(false);
    setColumnCollapsingAllowed(false);
    setSelectable(true);
    setMultiSelect(false);
    setImmediate(true);
    setNullSelectionAllowed(false);
    setStyleName("service-table");

    addGeneratedColumn("no", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            ComponentDto p = (ComponentDto) itemId;
            Label nlbl = new Label(String.valueOf(p.getComponent().getComponentNo()));
            return nlbl;
        }
    });

    addGeneratedColumn("name", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            ComponentDto p = (ComponentDto) itemId;
            String name;
            if (StringUtils.isEmpty(p.getComponent().getComment())) {
                name = p.getComponent().getComponentName();
            } else {
                name = p.getComponent().getComment() + "\n[" + p.getComponent().getComponentName() + "]";
            }
            Label nlbl = new Label(name, Label.CONTENT_PREFORMATTED);
            return nlbl;
        }
    });
    //???
    addGeneratedColumn("srvs", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            ComponentDto p = (ComponentDto) itemId;
            int srvs = 0;
            for (ComponentInstanceDto componentInstance : p.getComponentInstances()) {
                if (BooleanUtils.isTrue(componentInstance.getComponentInstance().getAssociate())) {
                    srvs++;
                }
            }
            Label lbl = new Label(Integer.toString(srvs));
            return lbl;
        }
    });

    addGeneratedColumn("status", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            ComponentDto p = (ComponentDto) itemId;
            String a = p.getStatus().substring(0, 1).toUpperCase() + p.getStatus().substring(1).toLowerCase();

            Icons icon = Icons.fromName(a);
            Label slbl = new Label("<img src=\"" + VaadinUtils.getIconPath(ServiceTable.this, icon) + "\"><div>"
                    + a + "</div>", Label.CONTENT_XHTML);
            slbl.setHeight(COLUMN_HEIGHT);

            return slbl;
        }
    });

    addGeneratedColumn("loadBalancer", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {

            ComponentDto dto = (ComponentDto) itemId;

            MyCloudTabs myCloudTabs = null;
            Component c = ServiceTable.this;
            while (c != null) {
                if (c instanceof MyCloudTabs) {
                    myCloudTabs = (MyCloudTabs) c;
                    break;
                }
                c = c.getParent();
            }
            Button btn = null;
            for (LoadBalancerDto lbDto : (Collection<LoadBalancerDto>) myCloudTabs.loadBalancerTable
                    .getItemIds()) {
                if (dto.getComponent().getComponentNo().equals(lbDto.getLoadBalancer().getComponentNo())) {
                    btn = getLoadBalancerButton(lbDto);
                    break;
                }
            }
            if (btn != null) {
                return btn;
            } else {
                return (new Label(""));
            }
        }

    });

    addGeneratedColumn("serviceDetail", new ColumnGenerator() {
        public Component generateCell(Table source, Object itemId, Object columnId) {
            ComponentDto p = (ComponentDto) itemId;
            ComponentType componentType = p.getComponentType();

            // ??
            String name = componentType.getComponentTypeNameDisp();
            Icons nameIcon = Icons.fromName(componentType.getComponentTypeName());

            Label slbl = new Label("<img src=\"" + VaadinUtils.getIconPath(ServiceTable.this, nameIcon)
                    + "\"><div>" + name + "</div>", Label.CONTENT_XHTML);
            slbl.setHeight(COLUMN_HEIGHT);
            return slbl;

        }
    });

    //???
    setColumnHeaders(CAPNAME);

    //????StyleName
    setCellStyleGenerator(new Table.CellStyleGenerator() {
        public String getStyle(Object itemId, Object propertyId) {

            if (propertyId == null) {
                return "";
            } else {
                return propertyId.toString().toLowerCase();
            }
        }
    });

    setColumnExpandRatio("serviceDetail", 100);

    addListener(Table.ValueChangeEvent.class, sender, "tableRowSelected");
}

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

License:Open Source License

private void showClouds() {
    cloudTable.removeAllItems();//w w  w .  ja va2 s.  c  o m

    // ?
    for (int i = 0; i < platforms.size(); i++) {
        PlatformDto platformDto = platforms.get(i);

        if (BooleanUtils.isNotTrue(platformDto.getPlatform().getSelectable())) {
            //??????
            continue;
        }

        //????
        Icons icon = CommonUtils.getPlatformIcon(platformDto);

        String description = platformDto.getPlatform().getPlatformNameDisp();

        Label slbl = new Label(
                "<img src=\"" + VaadinUtils.getIconPath(apl, icon) + "\"><div>" + description + "</div>",
                Label.CONTENT_XHTML);
        slbl.setHeight(COLUMN_HEIGHT);

        cloudTable.addItem(new Object[] { (i + 1), slbl }, platformDto.getPlatform().getPlatformNo());
    }

    Long platformNo = null;
    if (cloudTable.getItemIds().size() > 0) {
        platformNo = (Long) cloudTable.getItemIds().toArray()[0];
    }

    // ???
    cloudTable.select(platformNo);
}

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

License:Open Source License

private void showImages(Long platformNo) {
    imageTable.removeAllItems();/*from  w  ww . jav a  2 s . c  o  m*/
    serviceTable.removeAllItems();
    if (platformNo == null) {
        return;
    }

    // ????????
    List<ImageDto> images = null;
    for (PlatformDto platform : platforms) {
        if (platformNo.equals(platform.getPlatform().getPlatformNo())) {
            images = platform.getImages();
            break;
        }
    }

    // ?????
    if (images == null) {
        return;
    }

    // ??
    int n = 0;
    for (ImageDto image : images) {
        // ?????????
        if (BooleanUtils.isNotTrue(image.getImage().getSelectable())) {
            continue;
        }

        // ???
        String name = image.getImage().getImageNameDisp();
        Icons nameIcon = CommonUtils.getImageIcon(image);

        Label nlbl = new Label(
                "<img src=\"" + VaadinUtils.getIconPath(apl, nameIcon) + "\"><div>" + name + "</div>",
                Label.CONTENT_XHTML);
        nlbl.setHeight(COLUMN_HEIGHT);

        // OS??
        String os = image.getImage().getOsDisp();
        Icons osIcon = CommonUtils.getOsIcon(image);

        Label slbl = new Label(
                "<img src=\"" + VaadinUtils.getIconPath(apl, osIcon) + "\"><div>" + os + "</div>",
                Label.CONTENT_XHTML);
        slbl.setHeight(COLUMN_HEIGHT);

        n++;
        imageTable.addItem(new Object[] { n, nlbl, slbl }, image.getImage().getImageNo());
    }

    Long imageNo = null;
    if (imageTable.getItemIds().size() > 0) {
        imageNo = (Long) imageTable.getItemIds().toArray()[0];
    }

    // ????
    imageTable.select(imageNo);
}

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

License:Open Source License

private void showServices(Long platformNo, Long imageNo) {
    serviceTable.removeAllItems();/*w  ww .ja  v  a2s  . c  om*/
    if (platformNo == null || imageNo == null) {
        return;
    }

    // ???
    List<ComponentType> componentTypes = null;
    for (PlatformDto platform : platforms) {
        if (platformNo.equals(platform.getPlatform().getPlatformNo())) {
            List<ImageDto> images = platform.getImages();
            for (ImageDto image : images) {
                if (imageNo.equals(image.getImage().getImageNo())) {
                    this.selectImage = image;

                    componentTypes = image.getComponentTypes();
                    //?
                    String caption = image.getImage().getImageNameDisp();
                    caption = "" + caption + "?????";
                    serviceTable.setCaption(caption);

                    break;
                }
            }
            break;
        }
    }

    // ????
    if (componentTypes == null) {
        return;
    }

    // ?
    for (int i = 0; i < componentTypes.size(); i++) {
        ComponentType componentType = componentTypes.get(i);

        // ??
        String name = componentType.getComponentTypeNameDisp();
        Icons nameIcon = Icons.fromName(componentType.getComponentTypeName());

        Label slbl = new Label(
                "<img src=\"" + VaadinUtils.getIconPath(apl, nameIcon) + "\"><div>" + name + "</div>",
                Label.CONTENT_XHTML);
        slbl.setHeight("26px");

        // 
        String description = componentType.getLayerDisp();

        serviceTable.addItem(new Object[] { slbl, description }, componentType.getComponentTypeNo());
    }
}