Ejemplo n.º 1
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.º 2
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.º 3
0
  private void initTable(Translations translations) {
    table.setVisibleRange(0, 10);
    table.addColumn(Columns.NAME, translations.nameLabel());
    table.addColumn(Columns.VALUE, translations.valueLabel());
    table.addColumn(Columns.ACTIONS, translations.actionsLabel());
    table.setEmptyTableWidget(new Label(translations.noOtionsLabel()));

    registerActionsHandlers();
    dataProvider.addDataDisplay(table);
    pager.setDisplay(table);
  }
Ejemplo n.º 4
0
  @Inject
  RatingView(Binder uiBinder, RatingColumnsDefinition ratingColumnInitializer) {
    this.ratingColumnInitializer = ratingColumnInitializer;

    initRatingGrid();

    initWidget(uiBinder.createAndBindUi(this));

    ratingDataProvider = new ListDataProvider<>();
    ratingDataProvider.addDataDisplay(ratingGrid);
  }
Ejemplo n.º 5
0
  public void createOffersTable() {

    TextColumn<Offre> titleCollumn =
        new TextColumn<Offre>() {

          @Override
          public String getValue(Offre offre) {

            return offre.getLibelle();
          }
        };

    TextColumn<Offre> priceColumn =
        new TextColumn<Offre>() {

          @Override
          public String getValue(Offre offre) {

            return String.valueOf(offre.getPrix());
          }
        };

    this.multiSelectionModel = new MultiSelectionModel<Offre>();
    cellTable.setSelectionModel(
        multiSelectionModel, DefaultSelectionEventManager.<Offre>createCheckboxManager());

    ButtonCell cellButton = new ButtonCell();
    Column<Offre, String> column =
        new Column<Offre, String>(cellButton) {

          @Override
          public String getValue(Offre object) {
            return "DELETE";
          }
        };
    column.setFieldUpdater(
        new FieldUpdater<Offre, String>() {

          @Override
          public void update(int index, Offre object, String value) {
            listOffers.getList().remove(object);
          }
        });

    // Add the columns.
    cellTable.addColumn(titleCollumn, "Intitulle");
    cellTable.addColumn(priceColumn, "Prix");
    cellTable.addColumn(column);
    //		final SimplePager pager = new SimplePager();
    //		pager.setDisplay(cellTable);

    listOffers.addDataDisplay(cellTable);
  }
Ejemplo n.º 6
0
  public KscComboboxViewImpl() {
    initWidget(uiBinder.createAndBindUi(this));

    m_layoutPanel.setSize("100%", "23px");
    m_textBox.addKeyDownHandler(
        new KeyDownHandler() {

          @Override
          public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
              if (m_presenter != null) {
                m_presenter.onEnterKeyEvent();
              }
            }
          }
        });

    m_selectionModel = new SingleSelectionModel<KscReportDetail>();
    m_selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            m_presenter.onKscReportSelected();
          }
        });

    m_reportList = new CellList<KscReportDetail>(new KscReportDetailCell());
    m_reportList.setPageSize(10);
    m_reportList.getElement().getStyle().setFontSize(12, Unit.PX);
    m_reportList.setSelectionModel(m_selectionModel);

    m_dataList = new ListDataProvider<KscReportDetail>();
    m_dataList.addDataDisplay(m_reportList);

    m_pager = new SimplePager();
    m_pager.setStyleName("onms-table-no-borders-margin");
    m_pager.getElement().getStyle().setWidth(100, Unit.PCT);
    m_pager.setDisplay(m_reportList);

    FlowPanel flowPanel = new FlowPanel();
    flowPanel.add(m_reportList);
    flowPanel.add(m_pager);
    m_popupPanel = new PopupPanel();
    m_popupPanel.add(flowPanel);
    m_popupPanel.setAutoHideEnabled(true);
    m_popupPanel.setAnimationEnabled(true);
    m_popupPanel.setModal(false);
    m_popupPanel.getElement().getStyle().setBorderWidth(1, Unit.PX);
    m_popupPanel.getElement().getStyle().setBorderColor("#B5B8C8");
    m_popupPanel.getElement().getStyle().setPadding(1, Unit.PX);
  }
Ejemplo n.º 7
0
 @Inject
 public PhenotypeListPresenter(
     EventBus eventBus,
     MyView view,
     final DispatchAsync dispatch,
     final BackendResultReader backendResultReader,
     final ProgressPresenter progressPresenter) {
   super(eventBus, view);
   this.dispatch = dispatch;
   this.backendResultReader = backendResultReader;
   getView().setUiHandlers(this);
   phenotypeDataProvider.addDataDisplay(getView().getDisplay());
 }
  @Inject
  public DocumentDetailPresenterImpl(
      final DocumentDetailView view, final DocumentManagerLiaison documentManagerLiaison) {
    this.view = checkNotNull(view);
    this.documentManagerLiaison = checkNotNull(documentManagerLiaison);

    view.setPresenter(this);

    // Hook up the data provider for attributes
    attributesDataProvider = new ListDataProvider<DocumentAttributeDTO>();
    view.getAttributesDataContainer()
        .setSelectionModel(new NoSelectionModel<DocumentAttributeDTO>());
    attributesDataProvider.addDataDisplay(view.getAttributesDataContainer());
  }
Ejemplo n.º 9
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.º 10
0
  private void initTable(
      DataGrid<KBWorkspaceObjectData> table, ListDataProvider<KBWorkspaceObjectData> dataProvider) {
    // populate the view with the current user's stuff.
    // columns: id, owner, command, mod date
    TextColumn<KBWorkspaceObjectData> idColumn =
        new TextColumn<KBWorkspaceObjectData>() {
          @Override
          public String getValue(KBWorkspaceObjectData metadata) {
            return metadata.getId();
          }
        };

    TextColumn<KBWorkspaceObjectData> workspaceColumn =
        new TextColumn<KBWorkspaceObjectData>() {
          @Override
          public String getValue(KBWorkspaceObjectData metadata) {
            return metadata.getWorkspace();
          }
        };

    TextColumn<KBWorkspaceObjectData> ownerColumn =
        new TextColumn<KBWorkspaceObjectData>() {
          @Override
          public String getValue(KBWorkspaceObjectData metadata) {
            return metadata.getOwner();
          }
        };

    TextColumn<KBWorkspaceObjectData> modDateColumn =
        new TextColumn<KBWorkspaceObjectData>() {
          @Override
          public String getValue(KBWorkspaceObjectData metadata) {
            return metadata.getModDate();
          }
        };

    // add columns to the table
    table.addColumn(idColumn, TEXT_ID_COL);
    table.addColumn(workspaceColumn, TEXT_WORKSPACE_COL);
    table.addColumn(ownerColumn, TEXT_OWNER_COL);
    table.addColumn(modDateColumn, TEXT_DATE_COL);

    // add data provider
    dataProvider.addDataDisplay(table);

    // add a selection model
    final SingleSelectionModel<KBWorkspaceObjectData> selectionModel =
        new SingleSelectionModel<KBWorkspaceObjectData>(KBWorkspaceObjectData.KEY_PROVIDER);
    table.setSelectionModel(selectionModel);
  }
Ejemplo n.º 11
0
  private void initTable(
      final AbstractCellTable<TableTestPojo> grid,
      final SimplePager pager,
      final Pagination pagination,
      final ListDataProvider<TableTestPojo> dataProvider) {
    final TextColumn<TableTestPojo> col1 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col1, "Field 1");

    final TextColumn<TableTestPojo> col2 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col2, "Field 2");

    final TextColumn<TableTestPojo> col3 =
        new TextColumn<TableTestPojo>() {

          @Override
          public String getValue(final TableTestPojo object) {
            return String.valueOf(object.getField1());
          }
        };
    grid.addColumn(col3, "Field 3");

    grid.addRangeChangeHandler(
        new RangeChangeEvent.Handler() {

          @Override
          public void onRangeChange(final RangeChangeEvent event) {
            pagination.rebuild(pager);
          }
        });

    pager.setDisplay(grid);
    pagination.clear();
    dataProvider.addDataDisplay(grid);
  }
Ejemplo n.º 12
0
  @SuppressWarnings("unchecked")
  public Widget asWidget() {
    VerticalPanel panel = new VerticalPanel();
    panel.addStyleName("fill-layout-width");

    setupTable();
    dataProvider = new ListDataProvider<>();
    dataProvider.addDataDisplay(table);

    panel.add(setupTableButtons());

    panel.add(table);
    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);
    panel.add(pager);
    return panel;
  }
