Package org.noos.xing.mydoggy.plaf.ui.cmp.multisplit.MultiSplitLayout

Examples of org.noos.xing.mydoggy.plaf.ui.cmp.multisplit.MultiSplitLayout.Node


            if (!checkModel())
                System.out.println("Check model fail. addDockable end");

            if (storeLayout && oldModel != null) {
                // Decode stored model
                final Node decodedModel = decode(oldModel);
//                jumpResetBounds = true;
                multiSplitPane.getMultiSplitLayout().setFloatingDividers(false);

                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        setMultiSplitLayout(decodedModel);
                    }
                });
            } else {
                if (resetB) {
                    Node split = getLeaf(dockable).getParent();
                    if (split == null)
                        split = multiSplitPaneModelRoot;

                    repaintMultiSplit(toolWindowManager.getClientProperty(MyDoggyKeySpace.PERSISTENCE_DELEGATE_PARSING) == null,
                            split);
View Full Code Here


                // Update the model
                AggregationPosition constraintAggPosition = AggregationPosition.DEFAULT;
                Split rootSplit = (Split) multiSplitPaneModelRoot;
                List<Node> children = rootSplit.getChildren();
                for (int i = 0, size = children.size(); i < size; i++) {
                    Node node = children.get(i);
                    if (node == leftLeaf) {
                        if (i == 0) {
                            if (rootSplit.isRowLayout())
                                constraintAggPosition = AggregationPosition.RIGHT;
                            else
                                constraintAggPosition = AggregationPosition.BOTTOM;
                        } else if (rootSplit.isRowLayout())
                            constraintAggPosition = AggregationPosition.LEFT;
                        else
                            constraintAggPosition = AggregationPosition.TOP;
                        break;
                    }
                }


                multiSplitPaneModelRoot = leftLeaf;
                multiSplitPaneModelRoot.setParent(null);

                // Update the pane
                multiSplitPane.setModel(multiSplitPaneModelRoot);
                multiSplitPane.removeAll();
                multiSplitPane.add(getWrapperForComponent(leftDockable, leftLeafCmp, Action.REMOVE_DOCK), "1");

                // Finalize
                leafNameCounter = 1;
                SwingUtil.repaint(this);

                // Prepare constraint
                return new DockableConstraint(leftLeaf,
                        constraintAggPosition,
                        -1);
            }
        } else {
            DockableConstraint dockableConstraint = null;

            DockableLeaf dockableLeaf = getLeaf(dockable);
            if (dockableLeaf == null)
                throw new IllegalArgumentException("Cannot remove the dockable. Cannot find leaf. [id : " + dockable.getId() + "]");

            if (dockableLeaf.getDockables().size() > 1) {
                // There are more than one dockable on the same leaf
                // Remove the dockable from leaf and from aggregating component...
                dockableLeaf.getDockables().remove(dockable.getId());

                int index = removeFromWrapper(multiSplitPane.getMultiSplitLayout().getChildMap().get(dockableLeaf.getName()),
                        dockable);

                // Prepare dockableConstraint
                return new DockableConstraint(dockableLeaf,
                        AggregationPosition.DEFAULT,
                        index);
            } else {
                leafNameCounter--;

                // There is one dockable on the leaf. We have to rearrange the layout...
                String leafKey = dockableLeaf.getName();
                int leafValue = Integer.parseInt(leafKey);
                Component component = multiSplitPane.getMultiSplitLayout().getChildMap().get(leafKey);

                // Remove content
                if (component != null) {
                    // Remove the component from the multiSplitPane
                    if (isWrapper(component))
                        removeFromWrapper(component, dockable);
                    multiSplitPane.remove(component);

                    // Update model

                    // Navigate the model to look for the requested leaf
                    Stack<Split> stack = new Stack<Split>();
                    stack.push((Split) multiSplitPaneModelRoot);

                    boolean setChild = true;
                    while (!stack.isEmpty()) {
                        Split split = stack.pop();

                        List<Node> children = split.getChildren();

                        for (int i = 0; i < children.size(); i++) {
                            Node child = children.get(i);

                            if (child instanceof Leaf) {
                                Leaf leaf = (Leaf) child;

                                String leafName = leaf.getName();
View Full Code Here

        ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(bundleClassLoader);

        try {
            XMLDecoder d = new XMLDecoder(new ByteArrayInputStream(bytes));
            Node node = (Node) (d.readObject());

            return node;
        } finally {
            // Restore
            Thread.currentThread().setContextClassLoader(originalClassLoader);
View Full Code Here

        if (sum != 1.0d) {
            double w = 1.0 / ((children.size() / 2) + 1);

            sum = 0;
            for (int i = 0, size = children.size() - 1; i < size; i++) {
                Node node = children.get(i);
                node.resetBounds();
                if (!(node instanceof Divider)) {
                    node.setWeight(w);
                    sum += w;
                }
            }

            Node lastNode = children.get(children.size() - 1);
            lastNode.resetBounds();
            lastNode.setWeight(1.0d - sum);

            multiSplitPane.getMultiSplitLayout().setFloatingDividers(true);
        }
    }
View Full Code Here

TOP

Related Classes of org.noos.xing.mydoggy.plaf.ui.cmp.multisplit.MultiSplitLayout.Node

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.