Package gov.nasa.arc.mct.canvas.panel

Examples of gov.nasa.arc.mct.canvas.panel.Panel


        int bottomMostY = firstBound.y;

        int numOfPanels = selectedPanels.size();

        for (int i = 0; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldy = bound.y;
            int height = bound.height;
            if (oldy < topMostY)
                topMostY = oldy;
            if (oldy + height > bottomMostY)
                bottomMostY = oldy + height;
        }

        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            int midPoint = topMostY + ((bottomMostY - topMostY) / 2);
            int componentMidPoint = bound.y + (bound.height / 2);

            if (componentMidPoint > midPoint) {
                int diff = componentMidPoint - midPoint;
                panel.setBounds(bound.x, bound.y - diff, bound.width, bound.height);
            } else { // it's to the left of center - move it towards the
                // center...
                int diff = midPoint - componentMidPoint;
                panel.setBounds(bound.x, bound.y + diff, bound.width, bound.height);
            }
        }
    }
View Full Code Here


       
    }
    private void removeStalePanels(Set<Object> canvasCotents) {
        Iterator<Panel> it = renderedPanels.values().iterator();
        while (it.hasNext()) {
            Panel p = it.next();
            MCTViewManifestationInfo paneInfo = CanvasManifestation.getManifestationInfo(p.getWrappedManifestation());
            if (!canvasCotents.contains(paneInfo)) {
                this.canvasPanel.remove(p);
                it.remove();
                selectedPanels.remove(p);
                augmentation.removeHighlights(Collections.singleton(p));
View Full Code Here

     * @param p point to check whether it is directly contained in the canvas or a panel
     * @return true if the point is in nested manifestation
     */
    boolean isPointinaPanel(Point p) {
        for (Entry<Integer, Panel> entry : renderedPanels.entrySet()) {
            Panel panel = entry.getValue();
            if (panel.containsPoint(p)) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        if (canvasContents != null) {
            for (Object object : canvasContents) {
                MCTViewManifestationInfo info = (MCTViewManifestationInfo) object;
                String panelOrder = info
                                .getInfoProperty(ControlAreaFormattingConstants.PANEL_ORDER);
                Panel panel = renderedPanels.get(Integer.valueOf(panelOrder));
               
                if (panel != null) {
                   
                    if (panel.containsPoint(p)) {
                        View wrappedManifestation = panel.getWrappedManifestation();
                        if (wrappedManifestation instanceof CanvasManifestation) {
                            CanvasManifestation innerCanvasManifestation = (CanvasManifestation) wrappedManifestation;
                            Panel innerPanel = innerCanvasManifestation.findImmediatePanel(p);
                            if (innerPanel != null)
                                return innerPanel;
                        }
                      return panel;
                    }
View Full Code Here

        int index = Integer.parseInt(indexStr);
        if (panelId < index) {
            panelId = index;
        }

        Panel existingPanel = renderedPanels.get(index);
        if (existingPanel != null) {
            if (!updating || selectedPanels.contains(existingPanel)) {
                // update existing panel
                existingPanel.update(canvasContent);
                changeOrder(existingPanel, zorder);
            }
        } else {
            String viewType = canvasContent.getManifestedViewType();
            ComponentRegistry cr = ComponentRegistryAccess.getComponentRegistry();
            AbstractComponent comp = cr.getComponent(componentId);

            View viewManifestation = getManifestation(comp, viewType, canvasContent);
            if (viewManifestation == null) { return; }
           
            Panel panel = createPanel(viewManifestation, index, this);
            viewManifestation.setNamingContext(panel);
            Dimension dimension = canvasContent.getDimension();
            Point location = canvasContent.getStartPoint();
            Rectangle bound = new Rectangle(location, dimension);

            panel.setBounds(bound);

            placeWidget(panel, zorder);
            renderedPanels.put(index, panel);
        }
    }
View Full Code Here

        canvasPanel.add(widget, null);
        changeOrder(widget, zorder);
    }
   
    public Panel createPanel(View manifestation, int panelId, PanelFocusSelectionProvider focusProvider) {
        Panel p = new Panel(manifestation, panelId, focusProvider);
        if (scrollColor != null) {
            p.setScrollColor(scrollColor, getBackground());
        }
        if (titleBarColor != null) {
            p.setTitleBarColor(titleBarColor, titleLabelColor);
        }
        if (defaultBorderColor != null) {
            p.setDefaultBorderColor(defaultBorderColor);
        }

        p.setBackground( getBackground() );
       
        p.getSelectionProvider().addSelectionChangeListener(selectionListener);
        return p;
    }
View Full Code Here

    /**
     * Add a single selection based on mouse location.
     * @param p <code>Point</code>
     */
    Panel addSingleSelection(Point p) {
        Panel panel = findImmediatePanel(p);
        if (panel != null) {
            Container container = SwingUtilities.getAncestorOfClass(CanvasManifestation.class, panel);
            assert container instanceof CanvasManifestation : "Panels must be contained in a CanvasManifestation";
            CanvasManifestation nestedCanvasManifestation = (CanvasManifestation) container;
            nestedCanvasManifestation.select(panel);
View Full Code Here

    private void clearSelectionInCanvas() {
        if (!canvasEnabled) return; // Disabled panels contain nothing
        augmentation.removeHighlights(selectedPanels);           
        selectedPanels.clear();
        for (Entry<Integer, Panel> entry : renderedPanels.entrySet()) {
            Panel panel = entry.getValue();
            panel.clearCurrentSelections();
        }
    }
View Full Code Here

   
    private void addToSelectionCollection(List<View> manifestations) {
        for (Panel panel : selectedPanels)
            manifestations.add(panel.getWrappedManifestation());
        for (Entry<Integer, Panel> entry : renderedPanels.entrySet()) {
            Panel panel = entry.getValue();
            View wrappedManifestation = panel.getWrappedManifestation();
            if (wrappedManifestation instanceof CanvasManifestation) {
                ((CanvasManifestation) wrappedManifestation).addToSelectionCollection(manifestations);
            }
        }
    }
View Full Code Here

    public boolean hasSelectedManifestations() {
        if (!selectedPanels.isEmpty()) {
            return true;
        } // end if
        for (Entry<Integer, Panel> entry : renderedPanels.entrySet()) {
            Panel panel = entry.getValue();
            View wrappedManifestation = panel.getWrappedManifestation();           
            if (wrappedManifestation instanceof CanvasManifestation) {
                if (((CanvasManifestation) wrappedManifestation).hasSelectedManifestations()) {
                    return true;
                } // end if
            } else {
View Full Code Here

TOP

Related Classes of gov.nasa.arc.mct.canvas.panel.Panel

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.