Ejemplo n.º 1
1
  @Override
  public void filterTable(String filter) {

    // store list only for first time
    if (fullBackup.isEmpty() || fullBackup == null) {
      fullBackup.addAll(getList());
    }

    // always clear selected items
    selectionModel.clear();
    list.clear();

    if (filter.equalsIgnoreCase("")) {
      list.addAll(fullBackup);
    } else {
      for (ExtSource src : fullBackup) {
        // store ext source if name or type matches
        if ((src.getName().toLowerCase().startsWith(filter.toLowerCase()))
            || renameContent(src.getType()).toLowerCase().startsWith(filter.toLowerCase())) {
          list.add(src);
        }
      }
    }

    if (list.isEmpty() && !filter.isEmpty()) {
      loaderImage.setEmptyResultMessage("No external source matching '" + filter + "' found.");
    } else {
      loaderImage.setEmptyResultMessage("No external sources found in Perun.");
    }

    dataProvider.flush();
    dataProvider.refresh();
    loaderImage.loadingFinished();
  }
Ejemplo n.º 2
0
  private void addDataObjectProperty(
      DataObject dataObject,
      final String propertyName,
      final String propertyLabel,
      final String propertyType,
      final Boolean isMultiple) {

    AddPropertyCommand command =
        commandBuilder.buildAddPropertyCommand(
            getContext(),
            DataModelerEvent.DATA_OBJECT_BROWSER,
            dataObject,
            propertyName,
            propertyLabel,
            propertyType,
            isMultiple);

    command.execute();
    ObjectProperty property = command.getProperty();

    dataObjectPropertiesProvider.getList().add(property);
    dataObjectPropertiesProvider.flush();
    dataObjectPropertiesProvider.refresh();
    dataObjectPropertiesTable.setKeyboardSelectedRow(
        dataObjectPropertiesProvider.getList().size() - 1);

    executePostCommandProcessing(command);
  }
 /** Clear all table content */
 public void clearTable() {
   loaderImage.loadingStart();
   list.clear();
   selectionModel.clear();
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 4
0
 public void insertToTable(int index, ExtSource object) {
   list.add(index, object);
   oracle.add(object.getName());
   oracle.add(renameContent(object.getType()));
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 5
0
 /**
  * Add object as new row to table
  *
  * @param object ExtSource to be added as new row
  */
 public void addToTable(ExtSource object) {
   list.add(object);
   oracle.add(object.getName());
   oracle.add(renameContent(object.getType()));
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 6
0
  private void setDataObject(DataObject dataObject) {
    this.dataObject = dataObject;
    refreshObjectSelector(dataObject);

    // We create a new selection model due to a bug found in GWT when we change e.g. from one data
    // object with 9 rows
    // to one with 3 rows and the table was sorted.
    // Several tests has been done and the final workaround (not too bad) we found is to
    // 1) sort the table again
    // 2) create a new selection model
    // 3) populate the table with new items
    // 3) select the first row
    SingleSelectionModel selectionModel2 = new SingleSelectionModel<ObjectProperty>();
    dataObjectPropertiesTable.setSelectionModel(selectionModel2);

    selectionModel2.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            ObjectProperty selectedProperty =
                ((SingleSelectionModel<ObjectProperty>)
                        dataObjectPropertiesTable.getSelectionModel())
                    .getSelectedObject();
            notifyFieldSelected(selectedProperty);
          }
        });

    List<ObjectProperty> dataObjectProperties =
        (dataObject != null)
            ? DataModelerUtils.getManagedProperties(dataObject)
            : Collections.<ObjectProperty>emptyList();

    ArrayList<ObjectProperty> sortBuffer = new ArrayList<ObjectProperty>();
    if (dataObject != null) {
      sortBuffer.addAll(dataObjectProperties);
    }
    Collections.sort(sortBuffer, new ObjectPropertyComparator("name"));

    dataObjectPropertiesProvider.getList().clear();
    dataObjectPropertiesProvider.getList().addAll(sortBuffer);
    dataObjectPropertiesProvider.flush();
    dataObjectPropertiesProvider.refresh();

    dataObjectPropertiesTable
        .getColumnSortList()
        .push(new ColumnSortList.ColumnSortInfo(dataObjectPropertiesTable.getColumn(2), true));

    if (dataObjectProperties.size() > 0) {
      dataObjectPropertiesTable.setKeyboardSelectedRow(0);
      selectionModel2.setSelected(sortBuffer.get(0), true);
    }

    // set the first row selected again. Sounds crazy, but's part of the workaround, don't remove
    // this line.
    if (dataObjectProperties.size() > 0) {
      dataObjectPropertiesTable.setKeyboardSelectedRow(0);
    }
  }
