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
 @Override
 public void renderRows(List<EntityModalPresenter.VariableValueRow> rows) {
   dataProvider.setList(rows);
   pager.firstPage();
   dataProvider.refresh();
   pager.setPagerVisible(dataProvider.getList().size() > pager.getPageSize());
 }
Ejemplo n.º 3
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();
 }
 public void filterProcessList(String filter) {
   if (filter.equals("")) {
     if (currentProcessInstances != null) {
       dataProvider.getList().clear();
       dataProvider
           .getList()
           .addAll(new ArrayList<ProcessInstanceSummary>(currentProcessInstances));
       dataProvider.refresh();
     }
   } else {
     if (currentProcessInstances != null) {
       List<ProcessInstanceSummary> processes =
           new ArrayList<ProcessInstanceSummary>(currentProcessInstances);
       List<ProcessInstanceSummary> filteredProcesses = new ArrayList<ProcessInstanceSummary>();
       for (ProcessInstanceSummary ps : processes) {
         if (ps.getProcessName().toLowerCase().contains(filter.toLowerCase())
             || ps.getInitiator().toLowerCase().contains(filter.toLowerCase())) {
           filteredProcesses.add(ps);
         }
       }
       dataProvider.getList().clear();
       dataProvider.getList().addAll(filteredProcesses);
       dataProvider.refresh();
     }
   }
 }
Ejemplo n.º 5
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.º 7
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.º 8
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);
    }
  }
    public void setNavigationTreeModel(List<NavigationTreeElement> navigationTreeRootElements) {
      if (rootDataProvider != null) {
        rootDataProvider.getList().clear();

        for (NavigationTreeElement navigationTreeRootElement : navigationTreeRootElements) {
          rootDataProvider.getList().addAll(navigationTreeRootElement.getChildren());
        }
      }
    }
Ejemplo n.º 10
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.º 11
0
  public void setModelData(KBWorkspaceObjectData modelData) {
    if (modelData == null) return;

    modelDataProvider.getList().clear();
    modelDataProvider.getList().add(modelData);

    modelTableSelection = modelDataProvider.getList().get(0);

    setState(State.MODEL_SELECTED);
  }
Ejemplo n.º 12
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.º 13
0
  @Override
  public void updateDeploymentInfo(List<DeploymentRecord> deployments) {
    dataProvider.getList().clear();
    dataProvider.getList().addAll(deployments);
    dataProvider.flush();

    deploymentTable.selectDefaultEntity();

    filter.reset(true);
  }
Ejemplo n.º 14
0
  public void setFBAResultData(KBWorkspaceObjectData fbaResultData) {
    if (fbaResultData == null) return;

    fbaDataProvider.getList().clear();
    fbaDataProvider.getList().add(fbaResultData);

    fbaTableSelection = fbaDataProvider.getList().get(0);

    setState(State.FBA_SELECTED);
  }
Ejemplo n.º 15
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.º 16
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.º 17
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.º 18
0
  /**
   * Return table widget with external sources
   *
   * @return table widget containing ext sources
   */
  public CellTable<ExtSource> getTable() {

    // retrieve data
    retrieveData();

    // Table data provider.
    dataProvider = new ListDataProvider<ExtSource>(list);

    // Cell table
    table = new PerunTable<ExtSource>(list);

    // Connect the table to the data provider.
    dataProvider.addDataDisplay(table);

    // Sorting
    ListHandler<ExtSource> columnSortHandler = new ListHandler<ExtSource>(dataProvider.getList());
    table.addColumnSortHandler(columnSortHandler);

    // table selection
    table.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<ExtSource>createCheckboxManager());

    // set empty content & loader
    table.setEmptyTableWidget(loaderImage);
    loaderImage.setEmptyResultMessage("No external sources found in Perun.");

    // checkable
    if (this.checkable) {
      table.addCheckBoxColumn();
    }

    // ID column
    table.addIdColumn("Ext. source ID", null);

    // Name column
    table.addNameColumn(null);

    // Type column
    TextColumn<ExtSource> typeColumn =
        new TextColumn<ExtSource>() {
          @Override
          public String getValue(ExtSource extSource) {
            return String.valueOf(renameContent(extSource.getType()));
          }
        };
    table.addColumn(typeColumn, "Type");

    // return cellTable
    return table;
  }