Ejemplo n.º 13
0
  public void createOffersTable() {

    // Create tweet column.
    TextColumn<Offre> titleCollumn =
        new TextColumn<Offre>() {
          @Override
          public String getValue(Offre offre) {
            return offre.getLibelle();
          }
        };

    // Create tweet column.
    TextColumn<Offre> priceColumn =
        new TextColumn<Offre>() {
          @Override
          public String getValue(Offre offre) {
            return String.valueOf(offre.getPrix());
          }
        };

    final MultiSelectionModel<Offre> multiSelectionModel = new MultiSelectionModel<Offre>();
    cellTable.setSelectionModel(
        multiSelectionModel, DefaultSelectionEventManager.<Offre>createCheckboxManager());

    Column<Offre, Boolean> checkColumn =
        new Column<Offre, Boolean>(new CheckboxCell(true, false)) {

          @Override
          public Boolean getValue(Offre object) {
            return multiSelectionModel.isSelected(object);
          }
        };

    // Add the columns.
    cellTable.addColumn(checkColumn);
    cellTable.addColumn(titleCollumn, "Intitulle");
    cellTable.addColumn(priceColumn, "Prix");
    ArrayList<Offre> tmp = OffreDAO.selectAll();
    listOffers.setList(tmp);

    listOffers.addDataDisplay(cellTable);

    final SimplePager pager = new SimplePager();
    pager.setDisplay(cellTable);
  }
Ejemplo n.º 14
0
  @SuppressWarnings("unchecked")
  public IOPanel(AddressTemplate address, IOPresenter presenter) {
    this.address = address;
    this.presenter = presenter;
    this.providesKey =
        new ProvidesKey<Property>() {
          @Override
          public Object getKey(Property item) {
            return item.getName();
          }
        };
    this.table = new DefaultCellTable<>(5, providesKey);
    this.dataProvider = new ListDataProvider<Property>(providesKey);
    this.selectionModel = new SingleSelectionModel<Property>(providesKey);

    dataProvider.addDataDisplay(table);
    table.setSelectionModel(selectionModel);
  }
Ejemplo n.º 15
0
  public ExonDetailPanel() {
    dataGrid.setWidth("100%");
    initializeTable();
    dataProvider.addDataDisplay(dataGrid);
    dataGrid.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            if (selectionModel.getSelectedSet().isEmpty()) {
              exonEditContainer.setVisible(false);
            } else {
              exonEditContainer.setVisible(true);
              updateDetailData(selectionModel.getSelectedObject());
            }
          }
        });

    initWidget(ourUiBinder.createAndBindUi(this));
  }
  @Override
  public void onModuleLoad() {

    // Create the buttons
    testPerformance = new Button("Test Performance of both");
    testPerformance.addClickHandler(this);

    testListPerformance = new Button("Test Performance of List");
    testListPerformance.addClickHandler(this);

    testSetPerformance = new Button("Test Performance of Set");
    testSetPerformance.addClickHandler(this);

    // Create the Output table
    CellTable<PerformanceTestResults> table = new CellTable<PerformanceTestResults>();
    table.setPageSize(1000);
    initTableColumns(table);

    // Create the data provider and bind it to the table
    ListDataProvider<PerformanceTestResults> dataProvider =
        new ListDataProvider<PerformanceTestResults>();
    dataProvider.addDataDisplay(table);

    // Get the data providers collection to manipulate
    results = dataProvider.getList();

    // Create number of elements input
    Label inputLabel = new Label("Number of elements:");
    inputLabel.getElement().getStyle().setDisplay(Display.INLINE);
    inputTextBox = new TextBox();
    inputTextBox.setText("" + DEFAULT_NUMBER_OF_TEST_ITEMS);

    // Add Elements to the screen
    RootPanel.get().add(inputLabel);
    RootPanel.get().add(inputTextBox);
    RootPanel.get().add(testPerformance);
    RootPanel.get().add(testListPerformance);
    RootPanel.get().add(testSetPerformance);
    RootPanel.get().add(table);
  }
Ejemplo n.º 17
0
 private void showList(String json) {
   JSONValue v = JSONParser.parseStrict(json);
   System.out.println("BlackList showList , json = " + json);
   JSONObject jo = v.isObject();
   page = (int) jo.get("page").isNumber().doubleValue();
   size = (int) jo.get("size").isNumber().doubleValue();
   JSONArray array = jo.get("list").isArray();
   ListDataProvider<BlackListRowData> provider = new ListDataProvider<BlackListRowData>();
   provider.addDataDisplay(cellTable);
   List<BlackListRowData> list = provider.getList();
   for (int i = 0; i < array.size(); i++) {
     JSONObject obj = array.get(i).isObject();
     int monetId = (int) obj.get("monetId").isNumber().doubleValue();
     String reason = obj.get("reason").isString().stringValue();
     String expire = obj.get("expire").isString().stringValue();
     BlackListRowData data = new BlackListRowData();
     data.setMonetId(monetId);
     data.setReason(reason);
     data.setExpire(expire);
     list.add(data);
   }
 }
Ejemplo n.º 18
0
  @SuppressWarnings("ParameterHidesMemberVariable")
  public void populate(List<ValueMapEntry> valueMapEntries, @Nullable List<String> valueChoices) {
    this.valueMapEntries = valueMapEntries;
    this.valueChoices = valueChoices;
    //noinspection ConstantConditions
    if (hasValueChoices() && !valueChoices.contains("")) {
      valueChoices.add(0, "");
    }

    if (dataProvider == null) {
      initializeTable();
      dataProvider = new ListDataProvider<ValueMapEntry>(valueMapEntries);
      dataProvider.addDataDisplay(table);
    } else {
      dataProvider.setList(valueMapEntries);
    }
    pager.setVisible(valueMapEntries.size() > pager.getPageSize());
    dataProvider.refresh();

    // remove loading
    remove(loading);
    // addStyleName("value-map");
  }
