コード例 #1
0
  @Override
  protected void init() {
    // Initialize Tables
    initGeneralForm();
    initDisksTable();
    initNicsTable();

    // Add Tabs
    add(new ScrollPanel(generalView.asWidget()), constants.generalLabel());
    add(new ScrollPanel(disksTable), constants.disksLabel());
    add(new ScrollPanel(nicsTable), constants.nicsLabel());
  }
コード例 #2
0
  void initTable() {
    getTable().enableColumnResizing();

    QuotaDcStatusColumn dcStatusColumn = new QuotaDcStatusColumn();
    dcStatusColumn.setContextMenuTitle(constants.dcStatusQuota());
    getTable().addColumn(dcStatusColumn, constants.empty(), "30px"); // $NON-NLS-1$

    AbstractTextColumn<Quota> nameColumn =
        new AbstractTextColumn<Quota>() {
          @Override
          public String getValue(Quota object) {
            return object.getQuotaName() == null ? "" : object.getQuotaName(); // $NON-NLS-1$
          }
        };
    nameColumn.makeSortable();
    getTable().addColumn(nameColumn, constants.nameQuota(), "400px"); // $NON-NLS-1$

    AbstractTextColumn<Quota> descriptionColumn =
        new AbstractTextColumn<Quota>() {
          @Override
          public String getValue(Quota object) {
            return object.getDescription() == null ? "" : object.getDescription(); // $NON-NLS-1$
          }
        };
    descriptionColumn.makeSortable();
    getTable().addColumn(descriptionColumn, constants.descriptionQuota(), "400px"); // $NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.addQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getCreateCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.editQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getEditCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.copyQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getCloneCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.removeQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getRemoveCommand();
              }
            });
  }
コード例 #3
0
 @TabInfo(container = StorageSubTabPanelPresenter.class)
 static TabData getTabData(
     ApplicationConstants applicationConstants,
     SearchableDetailModelProvider<Disk, StorageListModel, StorageSnapshotListModel>
         modelProvider) {
   return new ModelBoundTabData(applicationConstants.snapshotsLabel(), 8, modelProvider);
 }
コード例 #4
0
 @TabInfo(container = DiskSubTabPanelPresenter.class)
 static TabData getTabData(
     ApplicationConstants applicationConstants,
     SearchableDetailModelProvider<StorageDomain, DiskListModel, DiskStorageListModel>
         modelProvider) {
   return new ModelBoundTabData(applicationConstants.diskStorageSubTabLabel(), 3, modelProvider);
 }
コード例 #5
0
 @TabInfo(container = DataCenterSubTabPanelPresenter.class)
 static TabData getTabData(
     ApplicationConstants applicationConstants,
     SearchableDetailModelProvider<Quota, DataCenterListModel, DataCenterQuotaListModel>
         modelProvider) {
   return new ModelBoundTabData(
       applicationConstants.dataCenterQuotaSubTabLabel(), 4, modelProvider);
 }
コード例 #6
0
  void initTable() {
    getTable().enableColumnResizing();

    AbstractTextColumn<RepoImage> fileNameColumn =
        new AbstractTextColumn<RepoImage>() {
          @Override
          public String getValue(RepoImage object) {
            return object.getRepoImageTitle();
          }
        };
    fileNameColumn.makeSortable();
    getTable().addColumn(fileNameColumn, constants.fileNameIso(), "500px"); // $NON-NLS-1$

    AbstractTextColumn<RepoImage> typeColumn =
        new AbstractTextColumn<RepoImage>() {
          @Override
          public String getValue(RepoImage object) {
            return object.getFileType().toString();
          }
        };
    typeColumn.makeSortable();
    getTable().addColumn(typeColumn, constants.typeIso(), "200px"); // $NON-NLS-1$

    AbstractTextColumn<RepoImage> sizeColumn =
        new AbstractDiskSizeColumn<RepoImage>(
            SizeConverter.SizeUnit.BYTES, DiskSizeRenderer.Format.HUMAN_READABLE) {
          @Override
          protected Long getRawValue(RepoImage object) {
            return object.getSize();
          }
        };
    sizeColumn.makeSortable();
    getTable().addColumn(sizeColumn, constants.actualSizeTemplate(), "100px"); // $NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<RepoImage>(constants.importImage()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getImportImagesCommand();
              }
            });

    getTable().showRefreshButton();
  }
