/**
   * DOC sgandon Comment method "createMoreInformationColumn".
   *
   * @param composite
   * @return
   */
  public TableViewerCreatorColumn<ModuleToInstall, String> createMoreInformationColumn() {
    TableViewerCreatorColumn<ModuleToInstall, String> column =
        new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator);
    column.setTitle(Messages.getString("ExternalModulesInstallDialog_ColumnUrl")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_ColumnUrl")); // $NON-NLS-1$
    column.setModifiable(false);
    column.setSortable(true);
    column.setWeight(7);
    // set bean property accessor to allow sort by url name
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, String>() {

          @Override
          public String get(ModuleToInstall bean) {
            return bean.getUrl_description() != null
                ? bean.getUrl_description()
                : ""; //$NON-NLS-1$
          }

          @Override
          public void set(ModuleToInstall bean, String value) {
            // read only
          }
        });
    return column;
  }
  /**
   * DOC sgandon Comment method "createActionColumn".
   *
   * @return
   */
  public TableViewerCreatorColumn<ModuleToInstall, String> createActionColumn() {
    TableViewerCreatorColumn<ModuleToInstall, String> column =
        new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator);
    column.setTitle(
        Messages.getString("ExternalModulesInstallDialog_AvailableOnTalendForge")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_AvailableOnTalendForge")); // $NON-NLS-1$
    column.setModifiable(false);
    column.setSortable(true);
    column.setWeight(5);
    // set bean property accessor to allow sort by download type (automatic or manual)
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, String>() {

          @Override
          public String get(ModuleToInstall bean) {
            // use 2 invisible different values to allow sorting and have no visual impact when the
            // button is
            // selected
            return bean.getUrl_download() == null ? "" : " "; // $NON-NLS-1$//$NON-NLS-2$
          }

          @Override
          public void set(ModuleToInstall bean, String value) {
            // read only
          }
        });
    return column;
  }
  /** DOC sgandon Comment method "createLicenseColumn". */
  public void createLicenseColumn() {
    TableViewerCreatorColumn<ModuleToInstall, String> column =
        new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator);
    column.setTitle(
        Messages.getString("ExternalModulesInstallDialog_ColumnLicense")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_ColumnLicense")); // $NON-NLS-1$
    column.setSortable(true);
    // set bean property accessor to allow sort by license name
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, String>() {

          @Override
          public String get(ModuleToInstall bean) {
            return bean.getLicenseType();
          }

          @Override
          public void set(ModuleToInstall bean, String value) {
            // read only
          }
        });

    column.setModifiable(false);
    column.setWeight(3);
  }
  /** DOC sgandon Comment method "createContextColumn". */
  public void createContextColumn() {
    TableViewerCreatorColumn<ModuleToInstall, String> column =
        new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator);
    column.setSortable(true);
    column.setTitle(
        Messages.getString("ExternalModulesInstallDialog_ColumnRequiredBy")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_ColumnRequiredBy")); // $NON-NLS-1$
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, String>() {

          @Override
          public String get(ModuleToInstall bean) {
            return bean.getContext();
          }

          @Override
          public void set(ModuleToInstall bean, String value) {
            // read only column
          }
        });

    column.setModifiable(false);
    column.setWeight(5);
  }
  /** DOC sgandon Comment method "createJarNameColumn". */
  public void createJarNameColumn() {
    TableViewerCreatorColumn<ModuleToInstall, String> column =
        new TableViewerCreatorColumn<ModuleToInstall, String>(tableViewerCreator);
    column.setTitle(
        Messages.getString("ExternalModulesInstallDialog_ColumnJarName")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_ColumnJarName")); // $NON-NLS-1$
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, String>() {

          @Override
          public String get(ModuleToInstall bean) {
            return bean.getName();
          }

          @Override
          public void set(ModuleToInstall bean, String value) {
            // read only
          }
        });
    column.setSortable(true);
    tableViewerCreator.setDefaultSort(column, SORT.ASC);
    column.setWeight(5);
    column.setModifiable(false);
  }
  /** DOC sgandon Comment method "createREquiredColumn". */
  public void createRequiredColumn() {
    TableViewerCreatorColumn<ModuleToInstall, Boolean> column =
        new TableViewerCreatorColumn<ModuleToInstall, Boolean>(tableViewerCreator);
    column.setTitle(
        Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$
    column.setToolTipHeader(
        Messages.getString("ExternalModulesInstallDialog_ColumnRequired")); // $NON-NLS-1$
    column.setDisplayedValue(""); // $NON-NLS-1$
    column.setSortable(true);
    column.setImageProvider(
        new IColumnImageProvider<ModuleToInstall>() {

          @Override
          public Image getImage(ModuleToInstall bean) {
            if (bean.isRequired()) {
              return ImageProvider.getImage(EImage.CHECKED_ICON);
            } else {
              return ImageProvider.getImage(EImage.UNCHECKED_ICON);
            }
          }
        });
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<ModuleToInstall, Boolean>() {

          @Override
          public Boolean get(ModuleToInstall bean) {
            return bean.isRequired();
          }

          @Override
          public void set(ModuleToInstall bean, Boolean value) {
            // read only
          }
        });

    column.setModifiable(false);
    column.setWeight(2);
  }
Example #7
0
  private void configureAutoIndexColumn(
      TableViewerCreator<IMetadataColumn> tableViewerCreator, Table table) {
    TableViewerCreatorColumn<IMetadataColumn, Boolean> column =
        new TableViewerCreatorColumn<IMetadataColumn, Boolean>(tableViewerCreator);
    column.setBeanPropertyAccessors(
        new IBeanPropertyAccessors<IMetadataColumn, Boolean>() {

          @Override
          public Boolean get(IMetadataColumn bean) {
            if (bean instanceof MetadataColumnExt) {
              MetadataColumnExt columnExt = (MetadataColumnExt) bean;
              return columnExt.getData().isAutoIndexed();
            }
            return false;
          }

          @Override
          public void set(IMetadataColumn bean, Boolean value) {
            if (bean instanceof MetadataColumnExt) {
              MetadataColumnExt columnExt = (MetadataColumnExt) bean;
              columnExt.getData().setAutoIndexed(value);
            }
          }
        });
    String title = "Auto indexed"; // TODO: Internationalize this
    column.setTitle(title);
    column.setToolTipHeader(title);
    column.setModifiable(true);
    column.setWidth(76);
    column.setDisplayedValue("");
    column.setTableColumnSelectionListener(
        new CheckColumnSelectionListener(column, tableViewerCreator));
    column.setImageHeader(ImageProvider.getImage(EImage.CHECKED_ICON));
    CheckboxTableEditorContent checkbox = new CheckboxTableEditorContent();
    checkbox.setToolTipText(title);
    column.setTableEditorContent(checkbox);
  }