Package org.flexdock.docking

Examples of org.flexdock.docking.DockingStrategy


        TreeNode grandParent = parent.getParent();
        if(!(grandParent instanceof DockingPortNode))
            return null;

        DockingPort superPort = (DockingPort)((DockingPortNode)grandParent).getUserObject();
        DockingStrategy strategy = superPort.getDockingStrategy();
        return strategy.createDockingPort(superPort);
    }
View Full Code Here


            }
        });
    }

    private void applySplitDividerLocation(JSplitPane splitPane) {
        DockingStrategy strategy = DockingManager.getDockingStrategy(this);
        int loc = strategy.getInitialDividerLocation(this, splitPane);
        splitPane.setDividerLocation(loc);
    }
View Full Code Here

        // dockingPort.
        Component docked = getDockedComponent();
        remove(docked);

        // add the components to their new parents.
        DockingStrategy strategy = getDockingStrategy();
        DockingPort oldContent = strategy.createDockingPort(this);
        DockingPort newContent = strategy.createDockingPort(this);
        addCmp(oldContent, docked);
        dockCmp(newContent, comp);

        JSplitPane newDockedContent = strategy.createSplitPane(this, region);

        // put the ports in the correct order and add them to a new wrapper
        // panel
        DockingPort[] ports = putPortsInOrder(oldContent, newContent, region);

        if (ports[0] instanceof JComponent) {
            ((JComponent) ports[0]).setMinimumSize(new Dimension(0, 0));
        }
        if (ports[1] instanceof JComponent) {
            ((JComponent) ports[1]).setMinimumSize(new Dimension(0, 0));
        }

        if (ports[0] instanceof Component)
            newDockedContent.setLeftComponent((Component) ports[0]);
        if (ports[1] instanceof Component)
            newDockedContent.setRightComponent((Component) ports[1]);

        // set the split in the middle
        double ratio = .5;

        if (docked instanceof Dockable
                && newDockedContent instanceof DockingSplitPane) {
            Float siblingRatio = ((Dockable) docked).getDockingProperties()
                                 .getSiblingSize(region);
            if (siblingRatio != null) {
                ratio = siblingRatio.doubleValue();
            }

            ((DockingSplitPane) newDockedContent).setInitialDividerRatio(ratio);
        }
        newDockedContent.setDividerLocation(ratio);

        // now set the wrapper panel as the currently docked component
        setComponent(newDockedContent);
        // if we're currently showing, then we can exit now
        if (isShowing())
            return true;

        // otherwise, we have unrealized components whose sizes cannot be
        // determined until after we're visible. cache the desired size
        // values now for use later during rendering.
        double proportion = strategy.getDividerProportion(this,
                            newDockedContent);
        SwingUtility.putClientProperty((Component) oldContent,
                                       DefaultDockingStrategy.PREFERRED_PROPORTION, new Float(
                                           proportion));
        SwingUtility.putClientProperty((Component) newContent,
View Full Code Here

        Object userObj = superNode.getUserObject();
        if(!(userObj instanceof DockingPort))
            return null;

        DockingPort superPort = (DockingPort)userObj;
        DockingStrategy strategy = superPort.getDockingStrategy();
        return strategy.createSplitPane(superPort, dockingRegion);
    }
View Full Code Here

        pipeline = null;
    }


    protected void finishDrag(Dockable dockable, DragOperation token, MouseEvent mouseEvt) {
        DockingStrategy docker = DockingManager.getDockingStrategy(dockable);
        DockingPort currentPort = DockingUtility.getParentDockingPort(dockable);
        DockingPort targetPort = token.getTargetPort();
        String region = token.getTargetRegion();

        // remove the listeners from the drag-source and all the old ones back in
        restoreCachedListeners(token);

        // issue a DockingEvent to allow any listeners the chance to cancel the operation.
        DockingEvent evt = new DockingEvent(dockable, currentPort, targetPort, DockingEvent.DROP_STARTED, mouseEvt, getDragContext());
        evt.setRegion(region);
        evt.setOverWindow(token.isOverWindow());
//    EventManager.notifyDockingMonitor(dockable, evt);
        EventManager.dispatch(evt, dockable);


        // attempt to complete the docking operation
        if(!evt.isConsumed())
            docker.dock(dockable, targetPort, region, token);
    }
View Full Code Here

TOP

Related Classes of org.flexdock.docking.DockingStrategy

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.