Ejemplo n.º 19
0
  @UiHandler("btnRefresh")
  void refreshRecords(ClickEvent e) {
    recordStore.getList().clear();
    clientApi
        .iitemsApi()
        .list(
            new MethodCallback<List<InputItem>>() {
              @Override
              public void onFailure(Method method, Throwable e) {
                md.error(MDS, "Error loading user data", e);
              }

              @Override
              public void onSuccess(Method method, List<InputItem> recs) {
                Collections.sort(
                    recs,
                    new Comparator<InputItem>() {
                      @Override
                      public int compare(InputItem o1, InputItem o2) {
                        return o1.getName().compareTo(o2.getName());
                      }
                    });
                recordStore.getList().addAll(recs);
                md.clear(MDS);
              }
            });

    // TODO not sure it should be here (or: should it be loaded in sequential way ?)
    loadInputsList();
    loadTxFormsList();
  }
  @SuppressWarnings("unchecked")
  @Override
  protected void createColumns(
      DefaultCellTable<ArtifactReference> table, ListDataProvider<ArtifactReference> dataProvider) {
    final TextColumn<ArtifactReference> nameColumn =
        new TextColumn<ArtifactReference>() {
          @Override
          public String getValue(ArtifactReference reference) {
            return reference.getName();
          }
        };
    nameColumn.setSortable(true);

    final TextColumn<ArtifactReference> urlColumn =
        new TextColumn<ArtifactReference>() {
          @Override
          public String getValue(ArtifactReference reference) {
            return reference.getUrl();
          }
        };
    urlColumn.setSortable(true);

    ColumnSortEvent.ListHandler<ArtifactReference> sortHandler =
        new ColumnSortEvent.ListHandler<ArtifactReference>(dataProvider.getList());
    sortHandler.setComparator(nameColumn, createColumnCommparator(nameColumn));
    sortHandler.setComparator(urlColumn, createColumnCommparator(urlColumn));

    table.addColumn(nameColumn, "Name");
    table.addColumn(urlColumn, "URL");
    table.addColumnSortHandler(sortHandler);

    table.addColumnSortHandler(sortHandler);
    table.getColumnSortList().push(urlColumn);
    table.getColumnSortList().push(nameColumn);
  }
Ejemplo n.º 21
0
  private void onDataObjectChange(@Observes DataObjectChangeEvent event) {
    if (event.isFromContext(context != null ? context.getContextId() : null)) {
      if (event.getChangeType() == ChangeType.CLASS_NAME_CHANGE
          || event.getChangeType() == ChangeType.PACKAGE_NAME_CHANGE
          || event.getChangeType() == ChangeType.OBJECT_NAME_CHANGE
          || MainDomainAnnotations.LABEL_ANNOTATION.equals(event.getAnnotationClassName())) {

        refreshObjectSelector(dataObject);

        // For self references: in case name or package changes redraw properties table
        skipNextFieldNotification = true;
        dataObjectPropertiesProvider.refresh();
        dataObjectPropertiesTable.redraw();

        Scheduler.get()
            .scheduleDeferred(
                new Scheduler.ScheduledCommand() {
                  @Override
                  public void execute() {
                    selectCurrentObject(false);
                  }
                });
      }
    }
  }
Ejemplo n.º 22
0
  @UiHandler("buttonBuy")
  public void acceptBuy(ClickEvent e) {

    // RootPanel.get("page2");
    Window.alert(
        "Le système de paiement est actuellement en maintenance, merci de votre compréhension.");

    List<Reservation> l = new ArrayList<Reservation>();
    for (Offre o : listOffers.getList()) {
      Reservation r = new Reservation();
      r.setIdOffre(o.getId());
      r.setIdUtilisateur(4);

      l.add(r);
    }

    service.doReservation(
        "",
        l,
        "09090909090",
        new AsyncCallback<Void>() {

          @Override
          public void onFailure(Throwable caught) {

            // TODO Auto-generated method stub

          }

          @Override
          public void onSuccess(Void result) {}
        });
  }
