Package org.noos.xing.mydoggy

Examples of org.noos.xing.mydoggy.Dockable


                if (isWrapper(component))
                    removeFromWrapper(component, dockable);
                multiSplitPane.remove(component);

                // retrieve the component related to sole entry in entries
                Dockable leftDockable = entries.keySet().iterator().next();
                DockableLeaf leftLeaf = getLeaf(leftDockable);

                Component masterLeftLeafCmp = multiSplitPane.getMultiSplitLayout().getChildMap().get(leftLeaf.getName());
                Component leftLeafCmp = getComponentFromWrapper(masterLeftLeafCmp);
                leftLeaf.setName("1");
View Full Code Here


                if (leaf.getDockables().size() == 1)
                    break;

                Component component = currentChildMap.get(leaf.getName());

                Dockable dockable = toolWindowManager.getDockable(dockId);
                setConstraints(dockable,
                               getComponentFromWrapper(component, dockable),
                               null,
                               -1,
                               AggregationPosition.DEFAULT
                );
            }
        } else {
            Stack<MultiSplitLayout.Split> stack = new Stack<MultiSplitLayout.Split>();
            stack.push((MultiSplitLayout.Split) multiSplitPaneModelRoot);
            while (!stack.isEmpty()) {
                MultiSplitLayout.Split split = stack.pop();

                for (MultiSplitLayout.Node child : split.getChildren()) {
                    if (child instanceof DockableLeaf) {
                        DockableLeaf leaf = (DockableLeaf) child;

                        String[] dockIds = leaf.getDockables().toArray(new String[leaf.getDockables().size()]);
                        for (String dockId : dockIds) {

                            if (leaf.getDockables().size() == 1)
                                break;

                            Component component = currentChildMap.get(leaf.getName());

                            Dockable dockable = toolWindowManager.getDockable(dockId);
                            setConstraints(dockable,
                                           getComponentFromWrapper(component, dockable),
                                           null,
                                           -1,
                                           AggregationPosition.DEFAULT
                            );
                        }
                    } else if (child instanceof MultiSplitLayout.Split) {
                        stack.push((MultiSplitLayout.Split) child);
                    }
                }
            }
        }

        if (root instanceof MultiSplitLayout.Split) {
            // Step Two: apply model 1...Aggregate
            Stack<MultiSplitLayout.Split> stack = new Stack<MultiSplitLayout.Split>();
            stack.push((MultiSplitLayout.Split) root);
            while (!stack.isEmpty()) {
                MultiSplitLayout.Split split = stack.pop();

                for (MultiSplitLayout.Node child : split.getChildren()) {
                    if (child instanceof DockableLeaf) {
                        DockableLeaf leaf = (DockableLeaf) child;

                        List<String> dockIds = leaf.getDockables();
                        Dockable masterDockable = toolWindowManager.getDockable(leaf.getDockable());
                        for (int i = 1; i < dockIds.size(); i++) {
                            String dockId = dockIds.get(i);

                            Dockable dockable = toolWindowManager.getDockable(dockId);
                            setConstraints(dockable,
                                           getComponentFromWrapper(currentChildMap.get(getLeaf(dockable).getName()), dockable),
                                           masterDockable,
                                           -1,
                                           AggregationPosition.DEFAULT
                            );
                        }
                    } else if (child instanceof MultiSplitLayout.Split) {
                        stack.push((MultiSplitLayout.Split) child);
                    }
                }
            }
           
            // Step Two: apply model 2...Isomorphing
            Map<String, Component> newChildMap = new HashMap<String, Component>();
            stack = new Stack<MultiSplitLayout.Split>();
            stack.push((MultiSplitLayout.Split) root);
            while (!stack.isEmpty()) {
                MultiSplitLayout.Split split = stack.pop();

                for (MultiSplitLayout.Node child : split.getChildren()) {
                    if (child instanceof DockableLeaf) {
                        DockableLeaf leaf = (DockableLeaf) child;

                        DockableLeaf currentLeaf = getLeaf(multiSplitPaneModelRoot, leaf.getDockable());

                        newChildMap.put(
                                leaf.getName(),
                                currentChildMap.get(currentLeaf.getName())
                        );
                    } else if (child instanceof MultiSplitLayout.Split) {
                        stack.push((MultiSplitLayout.Split) child);
                    }
                }
            }

            multiSplitPane.getMultiSplitLayout().setChildMap(newChildMap);

        } else {
            DockableLeaf leaf = (DockableLeaf) root;

            List<String> dockIds = leaf.getDockables();
            Dockable masterDockable = toolWindowManager.getDockable(leaf.getDockable());
            for (int i = 1; i < dockIds.size(); i++) {
                String dockId = dockIds.get(i);

                Dockable dockable = toolWindowManager.getDockable(dockId);
                setConstraints(dockable,
                               getComponentFromWrapper(currentChildMap.get(getLeaf(dockable).getName()), dockable),
                               masterDockable,
                               -1,
                               AggregationPosition.DEFAULT
View Full Code Here

        // If we have at least one content, then dock into that one!
        MultiSplitConstraint constraint;
        final Iterator<Entry<Dockable, PageComponent>> iterator = contentAndPageComponentById.values().iterator();
        if (iterator.hasNext()) {
            Dockable dock = iterator.next().getKey();
            if (dock instanceof Content) {
                constraint = new MultiSplitConstraint((Content) dock);
            }
            else {
                constraint = new MultiSplitConstraint(AggregationPosition.DEFAULT);
            }
        }
        else {
            constraint = new MultiSplitConstraint(AggregationPosition.DEFAULT);
        }
        final Dockable dockable;

        ViewDescriptor viewDescriptor = getViewDescriptor(pageComponent.getId());

        if (viewDescriptor instanceof MyDoggyToolWindowViewDescriptor) {
            final MyDoggyToolWindowViewDescriptor toolPageComponent = (MyDoggyToolWindowViewDescriptor) viewDescriptor;
            ToolWindow tw = toolWindowManager.registerToolWindow(pageComponent.getId(), pageComponent.getDisplayName(), pageComponent.getIcon(), pageComponent.getControl(), toolPageComponent.getAnchor());

            tw.setType(toolPageComponent.getType());
            tw.setAvailable(toolPageComponent.isAvailable());
            tw.setActive(toolPageComponent.isActive());
            dockable = tw;
        }
        else {
            // Create and register a new content to the mydoggy layout manager
            Content c = contentManager.addContent(pageComponent.getId(), pageComponent.getDisplayName(), // tabName
                    pageComponent.getIcon(), pageComponent.getControl(), pageComponent.getDisplayName(), // toolTip
                    constraint);
            dockable = c;
        }
        Assert.notNull(dockable);
        Assert.isTrue(dockable.getId().equals(pageComponent.getId()));
        contentAndPageComponentById.put(pageComponent.getId(), new DoggyEntry<Dockable, PageComponent>(dockable, pageComponent));

        // trigger the createControl method of the PageComponent, so if a
        // PageComponentListener is added
        // in the createControl method, the componentOpened event is
View Full Code Here

     */
    @Override
    protected void doRemovePageComponent(PageComponent pageComponent) {
        Entry<Dockable, PageComponent> e = contentAndPageComponentById.remove(pageComponent.getId());
        Assert.notNull(e);
        Dockable dock = e.getKey();
        final boolean ret;
        if (dock instanceof Content) {
            ret = contentManager.removeContent((Content) dock);
        }
        else {
            toolWindowManager.unregisterToolWindow(dock.getId());
            ret = true;
        }
        Assert.isTrue(ret);
    }
View Full Code Here

TOP

Related Classes of org.noos.xing.mydoggy.Dockable

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.