コード例 #1
0
ファイル: MainGrid.java プロジェクト: BerengereG/contrib
 /**
  * ******************************************************* Scrolling Functions
  * ********************************************************
  */
 private void selectPreviouslySelectedItem() {
   if (selectedItemIndex < store.getModels().size() && selectedItemIndex >= 0)
     mainGridSelectionModel.select(selectedItemIndex, true);
 }
コード例 #2
0
ファイル: MainGrid.java プロジェクト: BerengereG/contrib
  private ColumnModel createColumnModel() {
    ArrayList<ColumnConfig> columns = new ArrayList<ColumnConfig>();

    mainGridSelectionModel = new CheckBoxSelectionModel<ModelData>();
    mainGridSelectionModel.setSelectionMode(Style.SelectionMode.MULTI);
    columns.add(mainGridSelectionModel.getColumn());

    countryColumn = new ColumnConfig("country", HarvesterUI.ICONS.worldmap().getHTML(), 35);
    countryColumn.setAlignment(Style.HorizontalAlignment.CENTER);

    countryColumn.setRenderer(
        new GridCellRenderer<ModelData>() {
          public Object render(
              ModelData model,
              String property,
              ColumnData config,
              int rowIndex,
              int colIndex,
              ListStore<ModelData> store,
              Grid<ModelData> grid) {
            if (model instanceof DataProviderUI) {
              if (model.get("country") != null && !model.get("country").equals("none")) {
                return "<img src=\"resources/images/countries/"
                    + model.get("country")
                    + ".png\" alt=\""
                    + model.get("countryName")
                    + "\" title=\""
                    + model.get("countryName")
                    + "\"/> ";
              }
            }
            return "";
          }
        });
    columns.add(countryColumn);

    ColumnConfig name =
        new ColumnConfig("name", "<CENTER>" + HarvesterUI.CONSTANTS.name() + "</CENTER>", 100);
    name.setRenderer(new TreeGridCellRenderer<ModelData>());
    name.setWidth(260);
    columns.add(name);

    // Europeana column only
    if (HarvesterUI.getProjectType().equals("EUROPEANA")) {
      ColumnConfig nameCode =
          new ColumnConfig(
              "nameCode", "<CENTER>" + HarvesterUI.CONSTANTS.nameCodeHeader() + "</CENTER>", 100);
      columns.add(nameCode);
    }

    ColumnConfig dataSourceSet =
        new ColumnConfig(
            "dataSourceSet", "<CENTER>" + HarvesterUI.CONSTANTS.dataSetHeader() + "</CENTER>", 100);
    columns.add(dataSourceSet);

    ColumnConfig metadataFormat =
        new ColumnConfig(
            "metadataFormat",
            "<CENTER>" + HarvesterUI.CONSTANTS.oaiSchemasHeader() + "</CENTER>",
            100);
    metadataFormat.setWidth(110);
    columns.add(metadataFormat);

    ColumnConfig ingest =
        new ColumnConfig(
            "ingest", "<CENTER>" + HarvesterUI.CONSTANTS.ingestTypeHeader() + "</CENTER>", 150);
    ingest.setRenderer(new IngestTypeRenderer());
    columns.add(ingest);
    ColumnConfig lastIngest =
        new ColumnConfig(
            "lastIngest", "<CENTER>" + HarvesterUI.CONSTANTS.lastIngestHeader() + "</CENTER>", 100);
    lastIngest.setWidth(130);
    lastIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    lastIngest.setRenderer(new LastIngestRenderer());
    columns.add(lastIngest);
    ColumnConfig nextIngest =
        new ColumnConfig(
            "nextIngest", "<CENTER>" + HarvesterUI.CONSTANTS.nextIngestHeader() + "</CENTER>", 100);
    nextIngest.setRenderer(new NextIngestRenderer());
    nextIngest.setAlignment(Style.HorizontalAlignment.CENTER);
    nextIngest.setWidth(130);
    columns.add(nextIngest);
    ColumnConfig records =
        new ColumnConfig(
            "records", "<CENTER>" + HarvesterUI.CONSTANTS.records() + "</CENTER>", 100);
    records.setAlignment(Style.HorizontalAlignment.RIGHT);
    records.setRenderer(new RecordsRenderer());
    columns.add(records);
    ColumnConfig ingestStatus =
        new ColumnConfig(
            "status", "<CENTER>" + HarvesterUI.CONSTANTS.ingestStatusHeader() + "</CENTER>", 100);
    ingestStatus.setRenderer(new IngestStatusRenderer());
    ingestStatus.setAlignment(Style.HorizontalAlignment.CENTER);
    columns.add(ingestStatus);

    return new ColumnModel(columns);
  }