Esempio n. 1
0
    public void insert(final PWidget widget, final String tabText, final int beforeIndex) {
        // Detach new child.
        widget.removeFromParent();

        getChildren().insert(widget, beforeIndex);

        // Adopt.
        adopt(widget);

        final Add addWidget = new Add(widget.getID(), getID());
        addWidget.put(PROPERTY.BEFORE_INDEX, beforeIndex);
        addWidget.put(PROPERTY.TAB_TEXT, tabText);
        getUIContext().stackInstruction(addWidget);
    }
Esempio n. 2
0
 @Override
 public void onClientData(final JsonObject instruction) {
   if (instruction.containsKey(ClientToServerModel.HANDLER_SELECTION.toStringValue())) {
     final int widgetId =
         instruction
             .getJsonNumber(ClientToServerModel.HANDLER_SELECTION.toStringValue())
             .intValue();
     final PSelectionEvent<PTreeItem> selectionEvent =
         new PSelectionEvent<>(this, UIContext.get().getObject(widgetId));
     for (final PSelectionHandler<PTreeItem> handler : selectionHandlers) {
       handler.onSelection(selectionEvent);
     }
   } else {
     super.onClientData(instruction);
   }
 }
Esempio n. 3
0
 @Override
 protected void init0() {
   super.init0();
   root.setTree(this);
   root.attach(windowID);
 }
Esempio n. 4
0
 void adopt(final PWidget widget, final PTreeItem item) {
   assert !childWidgets.containsKey(widget);
   childWidgets.put(widget, item);
   widget.setParent(this);
 }
Esempio n. 5
0
 void orphan(final PWidget widget) {
   assert widget.getParent() == this;
   widget.setParent(null);
   childWidgets.remove(widget);
 }