Package org.noos.xing.mydoggy

Examples of org.noos.xing.mydoggy.Content


    }

    public void actionPerformed(ActionEvent e) {
        ContentManager contentManager = toolWindowManager.getContentManager();
        if (contentManager.getContent(contentId) == null) {
            Content content = contentManager.addContent(contentId,
                                                        title,
                                                        icon,
                                                        component,
                                                        tooltip);
            if (mnemonic != -1)
                content.setMnemonic(mnemonic);
            content.setSelected(true);
        }
    }
View Full Code Here


        ContentManager contentManager = toolWindowManager.getContentManager();

        TestCMListener listener = new TestCMListener();
        contentManager.addContentManagerListener(listener);

        Content content = contentManager.addContent("key", "content", null, new JButton("Hello World!!!"));

        assertTrue(listener.isContentAdded());
        assertNotNull(listener.getLastEvent());
        assertEquals(ContentManagerEvent.ActionId.CONTENT_ADDED, listener.getLastEvent().getId());
        assertEquals(content, listener.getLastEvent().getContent());
View Full Code Here

        ContentManager contentManager = toolWindowManager.getContentManager();

        TestCMListener listener = new TestCMListener();
        contentManager.addContentManagerListener(listener);

        Content content = contentManager.addContent("key", "content", null, new JButton("Hello World!!!"));
        assertTrue(contentManager.removeContent(content));

        assertTrue(listener.isContentRemoved());
        assertNotNull(listener.getLastEvent());
        assertEquals(ContentManagerEvent.ActionId.CONTENT_REMOVED, listener.getLastEvent().getId());