Ejemplo n.º 19
0
  private void createDataGrid() {
    dataGrid = new DataGrid<InputItem>(1024 * 1024, ZicoDataGridResources.INSTANCE, KEY_PROVIDER);
    selectionModel = new SingleSelectionModel<InputItem>(KEY_PROVIDER);
    dataGrid.setSelectionModel(selectionModel);

    recordStore = new ListDataProvider<InputItem>(KEY_PROVIDER);
    recordStore.addDataDisplay(dataGrid);

    sortHandler = new ColumnSortEvent.ListHandler<InputItem>(recordStore.getList());

    Column<InputItem, InputItem> colId = new IdentityColumn<InputItem>(ID_CELL);
    dataGrid.addColumn(colId, new ResizableHeader<InputItem>("#", dataGrid, colId));
    dataGrid.setColumnWidth(colId, 35, Style.Unit.PX);

    final EditTextCell cellName = new EditTextCell();
    Column<InputItem, String> colName =
        new Column<InputItem, String>(cellName) {
          @Override
          public String getValue(InputItem rec) {
            return rec.getName();
          }
        };
    colName.setFieldUpdater(
        new FieldUpdater<InputItem, String>() {
          @Override
          public void update(int index, InputItem rec, String value) {
            if (!value.equals(rec.getName())) {
              markChange(rec);
              rec.setName(value);
              cellName.clearViewData(rec.getId());
            }
          }
        });
    dataGrid.addColumn(colName, new ResizableHeader<InputItem>("Name", dataGrid, colName));
    dataGrid.setColumnWidth(colName, 128, Style.Unit.PX);

    colName.setSortable(true);
    sortHandler.setComparator(
        colName,
        new Comparator<InputItem>() {
          @Override
          public int compare(InputItem o1, InputItem o2) {
            return o1.getName().compareTo(o2.getName());
          }
        });

    //        final SelectCell<String,Integer> cellActive = new SelectCell<String,Integer>(
    //                ZicoWidgets.<String,Integer>map("NO",0,"YES",1));
    //        Column<InputItem,Integer> colActive = new Column<InputItem, Integer>(cellActive) {
    //            @Override
    //            public Integer getValue(InputItem rec) {
    //                return rec.getActive();
    //            }
    //        };
    //        colActive.setFieldUpdater(new FieldUpdater<InputItem, Integer>() {
    //            @Override
    //            public void update(int index, InputItem rec, Integer value) {
    //                if (rec.getActive() != value) {
    //                    markChange(rec);
    //                    rec.setActive(value);
    //                    cellActive.clearViewData(rec.getId());
    //                }
    //            }
    //        });
    //        dataGrid.addColumn(colActive, new ResizableHeader<InputItem>("Active", dataGrid,
    // colActive));
    //        dataGrid.setColumnWidth(colActive, 128, Style.Unit.PX);

    //        final DatePickerCell cellTstart = new DatePickerCell(ClientUtil.TSTAMP_FORMAT0);
    //        Column<InputItem,Date> colTstart = new Column<InputItem, Date>(cellTstart) {
    //            @Override
    //            public Date getValue(InputItem rec) {
    //                return ClientUtil.unix2date(rec.getTstart());
    //            }
    //        };
    //        colTstart.setFieldUpdater(new FieldUpdater<InputItem, Date>() {
    //            @Override
    //            public void update(int index, InputItem rec, Date value) {
    //                long t = ClientUtil.date2unix(value);
    //                if (t != rec.getTstart()) {
    //                    markChange(rec);
    //                    rec.setTstart(t);
    //                    cellTstart.clearViewData(rec.getId());
    //                }
    //            }
    //        });
    //        colTstart.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    //        dataGrid.addColumn(colTstart, new ResizableHeader<InputItem>("TStart", dataGrid,
    // colTstart));
    //        dataGrid.setColumnWidth(colTstart, 100, Style.Unit.PX);

    //        final DatePickerCell cellTstop = new DatePickerCell(ClientUtil.TSTAMP_FORMAT0);
    //        Column<InputItem,Date> colTstop = new Column<InputItem, Date>(cellTstop) {
    //            @Override
    //            public Date getValue(InputItem rec) {
    //                return ClientUtil.unix2date(rec.getTstop());
    //            }
    //        };
    //        colTstop.setFieldUpdater(new FieldUpdater<InputItem, Date>() {
    //            @Override
    //            public void update(int index, InputItem rec, Date value) {
    //                long t = ClientUtil.date2unix(value);
    //                if (t != rec.getTstop()) {
    //                    markChange(rec);
    //                    rec.setTstop(t);
    //                    cellTstop.clearViewData(rec.getId());
    //                }
    //            }
    //        });
    //        colTstop.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    //        dataGrid.addColumn(colTstop, new ResizableHeader<InputItem>("TStop", dataGrid,
    // colTstop));
    //        dataGrid.setColumnWidth(colTstop, 100, Style.Unit.PX);

    Column<InputItem, Integer> colInput =
        new Column<InputItem, Integer>(cellInput) {
          @Override
          public Integer getValue(InputItem iitem) {
            return iitem.getInputId();
          }
        };
    colInput.setFieldUpdater(
        new FieldUpdater<InputItem, Integer>() {
          @Override
          public void update(int index, InputItem rec, Integer value) {
            if (rec.getInputId() != value) {
              markChange(rec);
              rec.setInputId(value);
              cellInput.clearViewData(rec.getId());
            }
          }
        });
    dataGrid.addColumn(colInput, new ResizableHeader<InputItem>("Input", dataGrid, colInput));
    dataGrid.setColumnWidth(colInput, 128, Style.Unit.PX);

    Column<InputItem, Integer> colTxForm =
        new Column<InputItem, Integer>(cellTxForm) {
          @Override
          public Integer getValue(InputItem rec) {
            return rec.getTxFormid();
          }
        };
    colTxForm.setFieldUpdater(
        new FieldUpdater<InputItem, Integer>() {
          @Override
          public void update(int index, InputItem iitem, Integer value) {
            if (iitem.getTxFormid() != value) {
              markChange(iitem);
              iitem.setTxFormid(value);
              cellTxForm.clearViewData(iitem.getId());
            }
          }
        });
    dataGrid.addColumn(colTxForm, new ResizableHeader<InputItem>("TxForm", dataGrid, colTxForm));
    dataGrid.setColumnWidth(colTxForm, 128, Style.Unit.PX);

    final EditTextCell cellComment = new EditTextCell();
    Column<InputItem, String> colComment =
        new Column<InputItem, String>(cellComment) {
          @Override
          public String getValue(InputItem rec) {
            return rec.getComment();
          }
        };
    colComment.setFieldUpdater(
        new FieldUpdater<InputItem, String>() {
          @Override
          public void update(int index, InputItem rec, String value) {
            if (!value.equals(rec.getComment())) {
              markChange(rec);
              rec.setComment(value);
              cellComment.clearViewData(rec.getId());
            }
          }
        });
    dataGrid.addColumn(colComment, new ResizableHeader<InputItem>("Comment", dataGrid, colComment));

    colComment.setSortable(true);
    sortHandler.setComparator(
        colComment,
        new Comparator<InputItem>() {
          @Override
          public int compare(InputItem o1, InputItem o2) {
            return o1.getComment().compareTo(o2.getComment());
          }
        });

    dataGrid.addCellPreviewHandler(
        new CellPreviewEvent.Handler<InputItem>() {
          @Override
          public void onCellPreview(CellPreviewEvent<InputItem> event) {
            NativeEvent nev = event.getNativeEvent();
            String eventType = nev.getType();
            if (BrowserEvents.CONTEXTMENU.equals(eventType)) {
              selectionModel.setSelected(event.getValue(), true);
              if (event.getValue() != null) {
                contextMenu.setPopupPosition(
                    event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY());
                contextMenu.show();
              }
            }
          }
        });

    dataGrid.setKeyboardSelectionPolicy(
        HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);
    dataGrid.addDomHandler(
        new DoubleClickHandler() {
          @Override
          public void onDoubleClick(DoubleClickEvent event) {
            event.preventDefault();
          }
        },
        DoubleClickEvent.getType());
    dataGrid.addDomHandler(
        new ContextMenuHandler() {
          @Override
          public void onContextMenu(ContextMenuEvent event) {
            event.preventDefault();
          }
        },
        ContextMenuEvent.getType());
  }
  /**
   * Returns table with publications
   *
   * @return table
   */
  public CellTable<Publication> getEmptyTable() {

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

    // Cell table
    table = new PerunTable<Publication>(list);
    table.removeRowCountChangeHandler();
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

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

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

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

    // set empty content & loader
    table.setEmptyTableWidget(
        loaderImage.prepareToSearch(
            "Please select external pub. system and year range to search for publications for import."));

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

    /*
    // CATEGORY COLUMN
    ArrayList<String> categories = new ArrayList<String>();
    categories.add("Bodované v RIVu");
    categories.add("Nebodované v RIVu");
    categories.add("Příspěvek do ročenky");
    categories.add("Výjimečné výsledky");
    categories.add("Jiné");

    Column<Publication, String> categoryColumn = new Column<Publication, String>(new SelectionCell(categories)){
    	@Override
    	public String getValue(Publication object) {
    		// category ID as string, 0 if not set
    		int id = object.getCategoryId();
    		if (id == 0) {
    			// set default == 21/Bodované v RIVu to object
    			object.setCategoryId(21);
    		}
    		if (id == 21) {
    			return "Bodované v RIVu";
    		} else if (id == 22) {
    			return "Nebodované v RIVu";
    		} else if (id == 23) {
    			return "Výjimečné výsledky";
    		} else if (id == 24) {
    			return "Příspěvek do ročenky";
    		} else if (id == 25) {
    			return "Jiné";
    		} else {
    			return String.valueOf(id); // return ID if no match
    		}
    	}
    };
    categoryColumn.setFieldUpdater(new FieldUpdater<Publication, String>() {
    	public void update(int index, Publication object, String value) {

    		int id = 0;
    		if (value.equalsIgnoreCase("Bodované v RIVu")) {
    			id = 21;
    		} else if (value.equalsIgnoreCase("Nebodované v RIVu")) {
    			id = 22;
    		} else if (value.equalsIgnoreCase("Příspěvek do ročenky")) {
    			id = 24;
    		} else if (value.equalsIgnoreCase("Výjimečné výsledky")) {
    			id = 23;
    		} else if (value.equalsIgnoreCase("Jiné")) {
    			id = 25;
    		}
    		object.setCategoryId(id);
    		selectionModel.setSelected(object, true);

    	}
    });
    table.addColumn(categoryColumn, "Category");

    // NOT USEFULL => DISABLED
    // EXTERNAL ID
    TextColumn<Publication> externalIdColumn = new TextColumn<Publication>() {
    	public String getValue(Publication object) {
    		return String.valueOf(object.getExternalId());
    	};
    };
    externalIdColumn.setSortable(true);
    columnSortHandler.setComparator(externalIdColumn, new PublicationComparator(PublicationComparator.Column.EXTERNAL_ID));
    table.addColumn(externalIdColumn, "External Id");
     */

    // TITLE COLUMN
    TextColumn<Publication> titleColumn =
        new TextColumn<Publication>() {
          public String getValue(Publication object) {
            return object.getTitle();
          };
        };
    titleColumn.setSortable(true);
    columnSortHandler.setComparator(
        titleColumn, new PublicationComparator(PublicationComparator.Column.TITLE));
    table.addColumn(titleColumn, "Title");

    // AUTHORS COLUMN
    TextColumn<Publication> authorColumn =
        new TextColumn<Publication>() {
          public String getValue(Publication object) {
            return object.getAuthorsFormatted();
          };
        };
    authorColumn.setSortable(true);
    columnSortHandler.setComparator(
        authorColumn, new PublicationComparator(PublicationComparator.Column.AUTHORS));
    table.addColumn(authorColumn, "Authors");

    // YEAR COLUMN
    TextColumn<Publication> yearColumn =
        new TextColumn<Publication>() {
          public String getValue(Publication object) {
            return String.valueOf(object.getYear());
          };
        };
    yearColumn.setSortable(true);
    columnSortHandler.setComparator(
        yearColumn, new PublicationComparator(PublicationComparator.Column.YEAR));
    table.addColumn(yearColumn, "Year");

    // ISBN COLUMN
    TextColumn<Publication> isbnColumn =
        new TextColumn<Publication>() {
          public String getValue(Publication object) {
            return object.getIsbn();
          };
        };
    isbnColumn.setSortable(true);
    columnSortHandler.setComparator(
        isbnColumn, new PublicationComparator(PublicationComparator.Column.ISBN));
    table.addColumn(isbnColumn, "ISBN");

    // CITE COLUMN
    Column<Publication, String> citaceColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<Publication, String>() {
              public String getValue(Publication object) {
                return "Cite";
              }
            },
            new FieldUpdater<Publication, String>() {
              public void update(int index, Publication object, String value) {
                SimplePanel sp = new SimplePanel();
                sp.add(new HTML(object.getMain()));
                Confirm cf = new Confirm("Cite publication", sp, true);
                cf.show();
              };
            });

    table.addColumn(citaceColumn, "Cite");

    return table;
  }
