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

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


    private void addToOrderedList(Map<Integer, Panel> panelMap) {
        LinkedList<Integer> keyList = new LinkedList<Integer>(panelMap.keySet());
        Collections.sort(keyList);
       
        for (Integer key : keyList) {
            Panel panel = panelMap.get(key);
            orderedListPanels.add(panel);
        }       
    }
View Full Code Here


        }       
    }

    @Override
    public Component getLastComponent(Container aContainer) {
        Panel panel = orderedListPanels.getLast();
        visitedPanels.add(panel);
        return panel;
    }
View Full Code Here

        return panel;
    }
   
    @Override
    public Component getFirstComponent(Container aContainer) {
        Panel panel = orderedListPanels.getFirst();
        visitedPanels.add(panel);
        return panel;
    }
View Full Code Here

        int index = orderedListPanels.indexOf(aComponent);
        if (index == 0) {
            KeyboardFocusManager.getCurrentKeyboardFocusManager().upFocusCycle(aContainer);
            return KeyboardFocusManager.getCurrentKeyboardFocusManager().getCurrentFocusCycleRoot();
        } else {
            Panel panel = orderedListPanels.get(index - 1);
            View wrappedManifestation = panel.getWrappedManifestation();
            if (wrappedManifestation.isFocusTraversalPolicyProvider()) {
                FocusTraversalPolicy focusTraversalPolicy = wrappedManifestation.getFocusTraversalPolicy();
                return focusTraversalPolicy.getLastComponent(wrappedManifestation);
            }
            visitedPanels.add(panel);
View Full Code Here

        int index = orderedListPanels.indexOf(aComponent);
        if (index == lastIndex) {
            KeyboardFocusManager.getCurrentKeyboardFocusManager().upFocusCycle(aContainer);
            return KeyboardFocusManager.getCurrentKeyboardFocusManager().getCurrentFocusCycleRoot();
        } else {
            Panel panel = orderedListPanels.get(index + 1);
            visitedPanels.add(panel);
            return panel;
        }
    }
View Full Code Here

    public static void notifyAlignLeftSelected(List<Panel> selectedPanels) {
        int leftMostX = selectedPanels.get(0).getBounds().x;

        int numOfPanels = selectedPanels.size();
        for (int i = 1; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldx = bound.getLocation().x;

            if (oldx < leftMostX) {
                leftMostX = oldx;
            }
        }

        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            int oldy = bound.getLocation().y;
            int width = bound.getSize().width;
            int height = bound.getSize().height;

            panel.setBounds(leftMostX, oldy, width, height);
        }
    }
View Full Code Here

        int rightMostX = firstBound.x;

        int numOfPanels = selectedPanels.size();

        for (int i = 0; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldx = bound.x;
            int width = bound.width;
            if (oldx < leftMostX)
                leftMostX = oldx;
            if (oldx + width > rightMostX)
                rightMostX = oldx + width;
        }
        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            //
            // Algorithm: the bounding box is determined by finding the
            // rightmost edge
            // along with the left most edge. The difference between
            // these two points is the area lengthwise of the bounding box.
            //
            // distance = rightMostX - leftMostX;
            //
            // Thus, the center of the bounding area would be the would
            // be the x position that is midway between the bounding length
            // added to the leftmost edge:
            //           
            // midwayPoint = leftMostX + (distance / 2);
            //
            // So, to center align each box in the bounding box, find that
            // component's midway point (x pos + (width / 2)).
            // move that component such that it's midway
            // point is equal to the bounding box midway point. Thus,
            // all items are aligned.

            int midwayPoint = leftMostX + ((rightMostX - leftMostX) / 2);
            int componentMidwayPoint = bound.x + (bound.width / 2);

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

    public static void notifyAlignRightSelected(List<Panel> selectedPanels) {
        int rightMostX = selectedPanels.get(0).getBounds().x+selectedPanels.get(0).getBounds().width;

        int numOfPanels = selectedPanels.size();
        for (int i = 1; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldx = bound.x;
            int width = bound.width;

            if (oldx + width > rightMostX)
                rightMostX = oldx + width;
        }

        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            int width = bound.width;
            panel.setBounds(rightMostX - width, bound.y, width, bound.height);
        }
    }
View Full Code Here

    public static void notifyAlignTopSelected(List<Panel> selectedPanels) {
        int topMostY = selectedPanels.get(0).getBounds().y;

        int numOfPanels = selectedPanels.size();
        for (int i = 1; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldy = bound.y;

            if (oldy < topMostY)
                topMostY = oldy;
        }

        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            panel.setBounds(bound.x, topMostY, bound.width, bound.height);
        }
    }
View Full Code Here

    public static void notifyAlignBottomSelected(List<Panel> selectedPanels) {
        int bottomMostY = selectedPanels.get(0).getBounds().y+selectedPanels.get(0).getBounds().height;

        int numOfPanels = selectedPanels.size();
        for (int i = 1; i < numOfPanels; i++) {
            Panel panel = selectedPanels.get(i);
            Rectangle bound = panel.getBounds();
            int oldy = bound.y;
            int height = bound.height;

            if (oldy + height > bottomMostY)
                bottomMostY = oldy + height;
        }

        for (Panel panel : selectedPanels) {
            Rectangle bound = panel.getBounds();
            int height = bound.height;
            panel.setBounds(bound.x, bottomMostY - height, bound.width, height);
        }
    }
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.