Ejemplo n.º 23
0
  @Inject
  BudgetSiderView(
      Binder uiBinder,
      BudgetCell budgetCell,
      Resources resources,
      SiderListStyle siderListResources) {
    this.keyProvider = setupKeyProvider();
    this.dataProvider = new ListDataProvider<Budget>(keyProvider);

    budgetList = new CellList<Budget>(budgetCell, siderListResources);
    selectionModel = new SingleSelectionModel<Budget>(keyProvider);

    // Init The UI Binder
    initWidget(uiBinder.createAndBindUi(this));

    // Set up CSS Style Classes
    addNew.setStylePrimaryName(resources.buttonStyleCss().button());
    addNew.setStyleName(resources.buttonStyleCss().medium(), true);
    addNew.setStyleName(resources.buttonStyleCss().gray(), true);

    budgetList.setKeyboardSelectionPolicy(
        HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
    budgetList.setSelectionModel(selectionModel);
    dataProvider.addDataDisplay(budgetList);

    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent selectionChangeEvent) {
            getUiHandlers().budgetSelected(selectionModel.getSelectedObject());
          }
        });
  }
Ejemplo n.º 24
0
 public void updateChanges(List<ModelNode> _changes) {
   dataProvider.setList(_changes);
   table.selectDefaultEntity();
   this.changes.clear();
   this.changes.addAll(_changes);
   detailsConfigurationChange.clearValue();
 }
Ejemplo n.º 25
0
  @Override
  public void updateFrom(EESubsystem eeSubsystem) {
    form.edit(eeSubsystem);
    dataProvider.setList(eeSubsystem.getModules());

    moduleList.selectDefaultEntity();
  }
Ejemplo n.º 26
0
  public DefaultCellTable asWidget() {

    table = new DefaultCellTable<SocketBinding>(6);
    dataProvider = new ListDataProvider<SocketBinding>();
    dataProvider.addDataDisplay(table);

    TextColumn<SocketBinding> nameColumn =
        new TextColumn<SocketBinding>() {
          @Override
          public String getValue(SocketBinding record) {
            return record.getName();
          }
        };

    TextColumn<SocketBinding> portColumn =
        new TextColumn<SocketBinding>() {
          @Override
          public String getValue(SocketBinding record) {
            return String.valueOf(record.getPort() + portOffset);
          }
        };

    table.addColumn(nameColumn, "Name");
    table.addColumn(portColumn, "Port");

    return table;
  }
Ejemplo n.º 27
0
  public void showReport(final AnalysisReport report) {
    currentReport = report;

    if (!report.getAnalysisData().isEmpty()) {
      placeManager.goTo(IDENTIFIER);
    } else {
      placeManager.closePlace(IDENTIFIER);
    }

    dataProvider.setList(report.getAnalysisData());

    if (dataProvider.getList().isEmpty()) {
      view.clearIssue();
    } else {
      view.show(dataProvider.getList().get(0));
    }
  }
Ejemplo n.º 28
0
    @Override
    public void onSuccess(List<AnamnesisCheckProxy> response) {
      Log.debug("setQuestionTableData() - sueccess and response size = " + response.size());
      Log.debug("dataProvider.getList().size() = " + dataProvider.getList().size());

      dataProvider.getList().clear();
      dataProvider.getList().addAll(response);
      // AnamnesisCheckActivity.this.view.getTable().setPageSize(dataProvider.getList().size());
      AnamnesisCheckActivity.this.view.setTableSize(dataProvider.getList().size());
      Log.info("page size--" + AnamnesisCheckActivity.this.view.getTable().getPageSize());
      AnamnesisCheckActivity.this.view.getTable().redraw();
      dataProvider.refresh();
      AnamnesisCheckActivity.this.view.getTable().redraw();
      // innerSystemStartView.getTable().cellTable.setPageSize(25);
      // anamnesisCheckTable.cellTable.setPageSize(25);
      Log.info("data provider--" + dataProvider.getList().size());
    }
Ejemplo n.º 29
0
 public void select(String key) {
   for (Property property : dataProvider.getList()) {
     if (property.getName().equals(key)) {
       selectionModel.setSelected(property, true);
       break;
     }
   }
 }
Ejemplo n.º 30
0
  public void setStack(JGroupsStack stack) {
    this.selectedStack = stack;

    headline.setText("Protocols: Stack " + stack.getName());

    dataProvider.setList(stack.getProtocols());
    table.selectDefaultEntity();
  }