Ejemplo n.º 21
0
  /**
   * The table that holds the basic friends list.
   *
   * @param result
   */
  private void setTable(GetLogResult result) {
    if (cellTable.getColumnCount() == 4) {
      dataList.clear();
      dataList = dataProvider.getList();
      for (GetLogType friend : result.getResults()) dataList.add(friend);
    } else {
      TextColumn<GetLogType> victimColumn =
          new TextColumn<GetLogType>() {
            @Override
            public String getValue(GetLogType log) {
              if (log.getFbVictimName() != null) return log.getFbVictimName();
              else return "";
            }
          };
      victimColumn.setSortable(true);

      TextColumn<GetLogType> commentPermalink =
          new TextColumn<GetLogType>() {
            @Override
            public String getValue(GetLogType log) {
              if (log.getFbCommentPermalink() != null) return log.getFbCommentPermalink();
              else return "";
            }
          };
      commentPermalink.setSortable(true);

      TextColumn<GetLogType> comment =
          new TextColumn<GetLogType>() {
            @Override
            public String getValue(GetLogType log) {
              if (log.getFbComment() != null) return log.getFbComment();
              else return "";
            }
          };
      comment.setSortable(true);

      TextColumn<GetLogType> date =
          new TextColumn<GetLogType>() {
            @Override
            public String getValue(GetLogType log) {
              if (log.getDate() != null) return log.getDate().toString();
              else return "";
            }
          };
      date.setSortable(true);

      cellTable.addColumn(victimColumn, "Name");
      cellTable.addColumn(commentPermalink, "Comment Link");
      cellTable.addColumn(comment, "Comment Text");
      cellTable.addColumn(date, "Time");

      // Fix column sizes for stupid facebook
      cellTable.setWidth("675px", true);
      cellTable.setColumnWidth(victimColumn, 10.0, Unit.PCT);
      cellTable.setColumnWidth(commentPermalink, 40.0, Unit.PCT);
      cellTable.setColumnWidth(comment, 40.0, Unit.PCT);
      cellTable.setColumnWidth(date, 10.0, Unit.PCT);

      // Attach provider
      dataProvider.addDataDisplay(cellTable);
      dataList = dataProvider.getList();
      for (GetLogType friend : result.getResults()) dataList.add(friend);

      // Set row count
      cellTable.setRowCount(dataList.size());
      cellTable.setPageSize(20);

      ListHandler<GetLogType> columnSortHandler = new ListHandler<GetLogType>(dataList);
      columnSortHandler.setComparator(
          victimColumn,
          new Comparator<GetLogType>() {

            @Override
            public int compare(GetLogType o1, GetLogType o2) {
              if (o1 == o2) {
                return 0;
              }

              // Compare the name columns.
              if (o1 != null) {
                return (o2 != null) ? o1.getFbVictimName().compareTo(o2.getFbVictimName()) : 1;
              }
              return -1;
            }
          });

      columnSortHandler.setComparator(
          commentPermalink,
          new Comparator<GetLogType>() {

            @Override
            public int compare(GetLogType o1, GetLogType o2) {
              if (o1 == o2) {
                return 0;
              }

              // Compare the role columns.
              if (o1 != null) {
                return (o2 != null)
                    ? o1.getFbCommentPermalink().compareTo(o2.getFbCommentPermalink())
                    : 1;
              }
              return -1;
            }
          });

      columnSortHandler.setComparator(
          comment,
          new Comparator<GetLogType>() {
            @Override
            public int compare(GetLogType o1, GetLogType o2) {
              if (o1 == o2) {
                return 0;
              }

              // Compare the role columns.
              if (o1 != null) {
                return (o2 != null) ? o1.getFbComment().compareTo(o2.getFbComment()) : 1;
              }
              return -1;
            }
          });

      columnSortHandler.setComparator(
          date,
          new Comparator<GetLogType>() {

            @Override
            public int compare(GetLogType o1, GetLogType o2) {
              if (o1 == o2) {
                return 0;
              }

              // Compare the role columns.
              if (o1 != null) {
                return (o2 != null) ? o1.getDate().compareTo(o2.getDate()) : 1;
              }
              return -1;
            }
          });

      cellTable.addColumnSortHandler(columnSortHandler);
      cellTable.getColumnSortList().push(date);
      cellTable.setPageSize(5000);
    }
  }
Ejemplo n.º 22
0
  public void setup() {
    // BZ-996917: Use a the gwtboostrap style "row-fluid" to allow display some events in the same
    // row.
    eventTypes.setStyleName(Styles.ROW);

    // Fill panel with available events.
    for (Map.Entry<String, Boolean> e :
        auditLog.getAuditLogFilter().getAcceptedTypes().entrySet()) {
      eventTypes.add(makeEventTypeCheckBox(e.getKey(), e.getValue()));
    }

    // Create the GWT Cell Table as events container.
    // BZ-996942: Set custom width and table css style.
    events = new CellTable<AuditLogEntry>();
    events.setWidth("100%");
    events.addStyleName(Styles.TABLE);

    final ListDataProvider<AuditLogEntry> dlp =
        new ListDataProvider<AuditLogEntry>(filterDeletedEntries(auditLog));
    dlp.addDataDisplay(events);

    AuditLogEntrySummaryColumn summaryColumn =
        new AuditLogEntrySummaryColumn(style.auditLogDetailLabel(), style.auditLogDetailValue());
    AuditLogEntryCommentColumn commentColumn = new AuditLogEntryCommentColumn();

    events.addColumn(summaryColumn);
    events.addColumn(commentColumn);

    events.setColumnWidth(summaryColumn, 60.0, Unit.PCT);
    events.setColumnWidth(commentColumn, 40.0, Unit.PCT);

    // If the current user is not an Administrator include the delete comment column
    if (identity.getRoles().contains(new RoleImpl(AppRoles.ADMIN.getName()))) {

      AuditLogEntryDeleteCommentColumn deleteCommentColumn = new AuditLogEntryDeleteCommentColumn();
      deleteCommentColumn.setFieldUpdater(
          new FieldUpdater<AuditLogEntry, SafeHtml>() {

            public void update(int index, AuditLogEntry row, SafeHtml value) {
              row.setDeleted(true);
              dlp.setList(filterDeletedEntries(auditLog));
              dlp.refresh();
            }
          });
      events.addColumn(deleteCommentColumn);
      events.setColumnWidth(commentColumn, 35.0, Unit.PCT);
      events.setColumnWidth(deleteCommentColumn, 5.0, Unit.PCT);
    }

    events.setEmptyTableWidget(
        new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogNoEntries()));
    events.setKeyboardPagingPolicy(KeyboardPagingPolicy.CHANGE_PAGE);
    events.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    events.setPageSize(PAGE_SIZE);

    // Configure the simple pager.
    pager.setDisplay(events);
    pager.setPageSize(PAGE_SIZE);

    events.addRangeChangeHandler(
        new RangeChangeEvent.Handler() {
          @Override
          public void onRangeChange(final RangeChangeEvent event) {
            cellTablePagination.rebuild(pager);
          }
        });

    cellTablePagination.rebuild(pager);

    // Add the table to the container.
    eventsContainer.add(events);
  }
