[elvystrac] r1832 -

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Tue, 23 Feb 2010 16:01:49 +0100

Author: EvaV
Date: 2010-02-23 16:01:49 +0100 (Tue, 23 Feb 2010)
New Revision: 1832

Modified:
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java
Log:


Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   2010-02-23 15:01:49 UTC (rev 1832)
@@ -665,7 +665,7 @@
                                                
.setAllTypesPermittedButtonSelected(true);
                                
tabbedPane.getPropertiesManager().getDocumentTypes()
                                                .permitDocumentTypes();
-                               designArea.paintAllPositions();
+                               designArea.setLabels();
                        }
 
                }
@@ -1084,6 +1084,37 @@
                elvysHeight = absolute.getHeight();
 
        }
+       
+       /**
+        * Sets selection to all positions in the actual design area
+        * 
+        */
+       public void selectPositions() {
+               
+               for(int i = 0; i < objects.size(); ++i) {
+                       objects.get(i).setBorder();
+               }
+       }
+       
+       /**
+        * Sets labels for all position in the actual design area
+        */
+       public void setLabels() {
+       
+               MovingObjects newObjects = new MovingObjects();
+               for(int i = 0; i < objects.size(); ++i) {
+                       
+                       if(objects.get(i).getPosition().isSelected()) {
+                               MovingObject newObject = 
objects.get(i).getPosition().paint(designArea);
+                               newObjects.add(newObject);
+                       }
+                       else {
+                               newObjects.add(objects.get(i));
+                       }
+                       
+               }
+               objects = newObjects;
+       }
 
        /**
         * Paints all positions in the actual design area
@@ -1091,6 +1122,7 @@
         */
        public void paintAllPositions() {
                // paints positions
+               
                        designArea.removeAll();
 
                        Vector<Position> positions = layout.getLayoutPositions()
@@ -1101,6 +1133,7 @@
                                Position actualPosition = positions.get(i);
                                objects.add(actualPosition.paint(designArea));
                        }
+               
        }
 
        /**

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   2010-02-23 15:01:49 UTC (rev 1832)
@@ -139,22 +139,25 @@
                newDesignArea.setTabbedPane(this);
        }
 
-       /**
+       /*
         * Finds whatever layout at the given tab is saved 
         * @param layoutTabID id of the tab
         * @return whatever layout at the give tab is saved
-        */
+        *
        public boolean isLayoutAtSaved(int layoutTabID) {
                Tab tab = (Tab)this.getComponentAt(layoutTabID);
                return tab.getDesignArea().isSaved();
-       }
+       }*/
 
        /**
         * Finds whatever layout at actual design area is saved 
         * @return whatever layout at actual design area is saved
         */
        public boolean isActualLayoutSaved() {
-               return ((Tab) 
this.getSelectedComponent()).getDesignArea().isSaved();
+               if(getActualDesignArea() == null) {
+                       return false;
+               }
+               return getActualDesignArea().isSaved();
        }
 
        /**
@@ -164,22 +167,27 @@
        public Tab getActualTab() {
                return ((Tab) this.getSelectedComponent());
        }
-       /**
+       /*
         * Gets name of the layout at the given tab
         * @param layoutTabID id of the tab
         * @return name of the layout at the given tab
-        */
+        *
        public String getLayoutNameAt(int layoutTabID) {
+               
                return ((Tab) this.getComponentAt(layoutTabID)).getDesignArea()
                                .getMyLayout().getName();
-       }
+       }*/
 
        /**
         * Gets name of the layout at the actual design area
         * @return name of the layout at the actual design area
         */
        public String getActualLayoutName() {
-               return ((Tab) this.getSelectedComponent()).getDesignArea()
+               if(getActualDesignArea() == null) {
+                       return "";
+               }
+               
+               return getActualDesignArea()
                                .getMyLayout().getName();
        }
 
@@ -194,14 +202,14 @@
                return getActualTab().getDesignArea();
        }
 
-       /**
+       /*
         * Gets design area at the given tab
         * @param layoutTabID id of the tab
         * @return design area at the given tab
-        */
+        *
        public DesignArea getDesignAreaAt(int layoutTabID) {
                return ((Tab) this.getComponentAt(layoutTabID)).getDesignArea();
-       }
+       }*/
 
        
        /**
@@ -235,7 +243,7 @@
                        this.getMenuBar().actualize();
                        //designArea.paintAllPositions();
 
-                       int layoutCount = getTabCount();
+                       /*int layoutCount = getTabCount();
                        // setSelectedIndex(0);
                        for (int i = 0; i < layoutCount; ++i) {
                                DesignArea actual = ((Tab) 
(getComponentAt(i))).getDesignArea();
@@ -250,7 +258,7 @@
                                TabbedPaneCloseTabButton buttonTab = 
(TabbedPaneCloseTabButton) getTabComponentAt(i);
                                buttonTab.setNewTabTitle(layoutName);
 
-                       }
+                       }*/
                        
                        this.getMenuBar().setCursor(new 
Cursor(Cursor.WAIT_CURSOR));
                }

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
    2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
    2010-02-23 15:01:49 UTC (rev 1832)
