/** * Handle a drop from another layout * * @param event The drag and drop event */ @Override protected void handleDropFromLayout(DragAndDropEvent event) { AbsoluteLayoutTargetDetails details = (AbsoluteLayoutTargetDetails) event.getTargetDetails(); LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); Component component = transferable.getComponent(); Component source = event.getTransferable().getSourceComponent(); DDAbsoluteLayout layout = (DDAbsoluteLayout) details.getTarget(); int leftPixelPosition = details.getRelativeLeft(); int topPixelPosition = details.getRelativeTop(); // Check that we are not dragging an outer layout into an // inner // layout Component parent = source.getParent(); while (parent != null) { parent = parent.getParent(); } // remove component from source using filter if (source instanceof ComponentContainer) { ComponentContainer sourceLayout = (ComponentContainer) source; sourceLayout.removeComponent(component); } // Add component to absolute layout layout.addComponent( component, "left:" + leftPixelPosition + "px;top:" + topPixelPosition + "px"); }
public void replaceContainer(ComponentContainer newContainer, ComponentContainer newPosition) { ComponentContainer containerParent = (ComponentContainer) tabContainer.getParent(); if (containerParent != null) { containerParent.removeComponent(tabContainer); } if (newPosition == null) newPosition = newContainer; newPosition.addComponent(tabContainer); contentWrapper.addComponent(newContainer); }
private void disconnectReferencedElementsFromPerspectiveWidgets( MElementContainer<? extends MUIElement> container) { for (MUIElement e : container.getChildren()) { if (e instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) e; if (ph.isToBeRendered()) { ComponentContainer phComponent = (ComponentContainer) ph.getWidget(); Component refComponent = (Component) ph.getRef().getWidget(); phComponent.removeComponent(refComponent); } } } }
/** {@inheritDoc} */ @Override public void doUnrender() { if (textArea != null) { // unbind all active bindings unbind(); ComponentContainer parent = ((ComponentContainer) textArea.getParent()); if (parent != null) { parent.removeComponent(textArea); } // remove assocations unassociateWidget(textArea); textArea = null; } }
/** {@inheritDoc} */ @Override public void doUnrender() { if (checkBox != null) { // unbind all active bindings unbind(); ComponentContainer parent = ((ComponentContainer) checkBox.getParent()); if (parent != null) { parent.removeComponent(checkBox); } // remove assocations unassociateWidget(checkBox); checkBox = null; } }
@Override protected void handleDropFromLayout(DragAndDropEvent event) { LayoutBoundTransferable transferable = (LayoutBoundTransferable) event.getTransferable(); TabSheetTargetDetails details = (TabSheetTargetDetails) event.getTargetDetails(); DDTabSheet tabSheet = (DDTabSheet) details.getTarget(); Component c = transferable.getComponent(); HorizontalDropLocation location = details.getDropLocation(); int idx = details.getOverIndex(); ComponentContainer source = (ComponentContainer) transferable.getSourceComponent(); // Detach from old source if (source instanceof ComponentContainer) { ((ComponentContainer) source).removeComponent(c); } else if (source instanceof SingleComponentContainer) { ((SingleComponentContainer) source).setContent(null); } if (location == HorizontalDropLocation.LEFT) { tabSheet.addTab(c, idx); } else if (location == HorizontalDropLocation.RIGHT) { tabSheet.addTab(c, idx + 1); } }