Ejemplo n.º 23
0
  Widget asWidget() {

    breadcrumb = new HorizontalPanel();

    VerticalPanel panel = new VerticalPanel();
    panel.setStyleName("fill-layout-width");
    panel.getElement().setAttribute("style", "padding:10px");

    // ----

    fileSystem = new DefaultCellTable<Entry>(30);

    fileSystemProvider = new ListDataProvider<Entry>();
    fileSystemProvider.addDataDisplay(fileSystem);

    TextColumn<Entry> entryCol =
        new TextColumn<Entry>() {
          @Override
          public String getValue(Entry entry) {
            return entry.getName();
          }
        };

    fileSystem.addColumn(entryCol);
    fileSystem.getElement().setAttribute("style", "margin-bottom:10px;");

    panel.add(breadcrumb);
    panel.add(fileSystem);

    // --
    Button visualize =
        new NavButton(
            "Visualize",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onVisualize();
              }
            });
    panel.add(visualize);

    Button reify =
        new NavButton(
            "Reify",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                Entry dialog = fsSelection.getSelectedObject();
                presenter.onReify(dialog.getName());
              }
            });
    panel.add(reify);

    Button activate =
        new NavButton(
            "Activate",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onActivate();
              }
            });
    panel.add(activate);

    Button reset =
        new NavButton(
            "Reset",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onResetDialog();
              }
            });
    panel.add(reset);

    Button passivate =
        new NavButton(
            "Passivate",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                presenter.onPassivate();
              }
            });
    panel.add(passivate);

    CheckBox cacheDisabled = new CheckBox("Disable Cache");
    cacheDisabled.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            presenter.setDisableCache(event.getValue());
          }
        });
    cacheDisabled.setValue(true);
    panel.add(cacheDisabled);

    // ----

    fsSelection = new SingleSelectionModel<Entry>();
    fileSystem.setSelectionModel(fsSelection);

    fsSelection.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            Entry selection = fsSelection.getSelectedObject();
            if (selection != null) {
              if (Entry.Type.DIR == selection.getType()) {
                // directories
                Entry dir = history.peek();
                presenter.loadDir(
                    new Entry(dir.getName() + selection.getName(), Entry.Type.DIR), false);
              } else {
                // files
                presenter.loadFile(selection);
              }
            }
          }
        });

    return panel;
  }
Ejemplo n.º 24
0
  public DataObjectBrowser() {
    initWidget(uiBinder.createAndBindUi(this));

    objectButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            selectCurrentObject(true);
          }
        });

    dataObjectPropertiesProvider.setList(new ArrayList<ObjectProperty>());

    // Init data objects table

    dataObjectPropertiesTable.setEmptyTableWidget(
        new Label(Constants.INSTANCE.objectBrowser_emptyTable()));

    // Init property name column

    final TextColumn<ObjectProperty> propertyNameColumn =
        new TextColumn<ObjectProperty>() {

          @Override
          public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) {
            SafeHtml startDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "<div style=\"cursor: pointer;\">";
                  }
                };
            SafeHtml endDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "</div>";
                  }
                };

            sb.append(startDiv);
            super.render(context, object, sb);
            sb.append(endDiv);
          }

          @Override
          public String getValue(final ObjectProperty objectProperty) {
            return objectProperty.getName();
          }
        };

    propertyNameColumn.setSortable(true);
    dataObjectPropertiesTable.addColumn(
        propertyNameColumn, Constants.INSTANCE.objectBrowser_columnName());
    // dataObjectPropertiesTable.setColumnWidth(propertyNameColumn, 100, Style.Unit.PX);
    dataObjectPropertiesTable.setColumnWidth(propertyNameColumn, 30, Style.Unit.PCT);

    ColumnSortEvent.ListHandler<ObjectProperty> propertyNameColHandler =
        new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList());
    propertyNameColHandler.setComparator(propertyNameColumn, new ObjectPropertyComparator("name"));
    dataObjectPropertiesTable.addColumnSortHandler(propertyNameColHandler);

    // Init property Label column

    final TextColumn<ObjectProperty> propertyLabelColumn =
        new TextColumn<ObjectProperty>() {

          @Override
          public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) {
            SafeHtml startDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "<div style=\"cursor: pointer;\">";
                  }
                };
            SafeHtml endDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "</div>";
                  }
                };

            sb.append(startDiv);
            super.render(context, object, sb);
            sb.append(endDiv);
          }

          @Override
          public String getValue(final ObjectProperty objectProperty) {
            return AnnotationValueHandler.getStringValue(
                objectProperty,
                MainDomainAnnotations.LABEL_ANNOTATION,
                MainDomainAnnotations.VALUE_PARAM);
          }
        };

    propertyLabelColumn.setSortable(true);
    dataObjectPropertiesTable.addColumn(
        propertyLabelColumn, Constants.INSTANCE.objectBrowser_columnLabel());
    dataObjectPropertiesTable.setColumnWidth(propertyLabelColumn, 30, Style.Unit.PCT);

    ColumnSortEvent.ListHandler<ObjectProperty> propertyLabelColHandler =
        new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList());
    propertyNameColHandler.setComparator(
        propertyLabelColumn, new ObjectPropertyComparator("label"));
    dataObjectPropertiesTable.addColumnSortHandler(propertyLabelColHandler);

    // Init property type browsing column
    ClickableImageResourceCell typeImageCell = new ClickableImageResourceCell(true, 25);
    //        final TooltipCellDecorator<ImageResource> typeImageDecorator = new
    // TooltipCellDecorator<ImageResource>( typeImageCell );
    //        typeImageDecorator.setText(
    // Constants.INSTANCE.objectBrowser_action_goToDataObjectDefinition() );

    final Column<ObjectProperty, ImageResource> typeImageColumn =
        new Column<ObjectProperty, ImageResource>(typeImageCell) {
          @Override
          public ImageResource getValue(final ObjectProperty property) {

            if (!property.isBaseType()
                && !getDataObject().getClassName().equals(property.getClassName())
                && !getDataModel().isExternal(property.getClassName())) {
              return ImagesResources.INSTANCE.BrowseObject();
            } else {
              return null;
            }
          }
        };

    typeImageColumn.setFieldUpdater(
        new FieldUpdater<ObjectProperty, ImageResource>() {
          public void update(
              final int index, final ObjectProperty property, final ImageResource value) {

            onTypeCellSelection(property);
          }
        });

    dataObjectPropertiesTable.addColumn(typeImageColumn);

    // Init property type column
    final TextColumn<ObjectProperty> propertyTypeColumn =
        new TextColumn<ObjectProperty>() {

          @Override
          public void render(Cell.Context context, ObjectProperty object, SafeHtmlBuilder sb) {
            SafeHtml startDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "<div style=\"cursor: pointer;\">";
                  }
                };
            SafeHtml endDiv =
                new SafeHtml() {
                  @Override
                  public String asString() {
                    return "</div>";
                  }
                };

            sb.append(startDiv);
            super.render(context, object, sb);
            sb.append(endDiv);
          }

          @Override
          public String getValue(final ObjectProperty objectProperty) {
            return propertyTypeDisplay(objectProperty);
          }
        };
    propertyTypeColumn.setSortable(true);
    dataObjectPropertiesTable.addColumn(
        propertyTypeColumn, Constants.INSTANCE.objectBrowser_columnType());
    dataObjectPropertiesTable.setColumnWidth(propertyTypeColumn, 40, Style.Unit.PCT);

    // Init delete column
    final Column<ObjectProperty, String> deletePropertyColumnImg =
        new Column<ObjectProperty, String>(deleteCell) {
          @Override
          public String getValue(final ObjectProperty global) {
            return "Remove";
          }
        };

    deletePropertyColumnImg.setFieldUpdater(
        new FieldUpdater<ObjectProperty, String>() {
          public void update(final int index, final ObjectProperty property, final String value) {
            if (!isReadonly()) {
              checkAndDeleteDataObjectProperty(property, index);
            }
          }
        });

    dataObjectPropertiesTable.addColumn(deletePropertyColumnImg);

    ColumnSortEvent.ListHandler<ObjectProperty> propertyTypeColHandler =
        new ColumnSortEvent.ListHandler<ObjectProperty>(dataObjectPropertiesProvider.getList());
    propertyTypeColHandler.setComparator(
        propertyTypeColumn, new ObjectPropertyComparator("className"));
    dataObjectPropertiesTable.addColumnSortHandler(propertyTypeColHandler);

    dataObjectPropertiesTable.getColumnSortList().push(propertyNameColumn);

    // Init the selection model
    SingleSelectionModel<ObjectProperty> selectionModel =
        new SingleSelectionModel<ObjectProperty>();
    dataObjectPropertiesTable.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {

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

    dataObjectPropertiesTable.setKeyboardSelectionPolicy(
        HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.BOUND_TO_SELECTION);

    dataObjectPropertiesTable.addCellPreviewHandler(
        new CellPreviewEvent.Handler<ObjectProperty>() {

          @Override
          public void onCellPreview(CellPreviewEvent<ObjectProperty> event) {
            if (showingObject && "click".equals(event.getNativeEvent().getType())) {
              int selectedRow = dataObjectPropertiesTable.getKeyboardSelectedRow();
              if (lastSelectedRow >= 0 && lastSelectedRow == selectedRow) {
                ObjectProperty selectedProperty =
                    dataObjectPropertiesProvider.getList().get(selectedRow);
                ((SingleSelectionModel<ObjectProperty>)
                        dataObjectPropertiesTable.getSelectionModel())
                    .setSelected(selectedProperty, true);
              }
              showingObject = false;
            }
          }
        });

    dataObjectPropertiesProvider.addDataDisplay(dataObjectPropertiesTable);
    dataObjectPropertiesProvider.refresh();

    newPropertyButton.setIcon(IconType.PLUS);

    setReadonly(true);
  }