View Full Code Here

        }

        public void drop(DropTargetDropEvent e) {
            if (isDropAcceptable(e)) {
                try {
                    Content dragContent = toolWindowManager.getContentManager().getContent(
                            e.getTransferable().getTransferData(MyDoggyTransferable.CONTENT_ID_DF)
                    );

                    Point location = e.getLocation();
                    int targetIndex = indexAtLocation(location.x, location.y);

                    if (dragContent.isDetached()) {
                        if (targetIndex >= 0) {
                            dragContent.reattach(targetIndex);
                        } else
                            dragContent.reattach(-1);

                        e.dropComplete(true);
                    } else {
                        if (targetIndex >= 0) {
                            setIndex(getContentAt(dragTabIndex), targetIndex);
View Full Code Here

                        lastDropPanel.drop(e.getDragSourceContext().getTransferable());
                    } else if (lastBarAnchor == null) {
                        if (SwingUtil.getBoolean(MyDoggyKeySpace.DND_CONTENT_OUTSIDE_FRAME, true)) {
                            // Detach content

                            Content content = getContentAt(dragTabIndex);
                            ContentUI contentUI = content.getContentUI();

                            Rectangle bounds = contentUI.getDetachedBounds();
                            if (bounds != null) {
                                bounds.setLocation(e.getLocation());
                            } else {
                                bounds = new Rectangle();
                                bounds.setLocation(e.getLocation());
                                bounds.setSize(toolWindowManager.getBoundsToScreen(content.getComponent().getBounds(),
                                        content.getComponent().getParent()).getSize());
                            }

                            contentUI.setDetachedBounds(bounds);
                            content.setDetached(true);
                        }
                    } else {
                        // restore content at the same position
//                        addTab(draggingContent, draggingContent.getComponent(), dragTabIndex);
//                        draggingContent.setSelected(true);
View Full Code Here

        return super.getTitleAt(index);
    }

    public Icon getIconAt(int index) {
        if (getSelectedIndex() == index) {
            Content content = contentMap.get(index);
            if (content == null)
                return super.getIconAt(index);

            ContentUI contentUI = content.getContentUI();
            if (contentUI == null)
                return super.getIconAt(index);

            // Setup aggregate icon
            aggregateIcon.setIconAt(0, super.getIconAt(index));

            titleIcon.setText(super.getTitleAt(index));
            titleIcon.setUnderlinedIndex(SwingUtil.findDisplayedMnemonicIndex(super.getTitleAt(index),
                    getContentAt(index).getMnemonic()));


            aggregateIcon.setVisibleAt(2, contentUI.isMinimizable() && showMinimize);
            if (content.isMaximized() || getContentMaximized(content) != null)
                aggregateIcon.setIconAt(3, UIManager.getIcon(MyDoggyKeySpace.CONTENT_PAGE_RESTORE));
            else
                aggregateIcon.setIconAt(3, UIManager.getIcon(MyDoggyKeySpace.CONTENT_PAGE_MAXIMIZE));

            aggregateIcon.setVisibleAt(3, contentUI.isMaximizable() && showMaximize);
            aggregateIcon.setVisibleAt(4, contentUI.isDetachable() && showDetach);
            aggregateIcon.setVisibleAt(5, contentUI.isCloseable() && showClose);

            aggregateIcon.setIndex(index);

            return aggregateIcon;
        } else if (flashingContents.containsKey(getContentAt(index))) {
            Content content = getContentAt(index);
            Object o = flashingContents.get(content);
            if (o == null) {
                Icon icon = new AggregateIcon(UIManager.getIcon(MyDoggyKeySpace.CONTENT_FLASHING),
                        super.getIconAt(index),
                        SwingConstants.HORIZONTAL);
View Full Code Here

        return super.getIconAt(index);
    }

    public void removeTabAt(int index) {
        Content content = getContentAt(index);
        if (content == null)
            throw new IllegalArgumentException("Invalid index location.");

        content.removePropertyChangeListener(this);
        super.removeTabAt(index);
        contentMap.remove(index);

        Integer[] keys = contentMap.keySet().toArray(new Integer[contentMap.size()]);
        Arrays.sort(keys);
View Full Code Here

            return;
        }

        // Remove content tab
        Component cmp = getComponentAt(prev);
        Content content = getContentAt(prev);
        if (content == null)
            throw new IllegalArgumentException("Invalid index location.");
        content.removePropertyChangeListener(this);
        super.removeTabAt(prev);
        contentMap.remove(prev);
        Integer[] keys = contentMap.keySet().toArray(new Integer[contentMap.size()]);
        Arrays.sort(keys);
        for (Integer key : keys) {
View Full Code Here

                selectionOnPressed = (aggregateIcon.getIndex() == mouseOverTab);
            }
            mouseOverTabWhenPressed = mouseOverTab;

            if (mouseOverTab != -1) {
                Content newSelected = getContentAt(mouseOverTab);
                if (newSelected != null && !newSelected.isMaximized()) {
                    Content oldSelected = toolWindowManager.getContentManager().getSelectedContent();
                    if (newSelected != oldSelected) {
                        newSelected.setSelected(true);
                    }
                }
            }
View Full Code Here

        public void mouseClicked(MouseEvent e) {
            if (mouseOverTab >= 0 && mouseOverTab < getTabCount()) {
                if (mouseOverTab == mouseOverTabWhenPressed && !selectionOnPressed)
                    return;

                Content content = getContentAt(mouseOverTab);
                if (content == null)
                    return;

                if (SwingUtilities.isLeftMouseButton(e)) {
                    ContentUI contentUI = content.getContentUI();

                    if (isDetachFired(contentUI, e.getPoint())) {
                        fireDetachTabEvent(content);
                        return;
                    }

                    if (isCloseFired(contentUI, e.getPoint())) {
                        fireCloseTabEvent(content);
                        return;
                    }

                    if (isMinimizedFired(contentUI, e.getPoint())) {
                        content.setMinimized(!content.isMinimized());
                        return;
                    }

                    if ((e.getClickCount() == 2 && contentUI.isMaximizable()) || isMaximizeFired(contentUI, e.getPoint())) {
                        Content maximized = getContentMaximized(content);
                        if (maximized != null)
                            maximized.setMaximized(false);
                        else
                            content.setMaximized(!content.isMaximized());
                    }
                } else if (SwingUtilities.isRightMouseButton(e)) {
                    if (toolWindowManager.getContentManager().getContentManagerUI().isPopupMenuEnabled())
View Full Code Here

TOP

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

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.