@Override
 public void setCaption(VCaption caption) {
   VCaption oldCaption = getCaption();
   if (oldCaption != null) {
     getLayoutManager().unregisterDependency(layout, oldCaption.getElement());
   }
   super.setCaption(caption);
   if (caption != null) {
     getLayoutManager()
         .registerDependency((ManagedLayout) child.getParent(), caption.getElement());
   }
 }
 @Override
 public void onDrop(DragContext context) {
   super.onDrop(context);
   PortletChrome portletWidget = (PortletChrome) context.selectedWidgets.get(0);
   if (positionerSlot != null) {
     positionerSlot.setWidget(portletWidget);
   }
   Widget contentWidget = portletWidget.getContentWidget();
   ComponentConnector contentConnector = Util.findConnectorFor(contentWidget);
   PortalLayoutConnector originalConnector = (PortalLayoutConnector) contentConnector.getParent();
   if (originalConnector != portalConnector) {
     portalConnector.propagateHierarchyChangesToServer();
     originalConnector.propagateHierarchyChangesToServer();
   } else {
     portalConnector.updatePortletPositionOnServer(contentConnector);
   }
 }
示例#3
0
  @Override
  public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
    ComponentConnector oldChild = null;
    ComponentConnector newChild = getContent();

    for (ComponentConnector c : event.getOldChildren()) {
      if (!(c instanceof WindowConnector)) {
        oldChild = c;
        break;
      }
    }

    if (oldChild != newChild) {
      if (childStateChangeHandlerRegistration != null) {
        childStateChangeHandlerRegistration.removeHandler();
        childStateChangeHandlerRegistration = null;
      }
      if (newChild != null) {
        getWidget().setWidget(newChild.getWidget());
        childStateChangeHandlerRegistration =
            newChild.addStateChangeHandler(childStateChangeHandler);
        // Must handle new child here as state change events are already
        // fired
        onChildSizeChange();
      } else {
        getWidget().setWidget(null);
      }
    }

    for (ComponentConnector c : getChildComponents()) {
      if (c instanceof WindowConnector) {
        WindowConnector wc = (WindowConnector) c;
        wc.setWindowOrderAndPosition();
      }
    }

    // Close removed sub windows
    for (ComponentConnector c : event.getOldChildren()) {
      if (c.getParent() != this && c instanceof WindowConnector) {
        ((WindowConnector) c).getWidget().hide();
      }
    }
  }
  @Override
  public void onConnectorHierarchyChange(ConnectorHierarchyChangeEvent event) {
    // super.onConnectorHierarchyChange(event);

    // Remove old children
    for (ComponentConnector child : event.getOldChildren()) {
      if (child.getParent() != this) {
        Widget widget = child.getWidget();
        if (widget.isAttached()) {
          getWidget().remove(widget);
        }
      }
    }

    // Add or move children
    int index = 0;
    for (ComponentConnector child : getChildComponents()) {
      getWidget().addOrMove(child.getWidget(), index);
      ++index;
    }
  }