Ejemplo n.º 25
0
  // ------------------------------------------------------------------------
  //  CREATION OF ANNOTATIONS OF VARIOUS KIND
  // ------------------------------------------------------------------------
  public ComponentsPanel(IDomeo domeo, PluginsViewerPanel parent) {
    _domeo = domeo;
    _parent = parent;
    // _resources = resources;
    // _listPanel = new LogListPanel(_application);

    // Create layout
    initWidget(binder.createAndBindUi(this));
    this.setWidth((Window.getClientWidth() - 140) + "px");

    // Create a CellTable.
    final CellTable<PluginCard> table = new CellTable<PluginCard>();

    // Create name column.
    TextColumn<PluginCard> nameColumn =
        new TextColumn<PluginCard>() {
          @Override
          public String getValue(PluginCard pluginCard) {
            return pluginCard.name;
          }
        };

    // Make the name column sortable.
    nameColumn.setSortable(true);

    // Create type column.
    TextColumn<PluginCard> typeColumn =
        new TextColumn<PluginCard>() {
          @Override
          public String getValue(PluginCard pluginCard) {
            return pluginCard.type;
          }
        };
    typeColumn.setSortable(true);

    // Create sub type column.
    TextColumn<PluginCard> subTypeColumn =
        new TextColumn<PluginCard>() {
          @Override
          public String getValue(PluginCard pluginCard) {
            return pluginCard.subType;
          }
        };

    // Create sub type column.
    TextColumn<PluginCard> versionColumn =
        new TextColumn<PluginCard>() {
          @Override
          public String getValue(PluginCard pluginCard) {
            return pluginCard.version;
          }
        };

    // Add the columns.
    table.addColumn(typeColumn, "Type");
    table.addColumn(subTypeColumn, "Sub Type");
    table.addColumn(nameColumn, "Name");
    table.addColumn(versionColumn, "Version");

    // Create a data provider.
    ListDataProvider<PluginCard> dataProvider = new ListDataProvider<PluginCard>();

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

    // Add the data to the data provider, which automatically pushes it to the
    // widget.
    List<PluginCard> list = dataProvider.getList();
    for (APlugin plugin : _domeo.getPluginsManager().getPluginsList()) {
      if (plugin.getMandatory()) {
        PluginCard pluginCard =
            new PluginCard(
                plugin.getPluginName(),
                plugin.getType(),
                plugin.getSubType(),
                plugin.getVersion(),
                true,
                true);
        list.add(pluginCard);
      }
    }

    ListHandler<PluginCard> nameColumnSortHandler = new ListHandler<PluginCard>(list);
    nameColumnSortHandler.setComparator(
        nameColumn,
        new Comparator<PluginCard>() {
          public int compare(PluginCard o1, PluginCard o2) {
            if (o1 == o2) {
              return 0;
            }

            // Compare the name columns.
            if (o1 != null) {
              return (o2 != null) ? o1.name.compareTo(o2.name) : 1;
            }
            return -1;
          }
        });
    table.addColumnSortHandler(nameColumnSortHandler);

    ListHandler<PluginCard> typeColumnSortHandler = new ListHandler<PluginCard>(list);
    typeColumnSortHandler.setComparator(
        typeColumn,
        new Comparator<PluginCard>() {
          public int compare(PluginCard o1, PluginCard o2) {
            if (o1 == o2) {
              return 0;
            }

            // Compare the name columns.
            if (o1 != null) {
              return (o2 != null) ? o1.type.compareTo(o2.type) : 1;
            }
            return -1;
          }
        });
    table.addColumnSortHandler(typeColumnSortHandler);

    componentsPanel.add(table);
  }
Ejemplo n.º 26
0
  @Override
  public Widget createWidget() {

    ProvidesKey<DeploymentRecord> key =
        new ProvidesKey<DeploymentRecord>() {
          @Override
          public Object getKey(DeploymentRecord deploymentRecord) {
            return deploymentRecord.getName();
          }
        };
    deploymentTable = new DefaultCellTable<DeploymentRecord>(8, key);
    final SingleSelectionModel<DeploymentRecord> selectionModel =
        new SingleSelectionModel<DeploymentRecord>();
    deploymentTable.setSelectionModel(selectionModel);

    dataProvider = new ListDataProvider<DeploymentRecord>(key);
    dataProvider.addDataDisplay(deploymentTable);

    // ---

    final ToolStrip toolStrip = new ToolStrip();
    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewDeploymentDialoge(null, false);
              }
            });
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_deploymentListView());
    toolStrip.addToolButtonRight(addBtn);

    toolStrip.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_remove(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter,
                          DeploymentCommand.REMOVE_FROM_STANDALONE)
                      .execute(selection);
                }
              }
            }));

    toolStrip.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_enOrDisable(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter, DeploymentCommand.ENABLE_DISABLE)
                      .execute(selection);
                }
              }
            }));

    toolStrip.addToolButtonRight(
        new ToolButton(
            "Update",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent clickEvent) {
                DeploymentRecord selection = selectionModel.getSelectedObject();
                if (selection != null) {
                  new DeploymentCommandDelegate(
                          DeploymentListView.this.presenter, DeploymentCommand.UPDATE_CONTENT)
                      .execute(selection);
                }
              }
            }));

    filter = new DeploymentFilter(dataProvider);
    toolStrip.addToolWidget(filter.asWidget());

    TitleColumn dplNameColumn = new TitleColumn() {};

    TextColumn<DeploymentRecord> dplRuntimeColumn =
        new TextColumn<DeploymentRecord>() {
          @Override
          public String getValue(DeploymentRecord record) {
            String title = null;
            if (record.getRuntimeName().length() > 27)
              title = record.getRuntimeName().substring(0, 26) + "...";
            else title = record.getRuntimeName();
            return title;
          }
        };

    deploymentTable.addColumn(dplNameColumn, Console.CONSTANTS.common_label_name());
    deploymentTable.addColumn(dplRuntimeColumn, Console.CONSTANTS.common_label_runtimeName());
    deploymentTable.addColumn(makeEnabledColumn(), Console.CONSTANTS.common_label_enabled());

    Form<DeploymentRecord> form = new Form<DeploymentRecord>(DeploymentRecord.class);
    form.setNumColumns(2);
    form.setEnabled(true);
    TextAreaItem name = new TextAreaItem("name", "Name");
    TextAreaItem runtimeName = new TextAreaItem("runtimeName", "Runtime Name");
    // TextBoxItem sha = new TextBoxItem("sha", "SHA");
    form.setFields(name, runtimeName);

    form.bind(deploymentTable);

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setTitle(Console.CONSTANTS.common_label_deployments())
            .setHeadline(Console.CONSTANTS.common_label_deployments())
            .setDescription(
                "Currently deployed application components. Deployments that have been added through the filesystem will not be managable through the web interface.")
            .setMaster(Console.MESSAGES.available("Deployments"), deploymentTable)
            .setMasterTools(toolStrip)
            .setDetail(Console.CONSTANTS.common_label_selection(), form.asWidget());

    return layout.build();
  }