コード例 #7
0
  private void refreshHBADeviceInfo(VDS selectedItem) {
    /* refresh all the information about Host Bus Adapter (FC, iSCSI) devices */
    hbaInventory.clear();

    if (selectedItem != null && getDetailModel().getHbaDevices() != null) {

      /*
       * traverse the model and get all the HBAs
       */
      for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice :
          getDetailModel().getHbaDevices()) {
        GeneralFormPanel hbaFormPanel =
            new GeneralFormPanel() {
              {
                getElement().getStyle().setFloat(Float.LEFT);
                getElement().getStyle().setBorderWidth(1, Unit.PX);
                getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
                getElement().getStyle().setBorderColor("black"); // $NON-NLS-1$
                getElement().getStyle().setMarginLeft(5, Unit.PX);
                getElement().getStyle().setMarginBottom(5, Unit.PX);
                getElement().getStyle().setProperty("width", "auto"); // $NON-NLS-1$ //$NON-NLS-2$
              }
            };

        StringValueLabel interfaceName =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME));
        StringValueLabel interfaceType =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE));
        StringValueLabel interfaceWWNN =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN));
        StringValueLabel portWWPNs =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS));

        FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4);
        hbaFormBuilder.setRelativeColumnWidth(0, 12);
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0));
        hbaInventory.add(hbaFormPanel);
      }
    }
  }
コード例 #8
0
  public VnicProfileWidget() {
    publicUseEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    publicInfo = new InfoIcon(templates.italicText(constants.profilePublicUseLabel()), resources);
    networkQoSEditor =
        new ListModelListBoxEditor<Object>(
            new NullSafeRenderer<Object>() {
              @Override
              public String renderNullSafe(Object object) {
                return (((NetworkQoS) object).getName());
              }
            });
    initWidget(WidgetUiBinder.uiBinder.createAndBindUi(this));
    publicUseEditor.setLabel(constants.profilePublicUseInstanceTypeLabel());
    networkQoSEditor.setLabel(constants.profileQoSInstanceTypeLabel());

    initStyles();
    ViewIdHandler.idHandler.generateAndSetIds(this);
    driver.initialize(this);
  }
コード例 #9
0
  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$
  }
コード例 #10
0
 void localize() {
   unlimitedMemRadioButtonEditor.setLabel(constants.ultQuotaPopup());
   specificMemRadioButtonEditor.setLabel(constants.useQuotaPopup());
   unlimitedCpuRadioButtonEditor.setLabel(constants.ultQuotaPopup());
   specificCpuRadioButtonEditor.setLabel(constants.useQuotaPopup());
   memLabel.setText(constants.memQuotaPopup());
   cpuLabel.setText(constants.cpuQuotaPopup());
 }
コード例 #11
0
  public AbstractFindDcPopupView(EventBus eventBus, boolean multiSelection) {
    super(eventBus);
    table = new EntityModelCellTable<ListModel>(multiSelection);
    initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));

    // Table Entity Columns
    table.addColumn(
        new AbstractEntityModelTextColumn<StoragePool>() {
          @Override
          public String getText(StoragePool storage) {
            return storage.getName();
          }
        },
        constants.nameDc());

    table.addColumn(
        new AbstractEntityModelTextColumn<StoragePool>() {
          @Override
          protected String getText(StoragePool entity) {
            return entity.isLocal() ? constants.storageTypeLocal() : constants.storageTypeShared();
          }
        },
        constants.storgeTypeDc());
  }