@@ -384,11 +384,11 @@
 
                backwardButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
+                               DesignArea selectedDesignArea = 
tabbedPane.getActualDesignArea();
                                ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
                                                .getActionMemory();
                                
selectedDesignAreaActionMemory.backwardAction(selectedDesignArea);
+                               
 
                        }
                });
@@ -399,12 +399,12 @@
                forwardButton.setEnabled(false);
                forwardButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
+                               DesignArea selectedDesignArea = 
tabbedPane.getActualDesignArea();
                                ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
                                                .getActionMemory();
                                selectedDesignAreaActionMemory
                                                
.forwardAction(selectedDesignArea);
+                               
 
                        }
                });
@@ -417,6 +417,7 @@
                            DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.setSameTopCoordinate(designArea);
+                           
                        }
                });
 
@@ -430,6 +431,7 @@
                                DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.setSameBottomCoordinate(designArea);
+                           
                        }
                });
 
@@ -442,6 +444,7 @@
                                DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.setSameLeftCoordinate(designArea);
+                           
                        }
                });
 
@@ -455,6 +458,7 @@
                                DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.setSameRightCoordinate(designArea);
+                           
                        }
                });
 
@@ -468,6 +472,7 @@
                                DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.centerHorizontal(designArea);
+                           
                        }
                });
 
@@ -481,6 +486,7 @@
                                DesignArea designArea = 
tabbedPane.getActualDesignArea();
                            Layout layout = designArea.getMyLayout();
                            layout.centerVertical(designArea);
+                           
                        }
                });
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
 2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
 2010-02-23 15:01:49 UTC (rev 1832)
@@ -146,13 +146,14 @@
                        newPosition.setPermittedDocumentTypes(permitted);
                        
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
                                        oldPosition, designArea, 
Layout.AddType.DESIGN, false);
+                       designArea.setLabels();
                        
                        if(positions.isAtLeastOneDocumentTypePermitted()) {
                                
designArea.getMyLayout().addActionToActionsMemory(
                                        designArea);
 
                        }
-                       designArea.paintAllPositions();
+                       
 
                } else {
                        for (int i = 0; i < positions.getPositions().size(); 
++i) {
@@ -174,13 +175,14 @@
                                
newPosition.setPermittedDocumentTypes(permitted);
                                
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
                                                oldPosition, designArea, 
Layout.AddType.DESIGN, false);
+                               designArea.setLabels();
 
-                               designArea.repaint();
                        }
                        if (positions.isAtLeastOneDocumentTypePermitted()) {
                                
designArea.getActionMemory().addActionToActionsMemory(designArea);
                        }
                }
+               
        }
 
        /**

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
 2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
 2010-02-23 15:01:49 UTC (rev 1832)
@@ -185,7 +185,7 @@
                Position position = layout.getLayoutPositions().getPosition(id);
                
                position.selectPosition(e.isControlDown(), designArea);
-               designArea.paintAllPositions();
+               designArea.selectPositions();
                
                tabbedPane.getPropertiesManager().actualizeAll();
                

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java   
    2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java   
    2010-02-23 15:01:49 UTC (rev 1832)
@@ -129,7 +129,9 @@
                }
 
                for (int i = 0; i < positions.size(); ++i) {
-                       positions.get(i).setSelected(false);
+                       Position position = positions.get(i);
+                       position.setSelected(false);
+                       
designArea.getObjects().getObject(position.getId()).setPosition(position);
                }
 
                
designArea.getTabbedPane().getPropertiesManager().actualizeAll();
@@ -138,7 +140,7 @@
                        addActionToActionsMemory(designArea);
                }
 
-               designArea.paintAllPositions();
+               designArea.selectPositions();
        }
 
        /**
@@ -562,7 +564,7 @@
 
                        tabbedPane.getPropertiesManager().actualizeAll();
                        
addActionToActionsMemory(tabbedPane.getActualDesignArea());
-                       tabbedPane.getActualDesignArea().paintAllPositions();
+                       tabbedPane.getActualDesignArea().selectPositions();
                        
tabbedPane.getToolBar().setEnabledForCenterAndAlignButtons(true);
                }
        }
@@ -623,7 +625,10 @@
                                        this.isInformedThatIsEditing = true;
                                }
                        }
+                       
 
+                       
designArea.getObjects().getObject(position.getId()).setPosition(position);
+
                        if (designArea.isSaved()) {
                                TabbedPane tabbedPane = 
designArea.getTabbedPane();
                                
tabbedPane.changeActualTitleToNotSavedTitle(designArea
@@ -633,7 +638,7 @@
 
                }
 
-               designArea.paintAllPositions();
+               //designArea.paintAllPositions();
        }
 
        /**

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
 2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
 2010-02-23 15:01:49 UTC (rev 1832)
@@ -76,6 +76,8 @@
        /** instance of this MovingObject */
        private Positions oldPositions;
        /** position before action */
