void initTable() {
    getTable().enableColumnResizing();

    TextColumnWithTooltip<VM> nameColumn =
        new TextColumnWithTooltip<VM>() {
          @Override
          public String getValue(VM object) {
            return object.getName();
          }
        };
    nameColumn.makeSortable();
    getTable().addColumn(nameColumn, constants.nameVm(), "300px"); // $NON-NLS-1$
  }
Exemplo n.º 2
0
  void initTable(final ApplicationConstants constants) {
    getTable().enableColumnResizing();

    ImageResourceColumn<VM> pluggedColumn =
        new ImageResourceColumn<VM>() {
          @Override
          public ImageResource getValue(VM object) {
            boolean isDiskPlugged = getDetailModel().isDiskPluggedToVm(object);
            setTitle(isDiskPlugged ? constants.active() : constants.inactive());
            return isDiskPlugged
                ? getCommonResources().upImage()
                : getCommonResources().downImage();
          }
        };
    getTable().addColumn(pluggedColumn, constants.empty(), "30px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> nameColumn =
        new TextColumnWithTooltip<VM>() {
          @Override
          public String getValue(VM object) {
            return object.getName();
          }
        };
    nameColumn.makeSortable();
    getTable().addColumn(nameColumn, constants.nameVm(), "140px"); // $NON-NLS-1$

    getTable().addColumn(new VmTypeColumn(), constants.empty(), "30px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> clusterColumn =
        new TextColumnWithTooltip<VM>() {
          @Override
          public String getValue(VM object) {
            return object.getVdsGroupName();
          }
        };
    clusterColumn.makeSortable();
    getTable().addColumn(clusterColumn, constants.clusterVm(), "140px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> ipColumn =
        new TextColumnWithTooltip<VM>() {
          @Override
          public String getValue(VM object) {
            return object.getVmIp();
          }
        };
    ipColumn.makeSortable();
    getTable().addColumn(ipColumn, constants.ipVm(), "140px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> fqdnColumn =
        new TextColumnWithTooltip<VM>() {
          @Override
          public String getValue(VM object) {
            return object.getVmFQDN();
          }
        };
    fqdnColumn.makeSortable();
    getTable().addColumn(fqdnColumn, constants.fqdn(), "140px"); // $NON-NLS-1$

    PercentColumn<VM> memColumn =
        new PercentColumn<VM>() {
          @Override
          public Integer getProgressValue(VM object) {
            return object.getUsageMemPercent();
          }
        };
    getTable().addColumn(memColumn, constants.memoryVm(), "140px"); // $NON-NLS-1$

    PercentColumn<VM> cpuColumn =
        new PercentColumn<VM>() {
          @Override
          public Integer getProgressValue(VM object) {
            return object.getUsageCpuPercent();
          }
        };
    getTable().addColumn(cpuColumn, constants.cpuVm(), "140px"); // $NON-NLS-1$

    PercentColumn<VM> netColumn =
        new PercentColumn<VM>() {
          @Override
          public Integer getProgressValue(VM object) {
            return object.getUsageNetworkPercent();
          }
        };
    getTable().addColumn(netColumn, constants.networkVm(), "140px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> statusColumn =
        new EnumColumn<VM, VMStatus>() {
          @Override
          protected VMStatus getRawValue(VM object) {
            return object.getStatus();
          }
        };
    statusColumn.makeSortable();
    getTable().addColumn(statusColumn, constants.statusVm(), "140px"); // $NON-NLS-1$

    TextColumnWithTooltip<VM> hostColumn =
        new UptimeColumn<VM>() {
          @Override
          protected Double getRawValue(VM object) {
            return object.getRoundedElapsedTime();
          }
        };
    hostColumn.makeSortable();
    getTable().addColumn(hostColumn, constants.uptimeVm(), "140px"); // $NON-NLS-1$
  }
  void initTable(ApplicationConstants constants) {
    getTable().enableColumnResizing();

    TextColumnWithTooltip<VnicProfileView> nameColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getName();
          }
        };
    nameColumn.makeSortable();
    getTable().addColumn(nameColumn, constants.nameVnicProfile(), "400px"); // $NON-NLS-1$

    TextColumnWithTooltip<VnicProfileView> networkColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getNetworkName();
          }
        };
    networkColumn.makeSortable();
    getTable().addColumn(networkColumn, constants.networkVnicProfile(), "200px"); // $NON-NLS-1$

    TextColumnWithTooltip<VnicProfileView> dcColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getDataCenterName();
          }
        };
    dcColumn.makeSortable();
    getTable().addColumn(dcColumn, constants.dcVnicProfile(), "200px"); // $NON-NLS-1$

    TextColumnWithTooltip<VnicProfileView> compatibilityVersionColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getCompatibilityVersion().toString();
          }
        };
    compatibilityVersionColumn.makeSortable();
    getTable()
        .addColumn(
            compatibilityVersionColumn,
            constants.compatibilityVersionVnicProfile(),
            "200px"); //$NON-NLS-1$

    TextColumnWithTooltip<VnicProfileView> qosColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getNetworkQosName();
          }
        };
    qosColumn.makeSortable();
    getTable().addColumn(qosColumn, constants.qosNameVnicProfile(), "200px"); // $NON-NLS-1$

    BooleanColumn<VnicProfileView> portMirroringColumn =
        new BooleanColumn<VnicProfileView>(constants.portMirroringEnabled()) {
          @Override
          public Boolean getRawValue(VnicProfileView object) {
            return object.isPortMirroring();
          }
        };
    portMirroringColumn.makeSortable();
    getTable()
        .addColumnWithHtmlHeader(
            portMirroringColumn, constants.portMirroringVnicProfile(), "85px"); // $NON-NLS-1$

    TextColumnWithTooltip<VnicProfileView> descriptionColumn =
        new TextColumnWithTooltip<VnicProfileView>() {
          @Override
          public String getValue(VnicProfileView object) {
            return object.getDescription();
          }
        };
    descriptionColumn.makeSortable();
    getTable()
        .addColumn(descriptionColumn, constants.descriptionVnicProfile(), "400px"); // $NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<VnicProfileView>(constants.newNetworkProfile()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getNewCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<VnicProfileView>(constants.editNetworkProfile()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getEditCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<VnicProfileView>(constants.removeNetworkProfile()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getRemoveCommand();
              }
            });
  }