public void setItem(InstanceDto instanceDto) { int line = 0; if (instanceDto != null) { Instance instance = instanceDto.getInstance(); // hostName = new Label(instance.getInstanceName(), Label.CONTENT_TEXT); // layout.removeComponent( 1, line ); // layout.addComponent(hostName , 1, line++ ); fqdn = new Label(instance.getFqdn(), Label.CONTENT_TEXT); layout.removeComponent(1, line); layout.addComponent(fqdn, 1, line++); ipAddress = new Label(instance.getPublicIp(), Label.CONTENT_TEXT); layout.removeComponent(1, line); layout.addComponent(ipAddress, 1, line++); // プラットフォームの表示 PlatformDto platformDto = instanceDto.getPlatform(); // TODO: アイコン名の取得ロジックのリファクタリング Icons icon = Icons.NONE; if ("aws".equals(platformDto.getPlatform().getPlatformType())) { if (platformDto.getPlatformAws().getEuca()) { icon = Icons.EUCALYPTUS; } else { icon = Icons.AWS; } } else if ("vmware".equals(platformDto.getPlatform().getPlatformType())) { icon = Icons.VMWARE; } else if ("nifty".equals(platformDto.getPlatform().getPlatformType())) { icon = Icons.NIFTY; } else if ("cloudstack".equals(platformDto.getPlatform().getPlatformType())) { icon = Icons.CLOUD_STACK; } String description = platformDto.getPlatform().getPlatformNameDisp(); platform = new Label( "<img src=\"" + VaadinUtils.getIconPath(ServerDescBasic.this, icon) + "\"><div>" + description + "</div>", Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(platform, 1, line++); // OS名の表示 ImageDto imageDto = instanceDto.getImage(); // TODO: アイコン名取得ロジックのリファクタリング String os = imageDto.getImage().getOsDisp(); Icons osIcon = Icons.NONE; if (imageDto.getImage().getOs().startsWith("centos")) { osIcon = Icons.CENTOS; } else if (imageDto.getImage().getOs().startsWith("windows")) { osIcon = Icons.WINDOWS; } layoutOsType = new CssLayout(); ostype = new Label( "<img src=\"" + VaadinUtils.getIconPath(ServerDescBasic.this, osIcon) + "\"><div>" + os + "</div>", Label.CONTENT_XHTML); layoutOsType.setSizeFull(); layoutOsType.setMargin(false); layoutOsType.addComponent(ostype); // OSがWindowsの場合パスワード取得ボタンを表示 if (imageDto.getImage().getOs().startsWith("windows")) { // ただしEUCALYPTUSは除外 if (platformDto.getPlatformAws() == null || platformDto.getPlatformAws().getEuca() == false) { InstanceStatus instanceStatus = InstanceStatus.fromStatus(instance.getStatus()); if (instanceStatus == InstanceStatus.RUNNING) { getPassword.setEnabled(true); getPassword.setData(instance.getInstanceNo()); } else { getPassword.setEnabled(false); } layoutOsType.addComponent(getPassword); layoutOsType.setHeight("60px"); } } layout.removeComponent(1, line); layout.addComponent(layoutOsType, 1, line++); // ステータスの表示 String stat = instance.getStatus().substring(0, 1).toUpperCase() + instance.getStatus().substring(1).toLowerCase(); Icons icon2 = Icons.fromName(stat); status = new Label( "<img src=\"" + VaadinUtils.getIconPath(ServerDescBasic.this, icon2) + "\"><div>" + stat + "</div>", Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(status, 1, line++); // コメント comment = new Label(instance.getComment(), Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(comment, 1, line++); } else { // hostName = new Label("", Label.CONTENT_TEXT); // layout.removeComponent( 1, line ); // layout.addComponent(hostName , 1, line++ ); fqdn = new Label("", Label.CONTENT_TEXT); layout.removeComponent(1, line); layout.addComponent(fqdn, 1, line++); ipAddress = new Label("", Label.CONTENT_TEXT); layout.removeComponent(1, line); layout.addComponent(ipAddress, 1, line++); // プラットフォームの表示 platform = new Label("", Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(platform, 1, line++); // OS名の表示 layoutOsType = new CssLayout(); ostype = new Label("", Label.CONTENT_XHTML); layoutOsType.setSizeFull(); layoutOsType.setMargin(false); layoutOsType.addComponent(ostype); layout.removeComponent(1, line); layout.addComponent(layoutOsType, 1, line++); // ステータスの表示 status = new Label("", Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(status, 1, line++); // コメント comment = new Label("", Label.CONTENT_XHTML); layout.removeComponent(1, line); layout.addComponent(comment, 1, line++); } }