コード例 #12
0
  /**
   * Review the model and if there are alerts add them to the view.
   *
   * @param view the view where alerts should be added
   * @param model the model to review
   */
  private void updateAlerts(final ViewDef view, final ClusterGeneralModel model) {
    // Clear all the alerts:
    view.clearAlerts();

    // Review the alerts and add those that are active:
    if (model.getHasNewGlusterHostsAlert()) {
      addTextAndLinkAlert(
          view,
          messages.clusterHasNewGlusterHosts(),
          model.getImportNewGlusterHostsCommand(),
          model.getDetachNewGlusterHostsCommand());
    }

    if (model.isConsoleAddressPartiallyOverridden()) {
      view.addAlert(new Label(constants.consolePartiallyOverridden()));
    }
  }
コード例 #13
0
  private void initApplicationsTable() {
    applicationsTable =
        new ActionCellTable<>(
            new AbstractDataProvider<String>() {
              @Override
              protected void onRangeChanged(HasData<String> display) {}
            },
            GWT.<Resources>create(SubTableResources.class));

    AbstractTextColumn<String> nameColumn =
        new AbstractTextColumn<String>() {
          @Override
          public String getValue(String object) {
            return object;
          }
        };

    applicationsTable.addColumn(nameColumn, constants.installedAppsVm());
    applicationsTable.setWidth("100%"); // $NON-NLS-1$
    applicationsTable.setRowData(new ArrayList<String>());

    getDetailModel()
        .getPropertyChangedEvent()
        .addListener(
            new IEventListener<EventArgs>() {
              @SuppressWarnings("unchecked")
              @Override
              public void eventRaised(
                  Event<? extends EventArgs> ev, Object sender, EventArgs args) {
                if (getDetailModel().getAppListModel().getItems() != null) {
                  applicationsTable.setRowData(
                      Linq.toList(getDetailModel().getAppListModel().getItems()));
                } else {
                  applicationsTable.setRowData(new ArrayList<String>());
                }
              }
            });
  }
コード例 #14
0
 void localize(ApplicationConstants constants) {
   userNameEditor.setLabel(constants.loginFormUserNameLabel());
   passwordEditor.setLabel(constants.loginFormPasswordLabel());
   domainEditor.setLabel(constants.loginFormDomainLabel());
   loginButton.setText(constants.loginButtonLabel());
 }
コード例 #15
0
 void localize(ApplicationConstants constants) {
   forceOverride.setLabel(constants.vmExportPopupForceOverrideLabel());
   collapseSnapshots.setLabel(constants.vmExportPopupCollapseSnapshotsLabel());
 }
コード例 #16
0
  void initTable(ApplicationConstants constants) {
    getTable().enableColumnResizing();

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

    getTable()
        .addColumn(
            new TextColumnWithTooltip<Quota>() {
              @Override
              public String getValue(Quota object) {
                return object.getQuotaName() == null ? "" : object.getQuotaName(); // $NON-NLS-1$
              }
            },
            constants.nameQuota(),
            "400px"); //$NON-NLS-1$

    getTable()
        .addColumn(
            new TextColumnWithTooltip<Quota>() {
              @Override
              public String getValue(Quota object) {
                return object.getDescription() == null
                    ? ""
                    : object.getDescription(); // $NON-NLS-1$
              }
            },
            constants.descriptionQuota(),
            "400px"); //$NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.addQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getCreateCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.editQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getEditCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.copyQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getCloneCommand();
              }
            });
    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<Quota>(constants.removeQuota()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getRemoveCommand();
              }
            });
  }
