Package org.flexdock.docking

Examples of org.flexdock.docking.DockingPort


            return true;

        // check to see if we're already floating and we're trying to drop into
        // the
        // same dialog.
        DockingPort oldPort = DockingManager.getDockingPort(dockable);
        if (oldPort instanceof FloatingDockingPort && oldPort == port) {
            // only allow this situation if we're not the *last* dockable
            // in the viewport. if we're removing the last dockable, then
            // the dialog will disappear before we redock, and we don't want
            // this
            // to happen.
            FloatingDockingPort floatingDockingPort = (FloatingDockingPort) oldPort;
            if (floatingDockingPort.getDockableCount() == 1)
                return false;
        }

        if (dockable == null || dockable.getComponent() == null || port == null)
            return false;

        if (!DockingManager.isValidDockingRegion(region))
            return false;

        Dockable docked = DockingManager.getDockable(port.getDockedComponent());
        if (docked == null)
            return true;

        // don't allow them to dock into this region if the territory there is
        // blocked.
        if (docked.getDockingProperties().isTerritoryBlocked(region)
                .booleanValue())
            return false;

        // check to see if we're already docked into this region.
        // get the parent dockingPort.
        Container container = docked.getComponent().getParent();
        // now get the grandparent dockingport
        DockingPort grandparent = DockingManager.getDockingPort(container);

        // if we don't share the grandparent dockingport, then we're definitely
        // not split in the same dockingport
        // across different region. in this case, it's ok to proceed with the
        // dock
        if (grandparent == null)
            return true;

        Component currentlyInRegion = grandparent.getComponent(region);
        // block docking if we're already the component docked within the
        // specified region
        if (currentlyInRegion == dockable.getComponent())
            return false;

View Full Code Here


        // undock this component, now do we?
        if (parent == null)
            return false;

        boolean success = false;
        DockingPort dockingPort = DockingUtility.getParentDockingPort(dragSrc);

        // notify that we are about to undock
        Map dragContext = DragManager.getDragContext(dockable);
        DockingEvent dockingEvent = new DockingEvent(dockable, dockingPort,
                dockingPort, DockingEvent.UNDOCKING_STARTED, dragContext);
        EventManager.dispatch(dockingEvent);
        // if(dockingEvent.isConsumed())
        // return false;

        if (dockingPort != null) {
            // if 'dragSrc' is currently docked, then undock it instead of using
            // a
            // simple remove(). this will allow the DockingPort to do any of its
            // own
            // cleanup operations associated with component removal.
            success = dockingPort.undock(dragSrc);
        } else {
            // otherwise, just remove the component
            parent.remove(dragSrc);
            success = true;
        }
View Full Code Here

     * @see DefaultDockingPort#isTabsAsDragSource()
     * @see DefaultDockingPort#setTabsAsDragSource(boolean)
     * @see DefaultDockingPort#setRoot(boolean)
     */
    public DockingPort createDockingPort(DockingPort base) {
        DockingPort port = createDockingPortImpl(base);

        if (port instanceof DefaultDockingPort
                && base instanceof DefaultDockingPort) {
            DefaultDockingPort newPort = (DefaultDockingPort) port;
            DefaultDockingPort ddp = (DefaultDockingPort) base;
View Full Code Here

        // or regions
        setPostPainter(null);

        // now, assign the currentCover to the new one and repaint
        currentDropTargets = dropTargets;
        DockingPort port = dropTargets==null? null: (DockingPort)dropTargets.parent;
        // this is the dockable we're currently hovered over, not the one
        // being dragged
        Dockable hover = getHoverDockable(dropTargets);

        Point mousePoint = token.getCurrentMouse((Component)port);
View Full Code Here

            return null;

        synchronized(TRACKERS_BY_WINDOW) {
            for(Iterator it=TRACKERS_BY_WINDOW.values().iterator(); it.hasNext();) {
                RootDockingPortInfo info = (RootDockingPortInfo)it.next();
                DockingPort port = info.getPort(portId);
                if(port!=null)
                    return port;
            }
        }
        return null;
View Full Code Here

     *         {@code comp} is {@code null} or has no {@code DockingPort}
     *         ancestor.
     */
    public static DockingPort findByWindow(Component comp) {
        Component c = comp;
        DockingPort port = null;

        while (c != null) {
            if (c instanceof DockingPort) {
                port = (DockingPort) c;
            }
View Full Code Here

        // only work with DockingPorts
        if(!(evt.getSource() instanceof DockingPort))
            return;

        // we don't want to work with sub-ports
        DockingPort port = (DockingPort)evt.getSource();
        if(!port.isRoot())
            return;

        // only work with parent-change events
        if(!isParentChange(evt))
            return;
View Full Code Here

    public static Set getRootDockingPorts() {
        HashSet rootSet = new HashSet();
        Set globalSet = getDockingPorts();

        for(Iterator it=globalSet.iterator(); it.hasNext();) {
            DockingPort port = (DockingPort)it.next();
            if(port.isRoot())
                rootSet.add(port);
        }
        return rootSet;
    }
View Full Code Here

    public static DockingPort getRootDockingPort(Dockable dockable) {
        if(dockable==null || !DockingManager.isDocked(dockable))
            return null;

        DockingPort port = dockable.getDockingPort();
        Container parent = ((Component)port).getParent();
        while(!isWindowRoot(parent)) {
            if(parent instanceof DockingPort)
                port = (DockingPort)parent;
            parent = parent.getParent();
View Full Code Here

     *            be returned.
     * @return the immediate parent {@code DockingPort} that contains the
     *         specified {@code Component}.
     */
    public static DockingPort getParentDockingPort(Component comp) {
        DockingPort port = comp == null ? null : (DockingPort) SwingUtilities
                           .getAncestorOfClass(DockingPort.class, comp);
        if (port == null)
            return null;

        return port.isParentDockingPort(comp) ? port : null;
    }
View Full Code Here

TOP

Related Classes of org.flexdock.docking.DockingPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.