Ejemplo n.º 7
0
 /** Sorts table by objects Name */
 public void sortTable() {
   if (service == null) {
     list = new TableSorter<Destination>().sortByFacilityName(getList());
   } else {
     list = new TableSorter<Destination>().sortByService(getList());
   }
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 8
0
  @Override
  public void updateDeploymentInfo(List<DeploymentRecord> deployments) {
    dataProvider.getList().clear();
    dataProvider.getList().addAll(deployments);
    dataProvider.flush();

    deploymentTable.selectDefaultEntity();

    filter.reset(true);
  }
Ejemplo n.º 9
0
 public void setList(ArrayList<ExtSource> list) {
   clearTable();
   this.list.addAll(list);
   for (ExtSource object : list) {
     oracle.add(object.getName());
     oracle.add(renameContent(object.getType()));
   }
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 10
0
 private void initMockData(
     final Pagination pagination,
     final SimplePager simplePager,
     final ListDataProvider<TableTestPojo> dataProvider) {
   for (int i = 0; i < 25; i++) {
     dataProvider.getList().add(new TableTestPojo("Test " + i, "Test " + i, "Test " + i));
   }
   dataProvider.flush();
   pagination.rebuild(simplePager);
 }
Ejemplo n.º 11
0
 public void insertToTable(int index, Destination object) {
   list.add(index, object);
   oracle.add(object.getDestination());
   if (service == null) {
     oracle.add(object.getService().getName());
   } else {
     oracle.add(object.getFacility().getName());
   }
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 12
0
 public void setList(ArrayList<Destination> list) {
   clearTable();
   this.list.addAll(list);
   for (Destination d : list) {
     oracle.add(d.getDestination());
     if (service == null) {
       oracle.add(d.getService().getName());
     } else {
       oracle.add(d.getFacility().getName());
     }
   }
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 13
0
  public void filterTable(String text) {

    // store list only for first time
    if (fullBackup.isEmpty() || fullBackup == null) {
      fullBackup.addAll(list);
    }

    // always clear selected items
    selectionModel.clear();
    list.clear();

    if (text.equalsIgnoreCase("")) {
      list.addAll(fullBackup);
    } else {
      for (Destination dst : fullBackup) {
        // store facility by filter
        if (service == null) {
          if (dst.getDestination().toLowerCase().contains(text.toLowerCase())
              || dst.getService().getName().toLowerCase().contains(text.toLowerCase())) {
            list.add(dst);
          }
        } else {
          if (dst.getDestination().toLowerCase().contains(text.toLowerCase())
              || dst.getFacility().getName().toLowerCase().contains(text.toLowerCase())) {
            list.add(dst);
          }
        }
      }
    }

    if (list.isEmpty() && !text.isEmpty()) {
      loaderImage.setEmptyResultMessage("No destination matching '" + text + "' found.");
    } else {
      if (showFac) {
        loaderImage.setEmptyResultMessage("Service has no destination.");
      } else {
        loaderImage.setEmptyResultMessage(
            "Facility has no services destinations. Service configuration can't be propagated.");
      }
    }

    dataProvider.flush();
    dataProvider.refresh();
    loaderImage.loadingFinished();
  }
Ejemplo n.º 14
0
  private void deleteDataObjectProperty(final ObjectProperty objectProperty, final int index) {
    if (dataObject != null) {
      dataObject.getProperties().remove(objectProperty);

      dataObjectPropertiesProvider.getList().remove(index);
      dataObjectPropertiesProvider.flush();
      dataObjectPropertiesProvider.refresh();

      getContext()
          .getHelper()
          .dataObjectUnReferenced(objectProperty.getClassName(), dataObject.getClassName());
      notifyFieldDeleted(objectProperty);
      if (dataObjectPropertiesProvider.getList().size() == 0) {
        context.setObjectProperty(null);
        dataModelerWBContextEvent.fire(new DataModelerWorkbenchContextChangeEvent());
      } else if (dataObjectPropertiesProvider.getList().size() == 1) {
        // BZ-1255449 tricky bug. Considerable time was spent, and it was no direct to find an
        // optimal/better solution.
        // Since in this use case the Data Object will have just one field, it's acceptable to
        // reload the list.
        setDataObject(dataObject);
      }
    }
  }
 /**
  * Removes object as row from table
  *
  * @param object Publication to be removed as row
  */
 public void removeFromTable(Publication object) {
   list.remove(object);
   selectionModel.getSelectedSet().remove(object);
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 16
0
 /** Sorts table by objects Name */
 public void sortTable() {
   list = new TableSorter<Attribute>().sortByAttrNameTranslation(getList());
   dataProvider.flush();
   dataProvider.refresh();
 }
 /** Sorts table by objects Name */
 public void sortTable() {
   list = new TableSorter<Publication>().sortByPublicationTitle(getList());
   dataProvider.flush();
   dataProvider.refresh();
 }
 /**
  * Add object as new row to table
  *
  * @param object Publication to be added as new row
  */
 public void addToTable(Publication object) {
   list.add(object);
   dataProvider.flush();
   dataProvider.refresh();
 }
 /** Sorts table by objects date */
 public void sortTable() {
   list = new TableSorter<TaskResult>().sortByRichTaskResultDestination(getList());
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 20
0
 /**
  * Add object as new row to table
  *
  * @param object Group to be added as new row
  */
 public void addToTable(Group object) {
   list.add(object);
   dataProvider.flush();
   dataProvider.refresh();
 }
 public void insertToTable(int index, TaskResult object) {
   list.add(index, object);
   dataProvider.flush();
   dataProvider.refresh();
 }
 /**
  * Add object as new row to table
  *
  * @param object Resource to be added as new row
  */
 public void addToTable(TaskResult object) {
   list.add(object);
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 23
0
 /** Sorts table by objects Name */
 public void sortTable() {
   list = new TableSorter<ExtSource>().sortByName(getList());
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 24
0
 public void insertToTable(int index, Attribute object) {
   list.add(index, object);
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 25
0
 /**
  * Add object as new row to table
  *
  * @param object Attribute to be added as new row
  */
 public void addToTable(Attribute object) {
   list.add(object);
   dataProvider.flush();
   dataProvider.refresh();
 }
 public void setList(ArrayList<TaskResult> list) {
   clearTable();
   this.list.addAll(list);
   dataProvider.flush();
   dataProvider.refresh();
 }
 public void insertToTable(int index, Publication object) {
   list.add(index, object);
   dataProvider.flush();
   dataProvider.refresh();
 }
 public void setList(ArrayList<Publication> list) {
   clearTable();
   this.list.addAll(list);
   dataProvider.flush();
   dataProvider.refresh();
 }
Ejemplo n.º 29
0
 /** Sorts table by objects service name */
 public void sortTable() {
   list = new TableSorter<Task>().sortByService(getList());
   dataProvider.flush();
   dataProvider.refresh();
 }