コード例 #17
0
  @Inject
  public SubTabHostGeneralHardwareView(
      DetailModelProvider<HostListModel<Void>, HostHardwareGeneralModel> modelProvider) {
    super(modelProvider);

    // Init form panel:
    formPanel = new GeneralFormPanel();

    initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
    driver.initialize(this);

    // Build a form using the FormBuilder
    formBuilder = new FormBuilder(formPanel, 3, 4);
    formBuilder.setRelativeColumnWidth(0, 4);
    formBuilder.setRelativeColumnWidth(1, 5);
    formBuilder.setRelativeColumnWidth(2, 3);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareManufacturerGeneral(), hardwareManufacturer, 0, 0), 5, 7);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareVersionGeneral(), hardwareVersion, 1, 0), 5, 7);
    formBuilder.addFormItem(new FormItem(constants.cpuModelHostGeneral(), cpuModel, 2, 0), 5, 7);
    formBuilder.addFormItem(
        new FormItem(constants.numOfCoresPerSocketHostGeneral(), coresPerSocket, 3, 0), 5, 7);

    formBuilder.addFormItem(
        new FormItem(constants.hardwareFamilyGeneral(), hardwareFamily, 0, 1), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareUUIDGeneral(), hardwareUUID, 1, 1), 4, 8);
    formBuilder.addFormItem(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 2, 1), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.numOfThreadsPerCoreHostGeneral(), threadsPerCore, 3, 1), 4, 8);

    formBuilder.addFormItem(
        new FormItem(constants.hardwareProductNameGeneral(), hardwareProductName, 0, 2), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareSerialNumberGeneral(), hardwareSerialNumber, 1, 2), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.numOfSocketsHostGeneral(), numberOfSockets, 2, 2), 4, 8);
  }