+       private Label label;
+       /** label of this position */
 
        // constants
        private final static Color BORDER_LABEL_COLOR = Color.black;
@@ -85,9 +87,8 @@
        private final static int SELECTED_POSITION_BORDER_SIZE = 2;
        /** size of selected position border */
        private final static int POSITION_BORDER_SIZE = 1;
-
        /** size of position border */
-
+       
        /**
         * Label of position - with position id and permitted document types
         */
@@ -170,6 +171,8 @@
         */
        public void writeDocumentIDandPermittedTypesOfDocuments() {
 
+               
+               
                Vector<String> permittedTypesOfDocuments = position
                                
.getPermittedDocumentTypes().getPermittedDocumentTypes();
 
@@ -204,16 +207,24 @@
                }
                labelName = "<html><p><b>" + id + " </b><align>" + labelName
                                + "</align></p></html>";
-               Label typeLabel = new Label(labelName);
-               add(typeLabel);
-               Font font = new Font("NewRoman", Font.PLAIN, 10);
-               typeLabel.setFont(font);
-               typeLabel.setForeground(BORDER_LABEL_COLOR);
-               typeLabel.setHorizontalAlignment(SwingConstants.LEFT);
-               typeLabel.setVerticalAlignment(SwingConstants.TOP);
+               
 
-               typeLabel.setBounds(insets.left + 1, insets.right + 1,
+               System.out.println(labelName);
+               
+               if(label == null ) {
+                       label = new Label(labelName);
+                       instance.add(label);
+               
+                       Font font = new Font("NewRoman", Font.PLAIN, 10);
+                       label.setFont(font);
+                       label.setForeground(BORDER_LABEL_COLOR);
+                       label.setHorizontalAlignment(SwingConstants.LEFT);
+                       label.setVerticalAlignment(SwingConstants.TOP);
+
+                       label.setBounds(insets.left + 1, insets.right + 1,
                                monitorWidth - 2, monitorHeight - 2);
+               }
+               
 
        }
 
@@ -651,8 +662,8 @@
        /**
         * Empty constructor of class MovingObject
         */
-       //public MovingObject() {
-       //}
+       public MovingObject() {
+       }
 
        /**
         * Constructor of the class Moving object
@@ -669,6 +680,7 @@
 
                this.instance = this;
                this.designArea = _designArea;
+               this.label = null;
 
                if(monitor != null ) {
                        this.monitorTopX = monitor.getTopX();

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
        2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
        2010-02-23 15:01:49 UTC (rev 1832)
@@ -11,7 +11,7 @@
  */
 public class MovingObjects {
 
-       // fields
+       // fieldsnArea.
        private Vector<MovingObject> objects;   /** moving object */
 
        // methods

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java 
    2010-02-23 14:27:24 UTC (rev 1831)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java 
    2010-02-23 15:01:49 UTC (rev 1832)
@@ -208,7 +208,7 @@
                layout.setLayoutPositions(newPositions);
 
                
designArea.getTabbedPane().getPropertiesManager().actualizeAll();
-               designArea.paintAllPositions();
+               designArea.selectPositions();
 
        }
        
@@ -1436,7 +1436,7 @@
 
                AbsoluteCoordinates absol = getMonitor();
 
-               MovingObject object = new MovingObject(designArea, getId(), 
monitor);
+               MovingObject object = new MovingObject(designArea, id, monitor);
 
                object.setLocation(absol.getTopX(), absol.getTopY());
                object.setSize(absol.getWidth(), absol.getHeight());
@@ -1607,8 +1607,9 @@
         * @param isSelected is this position selected to set
         */
        public void setSelected(boolean isSelected) {
-               this.tabbedPane.getActualDesignArea().paintAllPositions();
+               
                this.isSelected = isSelected;
+               this.tabbedPane.getActualDesignArea().selectPositions();
        }
 
        /**


Other related posts:

  • » [elvystrac] r1832 - - elvys