Ejemplo n.º 27
0
  @SuppressWarnings("unchecked")
  Widget asWidget() {
    secTable = new DefaultCellTable<>(8, item -> item.getPattern() + "_" + item.getRole());
    secProvider = new ListDataProvider<>();
    secProvider.addDataDisplay(secTable);

    Column<ActivemqSecurityPattern, String> roleColumn =
        new Column<ActivemqSecurityPattern, String>(new TextCell()) {
          @Override
          public String getValue(ActivemqSecurityPattern object) {
            return object.getRole();
          }
        };

    Column<ActivemqSecurityPattern, String> patternColumn =
        new Column<ActivemqSecurityPattern, String>(new TextCell()) {
          @Override
          public String getValue(ActivemqSecurityPattern object) {
            return object.getPattern();
          }
        };

    secTable.addColumn(patternColumn, "Pattern");
    secTable.addColumn(roleColumn, "Role");

    form = new Form<>(ActivemqSecurityPattern.class);
    form.setNumColumns(2);
    form.bind(secTable);

    CheckBoxItem send = new CheckBoxItem("send", "Send?");
    CheckBoxItem consume = new CheckBoxItem("consume", "Consume?");
    CheckBoxItem manage = new CheckBoxItem("manage", "Manage?");

    CheckBoxItem createDQ = new CheckBoxItem("createDurableQueue", "CreateDurable?");
    CheckBoxItem deleteDQ = new CheckBoxItem("deleteDurableQueue", "DeleteDurable?");

    CheckBoxItem createNDQ = new CheckBoxItem("createNonDurableQueue", "CreateNonDurable?");
    CheckBoxItem deleteNDQ = new CheckBoxItem("deleteNonDurableQueue", "DeleteNonDurable?");

    form.setFields(send, consume, manage);
    form.setFieldsInGroup(
        Console.CONSTANTS.common_label_advanced(),
        new DisclosureGroupRenderer(),
        createDQ,
        deleteDQ,
        createNDQ,
        deleteNDQ);

    FormHelpPanel helpPanel =
        new FormHelpPanel(
            () -> {
              ModelNode address = Baseadress.get();
              address.add("subsystem", "messaging-activemq");
              address.add("server", "*");
              address.add("security-setting", "*");
              address.add("role", "*");
              return address;
            },
            form);

    FormToolStrip<ActivemqSecurityPattern> formTools =
        new FormToolStrip<>(
            form,
            new FormToolStrip.FormCallback<ActivemqSecurityPattern>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSaveSecDetails(form.getEditedEntity(), changeset);
              }

              @Override
              public void onDelete(ActivemqSecurityPattern entity) {}
            });

    ToolStrip tableTools = new ToolStrip();

    ToolButton addBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_add(), event -> presenter.launchNewSecDialogue());
    addBtn.ensureDebugId(Console.DEBUG_CONSTANTS.debug_label_add_securityDetails());
    tableTools.addToolButtonRight(addBtn);

    ToolButton removeBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_delete(),
            event ->
                Feedback.confirm(
                    Console.MESSAGES.deleteTitle("Security Config"),
                    Console.MESSAGES.deleteConfirm("Security Config"),
                    isConfirmed -> {
                      if (isConfirmed) {
                        presenter.onDeleteSecDetails(form.getEditedEntity());
                      }
                    }));

    tableTools.addToolButtonRight(removeBtn);

    VerticalPanel formPanel = new VerticalPanel();
    formPanel.addStyleName("fill-layout-width");

    formPanel.add(helpPanel.asWidget());
    formPanel.add(formTools.asWidget());
    formPanel.add(form.asWidget());

    serverName = new ContentHeaderLabel();

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(serverName)
            .setDescription(
                "A security setting allows sets of permissions to be defined against queues based on their address.")
            .setMaster("Available security settings", secTable)
            .setMasterTools(tableTools.asWidget())
            .setDetail("Details", formPanel);

    return layout.build();
  }
Ejemplo n.º 28
0
  Widget asWidget() {
    ToolStrip topLevelTools = new ToolStrip();
    topLevelTools.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                presenter.launchNewAdminWizard();
              }
            }));

    ClickHandler clickHandler =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {

            final AdminObject selection = getCurrentSelection();

            if (selection != null) {
              Feedback.confirm(
                  Console.MESSAGES.deleteTitle("Admin Object"),
                  Console.MESSAGES.deleteConfirm("Admin Object" + selection.getJndiName()),
                  new Feedback.ConfirmationHandler() {
                    @Override
                    public void onConfirmation(boolean isConfirmed) {
                      if (isConfirmed) {
                        presenter.onRemoveAdmin(selection);
                      }
                    }
                  });
            }
          }
        };

    ToolButton deleteBtn = new ToolButton(Console.CONSTANTS.common_label_delete());
    deleteBtn.addClickHandler(clickHandler);
    topLevelTools.addToolButtonRight(deleteBtn);

    disableBtn =
        new ToolButton(
            Console.CONSTANTS.common_label_disable(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {

                final AdminObject selection = getCurrentSelection();

                if (selection != null) {
                  selection.setEnabled(!selection.isEnabled());

                  Feedback.confirm(
                      Console.MESSAGES.modify("Admin Object"),
                      Console.MESSAGES.modifyConfirm("Admin Object " + selection.getJndiName()),
                      new Feedback.ConfirmationHandler() {
                        @Override
                        public void onConfirmation(boolean isConfirmed) {
                          if (isConfirmed) {
                            presenter.enOrDisbaleAdminObject(currentAdapter, selection);
                          }
                        }
                      });
                }
              }
            });
    topLevelTools.addToolButtonRight(disableBtn);

    // -------

    table =
        new DefaultCellTable<AdminObject>(
            10,
            new ProvidesKey<AdminObject>() {
              @Override
              public Object getKey(AdminObject item) {
                return item.getJndiName();
              }
            });

    dataProvider = new ListDataProvider<AdminObject>();
    dataProvider.addDataDisplay(table);

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

    Column<AdminObject, ImageResource> statusColumn =
        new Column<AdminObject, ImageResource>(new ImageResourceCell()) {
          @Override
          public ImageResource getValue(AdminObject ra) {

            ImageResource res = null;

            if (ra.isEnabled()) res = Icons.INSTANCE.status_good();
            else res = Icons.INSTANCE.status_bad();

            return res;
          }
        };

    table.addColumn(nameColumn, "Name");
    table.addColumn(statusColumn, "Enabled?");

    // ---

    configProperties = new PropertyEditor(this, true);

    // ----

    VerticalPanel formpanel = new VerticalPanel();
    formpanel.setStyleName("fill-layout-width");

    Form<AdminObject> form = new Form<AdminObject>(AdminObject.class);
    form.setNumColumns(2);

    TextItem name = new TextItem("name", "Name");
    TextBoxItem jndiItem = new TextBoxItem("jndiName", "JNDI");
    TextBoxItem classItem = new TextBoxItem("adminClass", "Class Name");
    // CheckBoxItem enabled = new CheckBoxItem("enabled", "Enabled?");

    form.setFields(name, jndiItem, classItem);

    form.setEnabled(false);
    form.bind(table);

    FormToolStrip<AdminObject> tools =
        new FormToolStrip<AdminObject>(
            form,
            new FormToolStrip.FormCallback<AdminObject>() {
              @Override
              public void onSave(Map<String, Object> changeset) {
                presenter.onSaveAdmin(getCurrentSelection(), changeset);
              }

              @Override
              public void onDelete(AdminObject entity) {
                // not possible
              }
            });

    tools.providesDeleteOp(false);

    final FormHelpPanel helpPanel =
        new FormHelpPanel(
            new FormHelpPanel.AddressCallback() {
              @Override
              public ModelNode getAddress() {
                ModelNode address = Baseadress.get();
                address.add("subsystem", "resource-adapters");
                address.add("resource-adapter", "*");
                address.add("admin-objects", "*");
                return address;
              }
            },
            form);

    formpanel.add(tools.asWidget());
    formpanel.add(helpPanel.asWidget());
    formpanel.add(form.asWidget());

    table
        .getSelectionModel()
        .addSelectionChangeHandler(
            new SelectionChangeEvent.Handler() {

              public void onSelectionChange(SelectionChangeEvent event) {
                AdminObject selection = getCurrentSelection();
                configProperties.setProperties("", selection.getProperties());

                String nextState =
                    selection.isEnabled()
                        ? Console.CONSTANTS.common_label_disable()
                        : Console.CONSTANTS.common_label_enable();
                disableBtn.setText(nextState);
              }
            });

    // ----

    headline = new HTML("HEADLINE");
    headline.setStyleName("content-header-label");

    MultipleToOneLayout layout =
        new MultipleToOneLayout()
            .setPlain(true)
            .setHeadlineWidget(headline)
            .setTitle("TITLE")
            .setDescription(Console.CONSTANTS.subsys_jca_adminobject_desc())
            .setMaster(Console.MESSAGES.available("Admin Objects"), table)
            .setMasterTools(topLevelTools.asWidget())
            .addDetail("Attributes", formpanel)
            .addDetail("Properties", configProperties.asWidget());

    configProperties.setAllowEditProps(false);

    return layout.build();
  }