コード例 #18
0
public class SubTabHostGeneralHardwareView
    extends AbstractSubTabFormView<VDS, HostListModel<Void>, HostHardwareGeneralModel>
    implements SubTabHostGeneralHardwarePresenter.ViewDef, Editor<HostHardwareGeneralModel> {

  interface Driver
      extends UiCommonEditorDriver<HostHardwareGeneralModel, SubTabHostGeneralHardwareView> {}

  interface ViewIdHandler extends ElementIdHandler<SubTabHostGeneralHardwareView> {
    ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
  }

  private static final ApplicationConstants constants = AssetProvider.getConstants();

  StringValueLabel hardwareManufacturer = new StringValueLabel();
  StringValueLabel hardwareProductName = new StringValueLabel();
  StringValueLabel hardwareSerialNumber = new StringValueLabel();
  StringValueLabel hardwareVersion = new StringValueLabel();
  StringValueLabel hardwareUUID = new StringValueLabel();
  StringValueLabel hardwareFamily = new StringValueLabel();
  StringValueLabel cpuType = new StringValueLabel();
  StringValueLabel cpuModel = new StringValueLabel();
  NullableNumberValueLabel<Integer> numberOfSockets =
      new NullableNumberValueLabel<>(constants.unknown());
  StringValueLabel coresPerSocket = new StringValueLabel();
  StringValueLabel threadsPerCore = new StringValueLabel();

  @UiField(provided = true)
  GeneralFormPanel formPanel;

  @UiField FlowPanel hbaInventory;

  FormBuilder formBuilder;

  private final Driver driver = GWT.create(Driver.class);

  interface ViewUiBinder extends UiBinder<Widget, SubTabHostGeneralHardwareView> {
    ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
  }

  @Inject
  public SubTabHostGeneralHardwareView(
      DetailModelProvider<HostListModel<Void>, HostHardwareGeneralModel> modelProvider) {
    super(modelProvider);

    // Init form panel:
    formPanel = new GeneralFormPanel();

    initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
    driver.initialize(this);

    // Build a form using the FormBuilder
    formBuilder = new FormBuilder(formPanel, 3, 4);
    formBuilder.setRelativeColumnWidth(0, 4);
    formBuilder.setRelativeColumnWidth(1, 5);
    formBuilder.setRelativeColumnWidth(2, 3);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareManufacturerGeneral(), hardwareManufacturer, 0, 0), 5, 7);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareVersionGeneral(), hardwareVersion, 1, 0), 5, 7);
    formBuilder.addFormItem(new FormItem(constants.cpuModelHostGeneral(), cpuModel, 2, 0), 5, 7);
    formBuilder.addFormItem(
        new FormItem(constants.numOfCoresPerSocketHostGeneral(), coresPerSocket, 3, 0), 5, 7);

    formBuilder.addFormItem(
        new FormItem(constants.hardwareFamilyGeneral(), hardwareFamily, 0, 1), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareUUIDGeneral(), hardwareUUID, 1, 1), 4, 8);
    formBuilder.addFormItem(new FormItem(constants.cpuTypeHostGeneral(), cpuType, 2, 1), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.numOfThreadsPerCoreHostGeneral(), threadsPerCore, 3, 1), 4, 8);

    formBuilder.addFormItem(
        new FormItem(constants.hardwareProductNameGeneral(), hardwareProductName, 0, 2), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.hardwareSerialNumberGeneral(), hardwareSerialNumber, 1, 2), 4, 8);
    formBuilder.addFormItem(
        new FormItem(constants.numOfSocketsHostGeneral(), numberOfSockets, 2, 2), 4, 8);
  }

  @Override
  protected void generateIds() {
    ViewIdHandler.idHandler.generateAndSetIds(this);
  }

  @Override
  public void setMainTabSelectedItem(VDS selectedItem) {
    driver.edit(getDetailModel());

    refreshHBADeviceInfo(selectedItem);

    formBuilder.update(getDetailModel());
  }

  private void refreshHBADeviceInfo(VDS selectedItem) {
    /* refresh all the information about Host Bus Adapter (FC, iSCSI) devices */
    hbaInventory.clear();

    if (selectedItem != null && getDetailModel().getHbaDevices() != null) {

      /*
       * traverse the model and get all the HBAs
       */
      for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice :
          getDetailModel().getHbaDevices()) {
        GeneralFormPanel hbaFormPanel =
            new GeneralFormPanel() {
              {
                getElement().getStyle().setFloat(Float.LEFT);
                getElement().getStyle().setBorderWidth(1, Unit.PX);
                getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
                getElement().getStyle().setBorderColor("black"); // $NON-NLS-1$
                getElement().getStyle().setMarginLeft(5, Unit.PX);
                getElement().getStyle().setMarginBottom(5, Unit.PX);
                getElement().getStyle().setProperty("width", "auto"); // $NON-NLS-1$ //$NON-NLS-2$
              }
            };

        StringValueLabel interfaceName =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME));
        StringValueLabel interfaceType =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE));
        StringValueLabel interfaceWWNN =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN));
        StringValueLabel portWWPNs =
            new StringValueLabel(hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS));

        FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4);
        hbaFormBuilder.setRelativeColumnWidth(0, 12);
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0));
        hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0));
        hbaInventory.add(hbaFormPanel);
      }
    }
  }
}
コード例 #19
0
 @TabInfo(container = VirtualMachineSubTabPanelPresenter.class)
 static TabData getTabData(
     SearchableDetailModelProvider<AuditLog, VmListModel<Void>, VmEventListModel> modelProvider) {
   return new ModelBoundTabData(
       constants.virtualMachineEventSubTabLabel(), 10, modelProvider, Align.RIGHT);
 }
コード例 #20
0
 @TabInfo(container = NetworkSubTabPanelPresenter.class)
 static TabData getTabData(
     SearchableDetailModelProvider<VnicProfileView, NetworkListModel, NetworkProfileListModel>
         modelProvider) {
   return new ModelBoundTabData(constants.vnicProfilesMainTabLabel(), 1, modelProvider);
 }
コード例 #21
0
 @TabInfo(container = HostGeneralSubTabPanelPresenter.class)
 static TabData getTabData(
     DetailTabModelProvider<HostListModel<Void>, HostErrataCountModel> errataCountModelProvider) {
   return new ModelBoundTabData(
       constants.hostGeneralErrataSubTabLabel(), 7, errataCountModelProvider);
 }
