@Override
  public void attach() {
    setSizeFull();
    addStyleName(Reindeer.PANEL_LIGHT);

    VerticalLayout layout = (VerticalLayout) getContent();
    layout.setSizeFull();
    layout.addStyleName("loadbalancer-tab");
    layout.setSpacing(false);
    layout.setMargin(false);

    // スプリットパネル
    SplitPanel splitPanel = new SplitPanel();
    splitPanel.setOrientation(SplitPanel.ORIENTATION_VERTICAL);
    splitPanel.setSplitPosition(40);
    splitPanel.setSizeFull();
    layout.addComponent(splitPanel);

    // スプリットパネル上段
    VerticalLayout upperLayout = new VerticalLayout();
    upperLayout.setSizeFull();
    upperLayout.setSpacing(false);
    upperLayout.setMargin(false);

    CssLayout upperTopLayout = new CssLayout();
    Label label = new Label(ViewProperties.getCaption("label.loadbalancer"));
    upperTopLayout.setWidth("100%");
    upperTopLayout.setMargin(true);
    upperTopLayout.addStyleName("loadbalancer-table-label");
    upperTopLayout.addComponent(label);
    upperTopLayout.setHeight("28px");
    upperLayout.addComponent(upperTopLayout);

    loadBalancerTable = new LoadBalancerTable(sender);
    loadBalancerTable.setContainerDataSource(new LoadBalancerDtoContainer());
    upperLayout.addComponent(loadBalancerTable);
    loadBalancerTable.addListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            tableRowSelected(event);
          }
        });

    loadBalancerButtonsBottom = new LoadBalancerButtonsBottom(sender);
    upperLayout.addComponent(loadBalancerButtonsBottom);
    upperLayout.setExpandRatio(loadBalancerTable, 10);
    splitPanel.addComponent(upperLayout);

    // スプリットパネル下段
    loadBalancerDesc = new LoadBalancerDesc(sender);
    splitPanel.addComponent(loadBalancerDesc);
  }
Ejemplo n.º 2
0
  protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    CssLayout csslayout = new CssLayout();
    csslayout.setHeight(24, UNITS_PIXELS);
    csslayout.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(csslayout);

    inputField = new TextField();
    inputField.setWidth(100, UNITS_PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField);
    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
  }
Ejemplo n.º 3
0
  public void setSearchCriteria(final S criteria) {
    this.searchCriteria = criteria;

    final JFreeChart chart = createChart();
    final JFreeChartWrapper chartWrapper = new JFreeChartWrapper(chart);

    removeAllComponents();
    final CssLayout borderWrap = new CssLayout();
    borderWrap.addComponent(chartWrapper);
    borderWrap.setStyleName("chart-wrapper");
    borderWrap.setHeight(height + "px");
    borderWrap.setWidth(width + "px");
    chartWrapper.setHeight(height + "px");
    chartWrapper.setWidth(width + "px");
    chartWrapper.setGraphHeight(height);
    chartWrapper.setGraphWidth(width);
    this.addComponent(borderWrap);
    // this.setComponentAlignment(chartWrapper, Alignment.MIDDLE_CENTER);
    final Component legendBox = createLegendBox();
    legendBox.setWidth(width + "px");
    this.addComponent(legendBox);
    this.setComponentAlignment(legendBox, Alignment.MIDDLE_CENTER);
  }
    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++);
      }
    }