Ejemplo n.º 29
0
  /**
   * Returns empty table widget with attributes
   *
   * @return table widget
   */
  public CellTable<Attribute> getEmptyTable() {

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

    // Cell table
    table = new PerunTable<Attribute>(list);
    table.removeRowCountChangeHandler(); // remove row count change handler

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

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

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

    // set empty content & loader
    table.setEmptyTableWidget(loaderImage);

    // because of tab index
    table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

    // checkbox column
    if (checkable) {

      // checkbox column column
      Column<Attribute, Attribute> checkBoxColumn =
          new Column<Attribute, Attribute>(new PerunCheckboxCell<Attribute>(true, false, false)) {
            @Override
            public Attribute getValue(Attribute object) {
              // Get the value from the selection model.
              GeneralObject go = object.cast();
              go.setChecked(selectionModel.isSelected(object));
              return go.cast();
            }
          };

      // updates the columns size
      table.setColumnWidth(checkBoxColumn, 40.0, Unit.PX);

      // Add the columns

      // Checkbox column header
      CheckboxCell cb = new CheckboxCell();
      Header<Boolean> checkBoxHeader =
          new Header<Boolean>(cb) {
            public Boolean getValue() {
              return false; // return true to see a checked checkbox.
            }
          };
      checkBoxHeader.setUpdater(
          new ValueUpdater<Boolean>() {
            public void update(Boolean value) {
              // sets selected to all, if value = true, unselect otherwise
              for (Attribute obj : list) {
                if (obj.isWritable()) {
                  selectionModel.setSelected(obj, value);
                }
              }
            }
          });

      table.addColumn(checkBoxColumn, checkBoxHeader);
    }

    // Create ID column.
    table.addIdColumn("Attr ID", null, 90);

    // Name column
    Column<Attribute, Attribute> nameColumn = JsonUtils.addColumn(new PerunAttributeNameCell());

    // Value column
    Column<Attribute, Attribute> valueColumn = JsonUtils.addColumn(new PerunAttributeValueCell());
    valueColumn.setFieldUpdater(
        new FieldUpdater<Attribute, Attribute>() {
          public void update(int index, Attribute object, Attribute value) {
            object = value;
            selectionModel.setSelected(object, object.isAttributeValid());
          }
        });

    // Description column
    Column<Attribute, Attribute> descriptionColumn =
        JsonUtils.addColumn(new PerunAttributeDescriptionCell());

    // Sorting name column
    nameColumn.setSortable(true);
    columnSortHandler.setComparator(
        nameColumn, new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_NAME));

    // Sorting description column
    descriptionColumn.setSortable(true);
    columnSortHandler.setComparator(
        descriptionColumn,
        new AttributeComparator<Attribute>(AttributeComparator.Column.TRANSLATED_DESCRIPTION));

    // Add sorting
    this.table.addColumnSortHandler(columnSortHandler);

    // updates the columns size
    this.table.setColumnWidth(nameColumn, 200.0, Unit.PX);

    // Add the columns.
    this.table.addColumn(nameColumn, "Name");
    this.table.addColumn(valueColumn, "Value");
    this.table.addColumn(descriptionColumn, "Description");

    return this.table;
  }
Ejemplo n.º 30
0
  Widget asWidget() {

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("fill-layout-width");

    tools = new ToolStrip();
    tools.addToolButtonRight(
        new ToolButton(
            Console.CONSTANTS.common_label_add(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {

                // onAdd singleton we need to request the specific type to be added

                int i = 1;
                List<Property> addressTuple = currentAddress.asPropertyList();
                final ModelNode addressPrefix = new ModelNode();
                Property denominator = null;
                for (Property tuple : addressTuple) {
                  if (i == addressTuple.size()) {
                    denominator = tuple;
                    break;
                  } else {
                    addressPrefix.add(tuple.getName(), tuple.getValue());
                  }

                  i++;
                }

                final String denominatorType = denominator.getName();
                if (childInformation.isSingleton(denominatorType)) {
                  Set<String> allowedSubResources =
                      childInformation.getSingletons().get(denominatorType) != null
                          ? new HashSet<String>(
                              childInformation.getSingletons().get(denominatorType))
                          : new HashSet<String>();

                  // filter existing resources
                  for (ModelNode existing : dataProvider.getList()) {
                    allowedSubResources.remove(existing.asString());
                  }

                  if (allowedSubResources.size() > 0) {
                    SingletonDialog dialog =
                        new SingletonDialog(
                            allowedSubResources,
                            new SimpleCallback<String>() {

                              @Override
                              public void onSuccess(String result) {

                                addressPrefix.add(denominatorType, result);
                                presenter.onPrepareAddChildResource(addressPrefix, true);
                              }
                            });
                    dialog.setWidth(320);
                    dialog.setHeight(240);
                    dialog.center();
                  } else {
                    Feedback.alert(
                        Console.CONSTANTS.availableChildrenTypes(),
                        Console.CONSTANTS.allSingletonsAlreadyAdded());
                  }

                } else {
                  presenter.onPrepareAddChildResource(currentAddress, false);
                }
              }
            }));

    final ToolButton remove =
        new ToolButton(
            Console.CONSTANTS.common_label_delete(),
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                ModelNode selection = selectionModel.getSelectedObject();
                if (selection != null) presenter.onRemoveChildResource(currentAddress, selection);
              }
            });
    tools.addToolButtonRight(remove);
    remove.setEnabled(false);

    table = new ModelNodeCellTable(12);
    table.addColumn(
        new ModelNodeColumn(
            new ModelNodeColumn.ValueAdapter() {
              @Override
              public String getValue(ModelNode model) {
                return URL.decodePathSegment(model.asString());
              }
            }),
        "Child Resource");

    Column<ModelNode, ModelNode> option =
        new Column<ModelNode, ModelNode>(
            new ViewLinkCell<ModelNode>(
                Console.CONSTANTS.common_label_view(),
                new ActionCell.Delegate<ModelNode>() {
                  @Override
                  public void execute(ModelNode selection) {
                    presenter.onViewChild(currentAddress, selection.asString());
                  }
                })) {
          @Override
          public ModelNode getValue(ModelNode model) {
            return model;
          }
        };
    table.addColumn(option, "Option");

    dataProvider = new ListDataProvider<ModelNode>();
    dataProvider.addDataDisplay(table);

    selectionModel = new SingleSelectionModel<ModelNode>();
    table.setSelectionModel(selectionModel);
    selectionModel.addSelectionChangeHandler(
        new SelectionChangeEvent.Handler() {
          @Override
          public void onSelectionChange(SelectionChangeEvent event) {
            ModelNode selection = selectionModel.getSelectedObject();
            remove.setEnabled(selection != null);
          }
        });

    DefaultPager pager = new DefaultPager();
    pager.setDisplay(table);

    // -----

    header = new HTML();

    layout.add(header);
    layout.add(tools);
    layout.add(table);
    layout.add(pager);
    return layout;
  }