コード例 #22
0
  void initTable() {
    getTable().enableColumnResizing();

    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> nameColumn =
        new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {
          @Override
          public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getName();
          }
        };
    nameColumn.makeSortable();
    getTable().addColumn(nameColumn, constants.nameCluster(), "400px"); // $NON-NLS-1$

    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> versionColumn =
        new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {
          @Override
          public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getCompatibilityVersion().getValue();
          }
        };
    versionColumn.makeSortable();
    getTable().addColumn(versionColumn, constants.comptVersCluster(), "130px"); // $NON-NLS-1$

    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> attachedColumn =
        new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {
          @Override
          public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getSecond() != null;
          }

          @Override
          protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
          }
        };
    attachedColumn.makeSortable();
    getTable()
        .addColumn(attachedColumn, constants.attachedNetworkCluster(), "120px"); // $NON-NLS-1$

    NetworkClusterStatusColumn statusColumn = new NetworkClusterStatusColumn();
    statusColumn.makeSortable(new SimpleStatusColumnComparator<>(statusColumn));
    getTable().addColumn(statusColumn, constants.networkStatus(), "120px"); // $NON-NLS-1$

    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> netRequiredColumn =
        new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {
          @Override
          public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            if (object.getSecond() != null) {
              return object.getSecond().isRequired();
            }
            return false;
          }

          @Override
          protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
          }
        };
    netRequiredColumn.makeSortable();
    getTable().addColumn(netRequiredColumn, constants.requiredNetCluster(), "120px"); // $NON-NLS-1$

    AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> netRoleColumn =
        new AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>>() {

          @Override
          public SafeHtml getValue(PairQueryable<Cluster, NetworkCluster> object) {
            List<SafeHtml> images = new LinkedList<>();

            if (object.getSecond() != null) {
              if (object.getSecond().isManagement()) {
                images.add(managementImage);
              } else {
                images.add(emptyImage);
              }
              if (object.getSecond().isDisplay()) {
                images.add(displayImage);
              } else {
                images.add(emptyImage);
              }
              if (object.getSecond().isMigration()) {
                images.add(migrationImage);
              } else {
                images.add(emptyImage);
              }
              if (object.getSecond().isGluster()) {
                images.add(glusterNwImage);
              } else {
                images.add(emptyImage);
              }
            }
            return MultiImageColumnHelper.getValue(images);
          }

          @Override
          public SafeHtml getTooltip(PairQueryable<Cluster, NetworkCluster> object) {
            Map<SafeHtml, String> imagesToText = new LinkedHashMap<>();
            if (object.getSecond() != null) {
              if (object.getSecond().isManagement()) {
                imagesToText.put(managementImage, constants.managementItemInfo());
              }

              if (object.getSecond().isDisplay()) {
                imagesToText.put(displayImage, constants.displayItemInfo());
              }

              if (object.getSecond().isMigration()) {
                imagesToText.put(migrationImage, constants.migrationItemInfo());
              }

              if (object.getSecond().isGluster()) {
                imagesToText.put(glusterNwImage, constants.glusterNwItemInfo());
              }
            }

            return MultiImageColumnHelper.getTooltip(imagesToText);
          }
        };
    netRoleColumn.makeSortable(
        new Comparator<PairQueryable<Cluster, NetworkCluster>>() {

          private int calculateValue(NetworkCluster networkCluster) {
            int res = 0;
            if (networkCluster != null) {
              if (networkCluster.isManagement()) {
                res += 10;
              }
              if (networkCluster.isDisplay()) {
                res += 4;
              }
              if (networkCluster.isMigration()) {
                res += 2;
              }
              if (networkCluster.isGluster()) {
                res += 1;
              }
            }
            return res;
          }

          @Override
          public int compare(
              PairQueryable<Cluster, NetworkCluster> o1,
              PairQueryable<Cluster, NetworkCluster> o2) {
            return calculateValue(o1.getSecond()) - calculateValue(o2.getSecond());
          }
        });
    getTable().addColumn(netRoleColumn, constants.roleNetCluster(), "120px"); // $NON-NLS-1$

    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> descriptionColumn =
        new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {
          @Override
          public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getDescription();
          }
        };
    descriptionColumn.makeSortable();
    getTable().addColumn(descriptionColumn, constants.descriptionCluster(), "400px"); // $NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<PairQueryable<Cluster, NetworkCluster>>(
                constants.assignUnassignNetwork()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getManageCommand();
              }
            });
  }
コード例 #23
0
  private SimpleActionTable<MacPool> createMacPoolTable() {

    final SimpleActionTable<MacPool> macPoolTable =
        new SimpleActionTable<>(
            sharedMacPoolModelProvider,
            headerlessResources,
            tableResources,
            eventBus,
            clientStorage);
    macPoolTable.addColumn(
        new AbstractImageResourceColumn<MacPool>() {

          @Override
          public ImageResource getValue(MacPool macPool) {
            return macPool.isDefaultPool() ? resources.lockImage() : null;
          }
        },
        constants.empty(),
        "20px"); //$NON-NLS-1$
    macPoolTable.addColumn(
        new AbstractTextColumn<MacPool>() {

          @Override
          public String getValue(MacPool macPool) {
            return macPool.getName();
          }
        },
        constants.configureMacPoolNameColumn(),
        "100px"); //$NON-NLS-1$
    macPoolTable.addColumn(
        new AbstractTextColumn<MacPool>() {

          @Override
          public String getValue(MacPool macPool) {
            return macPool.getDescription();
          }
        },
        constants.configureMacPoolDescriptionColumn(),
        "300px"); //$NON-NLS-1$

    macPoolTable.addActionButton(
        new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolAddButton()) {

          @Override
          protected UICommand resolveCommand() {
            return sharedMacPoolModelProvider.getModel().getNewCommand();
          }
        });

    macPoolTable.addActionButton(
        new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolEditButton()) {

          @Override
          protected UICommand resolveCommand() {
            return sharedMacPoolModelProvider.getModel().getEditCommand();
          }
        });
    macPoolTable.addActionButton(
        new WebAdminButtonDefinition<MacPool>(constants.configureMacPoolRemoveButton()) {

          @Override
          protected UICommand resolveCommand() {
            return sharedMacPoolModelProvider.getModel().getRemoveCommand();
          }
        });

    macPoolTable
        .getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {
              @Override
              public void onSelectionChange(SelectionChangeEvent event) {
                final List<MacPool> selectedItems = macPoolTable.getSelectedItems();
                sharedMacPoolModelProvider.setSelectedItems(selectedItems);

                final PermissionListModel<MacPool> model = permissionModelProvider.getModel();

                if (selectedItems.size() == 1) {
                  model.setEntity(selectedItems.get(0));
                  setupAuthorizationTableVisibility(true);
                } else {
                  model.setEntity(null);
                  setupAuthorizationTableVisibility(false);
                }
              }
            });

    return macPoolTable;
  }
コード例 #24
0
 void localize(ApplicationConstants constants) {
   warningLabel.setText(constants.storageDestroyPopupWarningLabel());
   rawMessage = constants.storageDestroyPopupMessageLabel();
 }
コード例 #25
0
  void initVmTable() {
    getTable().enableColumnResizing();

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

    AbstractTextColumn<VM> templateColumn =
        new AbstractTextColumn<VM>() {
          @Override
          public String getValue(VM object) {
            return vmTemplateNameRenderer.render(object);
          }
        };
    templateColumn.makeSortable();
    getTable().addColumn(templateColumn, constants.templateVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> originColumn =
        new AbstractEnumColumn<VM, OriginType>() {
          @Override
          protected OriginType getRawValue(VM object) {
            return object.getOrigin();
          }
        };
    originColumn.makeSortable();
    getTable().addColumn(originColumn, constants.originVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> memoryColumn =
        new AbstractTextColumn<VM>() {
          @Override
          public String getValue(VM object) {
            return String.valueOf(object.getVmMemSizeMb()) + " MB"; // $NON-NLS-1$
          }
        };
    memoryColumn.makeSortable();
    getTable().addColumn(memoryColumn, constants.memoryVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> cpuColumn =
        new AbstractTextColumn<VM>() {
          @Override
          public String getValue(VM object) {
            return String.valueOf(object.getNumOfCpus());
          }
        };
    cpuColumn.makeSortable();
    getTable().addColumn(cpuColumn, constants.cpusVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> archColumn =
        new AbstractTextColumn<VM>() {
          @Override
          public String getValue(VM object) {
            return String.valueOf(object.getClusterArch());
          }
        };
    archColumn.makeSortable();
    getTable().addColumn(archColumn, constants.architectureVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> diskColumn =
        new AbstractTextColumn<VM>() {
          @Override
          public String getValue(VM object) {
            return String.valueOf(object.getDiskMap().size());
          }
        };
    diskColumn.makeSortable();
    getTable().addColumn(diskColumn, constants.disksVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> creationDateColumn =
        new AbstractFullDateTimeColumn<VM>() {
          @Override
          protected Date getRawValue(VM object) {
            return object.getVmCreationDate();
          }
        };
    creationDateColumn.makeSortable(
        new Comparator<VM>() {
          @Override
          public int compare(VM vm1, VM vm2) {
            return vm1.getVmCreationDate().compareTo(vm2.getVmCreationDate());
          }
        });
    getTable().addColumn(creationDateColumn, constants.creationDateVm(), "95px"); // $NON-NLS-1$

    AbstractTextColumn<VM> exportDateColumn =
        new AbstractFullDateTimeColumn<VM>() {
          @Override
          protected Date getRawValue(VM object) {
            return object.getExportDate();
          }
        };
    exportDateColumn.makeSortable(
        new Comparator<VM>() {
          @Override
          public int compare(VM vm1, VM vm2) {
            return vm1.getExportDate().compareTo(vm2.getExportDate());
          }
        });
    getTable().addColumn(exportDateColumn, constants.exportDateVm(), "95px"); // $NON-NLS-1$

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<VM>(constants.restoreVm()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getRestoreCommand();
              }
            });

    getTable()
        .addActionButton(
            new WebAdminButtonDefinition<VM>(constants.removeVm()) {
              @Override
              protected UICommand resolveCommand() {
                return getDetailModel().getRemoveCommand();
              }
            });

    getTable().showRefreshButton();
  }
コード例 #26
0
 @TabInfo(container = DataCenterSubTabPanelPresenter.class)
 static TabData getTabData(
     SearchableDetailModelProvider<Cluster, DataCenterListModel, DataCenterClusterListModel>
         modelProvider) {
   return new ModelBoundTabData(constants.dataCenterClusterSubTabLabel(), 3, modelProvider);
 }
コード例 #27
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$
  }
コード例 #28
0
 @TabInfo(container = ClusterSubTabPanelPresenter.class)
 static TabData getTabData(
     DetailModelProvider<ClusterListModel<Void>, ClusterGeneralModel> modelProvider) {
   return new ModelBoundTabData(constants.clusterGeneralSubTabLabel(), 0, modelProvider);
 }
コード例 #29
0
 void localize(ApplicationConstants constants) {
   descriptionEditor.setLabel(constants.virtualMachineSnapshotCreatePopupDescriptionLabel());
 }
コード例 #30
0
 private void localize() {
   glusterSwiftStatusEditor.setLabel(constants.clusterGlusterSwiftLabel());
   manageGlusterSwiftButton.setLabel(constants.clusterGlusterSwiftManageLabel());
 }