[elvystrac] r1813 - rozdeleni do package, uprava vykonu, snap to grid - snapne ve smeru pohybu

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Mon, 22 Feb 2010 03:30:04 +0100

Author: EvaV
Date: 2010-02-22 03:30:04 +0100 (Mon, 22 Feb 2010)
New Revision: 1813

Added:
   trunk/layouteditor/LayoutDesigner/src/com/
   trunk/layouteditor/LayoutDesigner/src/com/elvys/
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ComponentSizes.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/Icons.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/PopupMenu.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/StatusBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveAsDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/UnsavedLayoutClosedDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/WarningDialog.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/
   
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/propertiesManager/PropertiesManager.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManagerTabCloseButton.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesTable.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/Marshaller.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
Removed:
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ComponentSizes.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DesignArea.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DocumentTypes.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Icons.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/LayoutDesigner.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Marshaller.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MenuBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PopupMenu.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PositionsList.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManager.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManagerTabCloseButton.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesTable.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ReadLayoutFromServer.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ResolutionChoiceDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveAsDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveLayoutOnServer.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ServerSideContext.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/StatusBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPane.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPaneCloseTabButton.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ToolBar.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/UnsavedLayoutClosedDialog.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/WarningDialog.java
Modified:
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/AbsoluteCoordinates.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ActionsMemory.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Corners.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Grid.java
   trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PermittedDocumentTypes.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Positions.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/RelativeCoordinates.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ScreenResolution.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolution.java
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolutions.java
Log:
rozdeleni do package, uprava vykonu, snap to grid - snapne ve smeru pohybu

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ComponentSizes.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/ComponentSizes.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ComponentSizes.java
                               (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ComponentSizes.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,151 @@
+package com.elvys.applet.components;
+
+/**
+ * ComponentSizes.java
+ * @author EvaV
+ */
+import java.awt.Dimension;
+
+/**
+ * ComponentSizes manages sizes of the components 
+ *
+ */
+public class ComponentSizes {
+       
+       // fields
+       private Dimension applet;                                       /** 
sizes of whole applet */
+       private Dimension tabbedPane;                           /** sizes of 
tabbed pane */
+       private Dimension designArea;                           /** sizes of 
design area */
+       private Dimension menuBar;                                      /** 
sizes of menu bar */
+       private Dimension statusBar;                            /** sizes of 
status bar */      
+       private Dimension toolBar;                                      /** 
sizes of tool bar */
+       private Dimension propertiesManager;            /** sizes of properties 
manager */
+       
+       // constructors
+       /**
+        * Empty constructor of class ComponentSizes
+        */
+       public ComponentSizes() {
+               applet = new Dimension(0, 0);
+               tabbedPane = new Dimension(0, 0);
+               designArea = new Dimension(0, 0);
+               menuBar = new Dimension(0, 0);
+               statusBar = new Dimension(0, 0);
+               toolBar = new Dimension(0, 0);
+               propertiesManager = new Dimension(0, 0);
+       }
+       
+       // getters & setters
+       /**
+        * Setter of field applet
+        * @param applet the applet to set
+        */
+       public void setApplet(Dimension applet) {
+               this.applet = applet;
+       }
+       
+       /**
+        * Getter of field applet
+        * @return the applet
+        */
+       public Dimension getApplet() {
+               return applet;
+       }
+       
+       /**
+        * Setter of field tabbedPane
+        * @param tabbedPane the tabbedPane to set
+        */
+       public void setTabbedPane(Dimension tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+       
+       /**
+        * Getter of field tabbedPane
+        * @return the tabbedPane
+        */
+       public Dimension getTabbedPane() {
+               return tabbedPane;
+       }
+       
+       /**
+        * Setter of field statusBar
+        * @param statusBar the statusBar to set
+        */
+       public void setStatusBar(Dimension statusBar) {
+               this.statusBar = statusBar;
+       }
+       
+       /**
+        * Getter of field statusBar
+        * @return the statusBar
+        */
+       public Dimension getStatusBar() {
+               return statusBar;
+       }
+       
+       /**
+        * Setter of field propertiesManager
+        * @param propertiesManager the propertiesManager to set
+        */
+       public void setPropertiesManager(Dimension propertiesManager) {
+               this.propertiesManager = propertiesManager;
+       }
+       
+       /**
+        * Getter of field propertiesManager
+        * @return the propertiesManager
+        */
+       public Dimension getPropertiesManager() {
+               return propertiesManager;
+       }
+
+       /**
+        * Setter of field designArea
+        * @param designArea the designArea to set
+        */
+       public void setDesignArea(Dimension designArea) {
+               this.designArea = designArea;
+       }
+
+       /**
+        * Getter of field designArea
+        * @return the designArea
+        */
+       public Dimension getDesignArea() {
+               return designArea;
+       }
+
+       /**
+        * Setter of field toolBar
+        * @param toolBar the toolBar to set
+        */
+       public void setToolBar(Dimension toolBar) {
+               this.toolBar = toolBar;
+       }
+
+       /**
+        * Getter of field toolBar
+        * @return the toolBar
+        */
+       public Dimension getToolBar() {
+               return toolBar;
+       }
+
+       /**
+        * Setter of field menuBar
+        * @param menuBar the menuBar to set
+        */
+       public void setMenuBar(Dimension menuBar) {
+               this.menuBar = menuBar;
+       }
+
+       /**
+        * Getter of field menuBar
+        * @return the menuBar
+        */
+       public Dimension getMenuBar() {
+               return menuBar;
+       }
+       
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
 (from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/DesignArea.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
                           (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,1404 @@
+package com.elvys.applet.components;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Graphics;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.border.LineBorder;
+
+import com.elvys.applet.dialog.WarningDialog;
+import com.elvys.applet.structures.AbsoluteCoordinates;
+import com.elvys.applet.structures.ActionsMemory;
+import com.elvys.applet.structures.Grid;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.MovingObject;
+import com.elvys.applet.structures.MovingObjects;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.ScreenResolution;
+import com.elvys.applet.structures.Layout.AddType;
+import com.elvys.applet.structures.Position.IsSnappedToGrid;
+
+/**
+ * DesignArea displays positions of documents
+ * 
+ * @author EvaV
+ */
+@SuppressWarnings("serial")
+public class DesignArea extends JPanel {
+       // fields
+       private int id = 0;
+       /** id of the newly designed position */
+
+       private int monitorTopX = 0;
+       /** topX coordinate of actually designed position on monitor */
+       private int monitorTopY = 0;
+       /** topY coordinate of actually designed position on monitor */
+       private int monitorWidth = 0;
+       /** width of actually designed position on monitor */
+       private int monitorHeight = 0;
+       /** height of actually designed position on monitor */
+
+       private int elvysTopX = 0;
+       /** topX coordinate of actually designed position on elvys */
+       private int elvysTopY = 0;
+       /** topY coordinate of actually designed position on elvys */
+       private int elvysWidth = 0;
+       /** width of actually designed position on elvys */
+       private int elvysHeight = 0;
+       /** height of actually designed position on elvys */
+
+       private int monitorStartX = 0;
+       /**
+        * x coordinate on monitor of mouse position when designing of position
+        * started
+        */
+       private int monitorActualX = 0;
+       /** x coordinate on monitor of the actual mouse position */
+       private int monitorStartY = 0;
+       /**
+        * y coordinate on monitor of mouse position when designing of position
+        * started
+        */
+       private int monitorActualY = 0;
+       /** y coordinate on monitor of the actual mouse position */
+
+       private int elvysStartX = 0;
+       /**
+        * x coordinate on elvys of mouse position when designing of position
+        * started
+        */
+       private int elvysActualX = 0;
+       /** x coordinate on elvys of the actual mouse position */
+       private int elvysStartY = 0;
+       /**
+        * y coordinate on elvys of mouse position when designing of position
+        * started
+        */
+       private int elvysActualY = 0;
+       /** y coordinate on elvys of the actual mouse position */
+
+       private int pasteTopX = 0;
+       /** topX coordinate of location where copied positions will be pasted */
+       private int pasteTopY = 0;
+       /** topY coordinate of location where copied positions will be pasted */
+
+       private Layout layout;
+       /** actual layout */
+       private Positions positionsToPaste;
+       /** copied positions */
+       private PopupMenu popupMenu;
+       /** popup menu */
+       private Position oldPosition;
+       /** old position */
+       private ActionsMemory actionMemory;
+       /** backward and forward actions */
+       private TabbedPane tabbedPane;
+       /** main tabbed pane */
+       private DesignArea designArea;
+       /** this design area */
+       private MovingObject object;
+       /** object corresponding to actually designed position */
+       private MovingObjects objects;
+       /** objects corresponding to all designed positions */
+       private int lastCorDesignAreaWidth = 0;
+       /** last correct width of design area */
+       private int lastCorDesignAreaHeight = 0;
+       /** last correct height of design area */
+
+       // flags
+
+       private boolean showSelectRectangle;
+       /**
+        * flag whatever to show select rectangle and allow selection of 
positions
+        * with it
+        */
+       private boolean isSaved = true;
+       /** flag whatever layout for this design area is saved */
+       private boolean hasNeverBeenSaved = true;
+       /** flag whatever layout for this design area has ever been saved */
+       private boolean isNotDesigning = true;
+       /** flag whatever user is designing position */
+       private boolean isInDesignMode = false;
+       /**
+        * flag whatever applet is in design mode - it is allowed to design 
position
+        */
+       private boolean isNotMoving = true;
+       /** flag whatever user is moving or resizing position */
+       private boolean isResizable = false;
+       /** flag whatever it is allowed to resize design area */
+       private boolean arePositionToPaste = false;
+       /** flag whatever there are position in clipboard to paste */
+       private boolean isShowGridEnabled = false;
+       /** flag whatever to show grid */
+       private boolean isSnapToGridEnabled = false;
+       /** flag whatever snap to grid of positions is enabled */
+
+       // constants
+       private final static int RESIZABLE_AREA_SIZE = 20;
+       /**
+        * size of area in bottom right corner of design area where design area 
is
+        * resizable
+        */
+       private final static int TABBED_PANE_X_BORDER = 5;
+       /** size of x border of tabbed pane */
+       private final static int TABBED_PANE_Y_BORDER = 32;
+       /** size of y border of tabbed pane */
+       private final static int TAB_CAT_PANEL_WIDTH_ELVYS = 200;
+       /** width of panel with tabs and categories */
+
+
+
+       // constructors
+       /**
+        * Constructor of the class DesignArea
+        * 
+        * @param tabbedPane
+        *            main tabbed pane
+        * @param layout
+        *            actual layout
+        */
+       public DesignArea(TabbedPane tabbedPane, Layout layout) {
+
+               this.actionMemory = new ActionsMemory();
+               this.tabbedPane = tabbedPane;
+
+               if (tabbedPane == null) {
+                       return;
+               }
+
+               this.layout = layout;
+               this.designArea = this;
+               
+               designArea.paintAllPositions();
+
+               this.arePositionToPaste = false;
+               this.isInDesignMode = false;
+               designArea.setBorder(new LineBorder(Color.black));
+
+               this.id = layout.getLayoutPositions().size();
+
+               designArea.setLayout(null);
+
+               // design are is focusable
+               this.setFocusable(true);
+               this.requestFocusInWindow(true);
+
+               // adds first empty layout to actions memory
+               actionMemory.addAction(designArea, layout.clone());
+
+               // adds popup menu
+               popupMenu = new PopupMenu(designArea, 
tabbedPane.getProperties());
+               MouseListener popupListener = popupMenu.new 
PopupListener(popupMenu);
+               addMouseListener(popupListener);
+
+               // adds key listener
+               addKeyListener(new KeyAdapter() {
+                       public void keyPressed(KeyEvent e) {
+                               designAreaKeyPressed(e);
+                       }
+               });
+
+               // adds mouse listener
+               addMouseListener(new MouseAdapter() {
+                       public void mouseClicked(MouseEvent e) {
+                               designAreaMouseClicked(e);
+                       }
+
+                       public void mousePressed(MouseEvent e) {
+                               startDesignPosition(e);
+                       }
+
+                       public void mouseReleased(MouseEvent e) {
+                               endDesignPosition(e);
+                       }
+
+               });
+
+               // adds mouse motion listener
+               addMouseMotionListener(new MouseAdapter() {
+                       @Override
+                       public void mouseDragged(MouseEvent e) {
+                               continueDesignPosition(e);
+                       }
+
+                       public void mouseMoved(MouseEvent e) {
+                               designAreaMouseMoved(e);
+                       }
+               });
+
+       }
+
+       // methods
+
+       /**
+        * Generates x coordinate on elvys from x coordinate on monitor
+        * 
+        * @param monitorX
+        *            x coordinate on monitor
+        * @return x coordinate on elvys
+        */
+       public int getElvysX(int monitorX) {
+
+               if (layout == null) {
+                       return monitorX;
+               }
+
+               int monitorWidth = 
layout.getScreenResolution().getMonitorWidth();
+               int elvysWidth = layout.getScreenResolution().getElvysWidth();
+
+               if (monitorWidth == 0) {
+                       return monitorX;
+               }
+
+               return (int) Math
+                               .round((double) (monitorX * elvysWidth / 
monitorWidth));
+
+       }
+
+       /**
+        * Generates y coordinate on elvys from y coordinate on monitor
+        * 
+        * @param monitorY
+        *            y coordinate on monitor
+        * @return y coordinate on elvys
+        */
+       public int getElvysY(int monitorY) {
+
+               if (layout == null) {
+                       return monitorY;
+               }
+
+               int monitorHeight = 
layout.getScreenResolution().getMonitorHeight();
+               int elvysHeight = layout.getScreenResolution().getElvysHeight();
+
+               if (monitorHeight == 0) {
+                       return monitorY;
+               }
+
+               return (int) Math
+                               .round((double) monitorY * elvysHeight / 
monitorHeight);
+
+       }
+
+       /**
+        * Decides whatever this mouse location is in the design area
+        * 
+        * @param x
+        *            x coordinate of the given mouse location
+        * @param y
+        *            y coordinate of the given mouse location
+        * @return whatever this location is in the design area
+        */
+       private boolean isInDesignArea(int x, int y) {
+               int height = designArea.getHeight();
+               int width = designArea.getWidth();
+
+               if (x < 0 || y < 0 || x > width || y > height) {
+                       return false;
+               }
+               return true;
+       }
+
+       /**
+        * Actualizes cursor shape according to the actual mouse position
+        * 
+        * @param x
+        *            x coordinate of the actual mouse position
+        * @param y
+        *            y coordinate of the actual mouse position
+        */
+       public void actualizeCursor(int x, int y) {
+
+               if (!isInDesignArea(x, y)) {
+                       designArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+               } else if (isInResizableArea(x, y) && !isInDesignMode) {
+                       designArea.setCursor(new 
Cursor(Cursor.SE_RESIZE_CURSOR));
+               } else if (isInDesignMode) {
+                       designArea.setCursor(new 
Cursor(Cursor.CROSSHAIR_CURSOR));
+               } else {
+                       designArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
+               }
+       }
+
+       /**
+        * Gets width of the design area
+        * 
+        * @return width of design area
+        */
+       public int getWidth() {
+               ScreenResolution screenSizes = layout.getScreenResolution();
+               return screenSizes.getMonitorWidth();
+       }
+
+       /**
+        * Gets height of the design area
+        * 
+        * @return height of design area
+        */
+       public int getHeight() {
+               ScreenResolution screenSizes = layout.getScreenResolution();
+               return screenSizes.getMonitorHeight();
+       }
+
+       /**
+        * Performs action according to the pressed key resizes, moves, copies,
+        * pastes or deletes selected positions - if user pressed keys at the 
design
+        * area
+        * 
+        * @param e
+        *            key event
+        */
+       public void designAreaKeyPressed(KeyEvent e) {
+               int deltaTopX = 0;
+               int deltaTopY = 0;
+               int deltaWidth = 0;
+               int deltaHeight = 0;
+
+               int KEY_MOVE_SIZE_X = 1;
+               int KEY_MOVE_SIZE_Y = 1;
+               if (isSnapToGridEnabled()) {
+                       Grid grid = new Grid(designArea);
+                       KEY_MOVE_SIZE_X = grid.getKioskGridXSize();
+                       KEY_MOVE_SIZE_Y = grid.getKioskGridYSize();
+               }
+
+               int keyCode = e.getKeyCode();
+               Layout.AddType addType;
+
+               Properties properties = tabbedPane.getProperties();
+               // if Alt is down, position is resized
+               if (e.isAltDown()) {
+                       addType = Layout.AddType.RESIZE;
+                       switch (keyCode) {
+                       case KeyEvent.VK_DOWN:
+                               deltaHeight = KEY_MOVE_SIZE_Y;
+                               break;
+                       case KeyEvent.VK_UP:
+                               deltaTopY = -KEY_MOVE_SIZE_Y;
+                               deltaHeight = KEY_MOVE_SIZE_Y;
+                               break;
+                       case KeyEvent.VK_LEFT:
+                               deltaTopX = -KEY_MOVE_SIZE_X;
+                               deltaWidth = KEY_MOVE_SIZE_X;
+                               break;
+                       case KeyEvent.VK_RIGHT:
+                               deltaWidth = KEY_MOVE_SIZE_X;
+                               break;
+                       }
+                       layout.moveOrResizePositionsWithKeyboard(designArea, 
deltaTopX,
+                                       deltaTopY, deltaWidth, deltaHeight, 
addType);
+               }
+
+               // if Ctrl is down, position is copied or pasted
+               else if (e.isControlDown()) {
+
+                       switch (keyCode) {
+                       // Ctrl + C
+                       case KeyEvent.VK_C:
+                               PopupMenu menu = new PopupMenu(designArea, 
properties);
+                               menu = new PopupMenu(designArea, properties);
+                               menu.copy(designArea);
+                               break;
+                       // Ctrl + V
+                       case KeyEvent.VK_V:
+                               addType = Layout.AddType.PASTE;
+                               menu = new PopupMenu(designArea, properties);
+                               menu.paste(designArea, pasteTopX, pasteTopY);
+                               break;
+
+                       case KeyEvent.VK_Z:
+                               actionMemory.backwardAction(designArea);
+                               break;
+                       case KeyEvent.VK_Y:
+                               actionMemory.forwardAction(designArea);
+                               break;
+                       }
+
+               }
+
+               // if Delete is pushed, position is deleted
+               else if (keyCode == KeyEvent.VK_DELETE) {
+                       PopupMenu menu = new PopupMenu(designArea, properties);
+                       menu.delete(designArea);
+               }
+
+               // else is position moved
+               else {
+
+                       addType = Layout.AddType.MOVE;
+                       switch (keyCode) {
+
+                       case KeyEvent.VK_DOWN:
+                               deltaTopY = KEY_MOVE_SIZE_Y;
+                               break;
+                       case KeyEvent.VK_UP:
+                               deltaTopY = -KEY_MOVE_SIZE_Y;
+                               break;
+                       case KeyEvent.VK_LEFT:
+                               deltaTopX = -KEY_MOVE_SIZE_X;
+                               break;
+                       case KeyEvent.VK_RIGHT:
+                               deltaTopX = KEY_MOVE_SIZE_X;
+                               break;
+                       }
+                       layout.moveOrResizePositionsWithKeyboard(designArea, 
deltaTopX,
+                                       deltaTopY, deltaWidth, deltaHeight, 
addType);
+
+               }
+
+       }
+
+       /**
+        * Deselects all positions and actualizes mouse cursor - if user 
clicked on
+        * the design area
+        * 
+        * @param e
+        *            mouse event
+        */
+       private void designAreaMouseClicked(MouseEvent e) {
+
+               layout.deselectAllPositions(designArea);
+               designArea.requestFocusInWindow();
+
+               actualizeCursor(e.getX(), e.getY());
+       }
+
+       /**
+        * Starts designing of the new position - if LayoutDesigner is in design
+        * mode and user pressed left mouse button in the design area Starts
+        * selecting of positions with select rectangle - if LayoutDesigner 
isn't in
+        * design mode and user pressed left mouse button in the design area
+        * 
+        * @param e
+        *            mouse event
+        */
+       private void startDesignPosition(MouseEvent e) {
+
+               if (e.isPopupTrigger()) {
+                       return;
+               }
+
+               // wasn't pressed left mouse button
+               if (e.getButton() != MouseEvent.BUTTON1) {
+                       return;
+               }
+
+               setNotDesigning(false);
+               setIsNotMoving(true);
+               designArea.requestFocusInWindow();
+
+               // is in design mode
+               if (isInDesignMode) {
+
+                       id = layout.getLayoutPositions().getPositions().size();
+                       ++id;
+
+                       oldPosition = new Position(tabbedPane);
+
+                       monitorStartX = e.getX();
+                       monitorStartY = e.getY();
+
+                       if (!isInDesignArea(monitorStartX, monitorStartY)) {
+                               monitorStartX = 0;
+                               monitorStartY = 0;
+                               elvysStartX = 0;
+                               elvysStartY = 0;
+                               return;
+                       }
+
+                       if (isSnapToGridEnabled) {
+                               Grid grid = new Grid(monitorStartX, 
monitorStartY);
+                               grid.snapToGridMonitorCoordinates(designArea);
+                               monitorStartX = grid.getX();
+                               monitorStartY = grid.getY();
+                               grid = new Grid(designArea);
+                               grid.snapElvysFromMonitorToGrid(monitorStartX, 
monitorStartY,
+                                               designArea);
+                               elvysStartX = grid.getX();
+                               elvysStartY = grid.getY();
+
+                       } else {
+                               elvysStartX = getElvysX(monitorStartX);
+                               elvysStartY = getElvysY(monitorStartY);
+                       }
+
+                       monitorTopX = monitorStartX;
+                       monitorTopY = monitorStartY;
+
+                       elvysTopX = elvysStartX;
+                       elvysTopY = elvysStartY;
+
+                       Position newPosition = new Position(tabbedPane);
+
+                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
+                                       monitorTopY, monitorWidth, 
monitorHeight));
+                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX, 
elvysTopY,
+                                       elvysWidth, elvysHeight));
+                       newPosition.setId(id);
+                       Position.IsSnappedToGrid snapped = 
newPosition.isSnappedToGrid();
+                       snapped.setHeight(designArea.isSnapToGridEnabled());
+                       snapped.setWidth(designArea.isSnapToGridEnabled());
+                       snapped.setTopX(designArea.isSnapToGridEnabled());
+                       snapped.setTopY(designArea.isSnapToGridEnabled());
+                       newPosition.setSnappedToGrid(snapped);
+
+                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
+                                       newPosition, designArea, 
Layout.AddType.DESIGN, false);
+                       newPosition.selectPosition(e.isControlDown(), 
designArea);
+
+                       object = newPosition.paint(designArea); 
+                       objects.add(object);
+               }
+               // isn't in design mode
+               else {
+                       monitorStartX = e.getX();
+                       monitorStartY = e.getY();
+
+                       monitorTopX = monitorStartX;
+                       monitorTopY = monitorStartY;
+                       showSelectRectangle = true;
+
+                       isResizable = isInResizableArea(e.getX(), e.getY());
+                       lastCorDesignAreaWidth = designArea.getWidth();
+                       lastCorDesignAreaHeight = designArea.getHeight();
+
+               }
+               actualizeCursor(e.getX(), e.getY());
+       }
+
+       /**
+        * Actualizes status bar and checks whatever at least one type of 
document
+        * is selected for the actual position
+        * 
+        * @param e
+        *            mouse event
+        */
+       private void designAreaMouseMoved(MouseEvent e) {
+
+               pasteTopX = e.getX();
+               pasteTopY = e.getY();
+
+               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
+                               getElvysX(e.getX()), getElvysY(e.getY()));
+
+               isResizable = isInResizableArea(e.getX(), e.getY());
+
+               designArea.requestFocusInWindow();
+
+               Properties properties = tabbedPane.getProperties();
+               Positions positions = layout.getSelectedPositions();
+               if (positions.size() >= 1) {
+                       
tabbedPane.getPropertiesManager().actualizeDocumentTypes();
+                       if (!positions.isAtLeastOneDocumentTypePermitted()) {
+                               new WarningDialog(new JFrame(), properties
+                                               
.getProperty("warning.noneTypeOfDocumentSelected"),
+                                               
properties.getProperty("warning.warning"));
+                               
tabbedPane.getPropertiesManager().getDocumentTypes()
+                                               
.setAllTypesPermittedButtonEnabled(true);
+                               
tabbedPane.getPropertiesManager().getDocumentTypes()
+                                               
.setAllTypesPermittedButtonSelected(true);
+                               
tabbedPane.getPropertiesManager().getDocumentTypes()
+                                               .permitDocumentTypes();
+                               designArea.paintAllPositions();
+                       }
+
+               }
+
+               actualizeCursor(e.getX(), e.getY());
+       }
+
+       /**
+        * 
+        * Ends designing of the position - if LayoutDesigner is in design mode 
and
+        * user released left mouse button in the design area Selects positions 
in
+        * select rectangle - if LayoutDesigner isn't design mode and user 
released
+        * left mouse button in the design area
+        * 
+        * @param e
+        *            mouse event
+        */
+       private void endDesignPosition(MouseEvent e) {
+
+               if (e.isPopupTrigger()) {
+                       return;
+               }
+
+               // is in design mode
+               if (isInDesignMode) {
+
+                       monitorActualX = e.getX();
+                       monitorActualY = e.getY();
+
+                       if (isSnapToGridEnabled) {
+                               Grid grid = new Grid(monitorActualX, 
monitorActualY);
+                               grid.snapToGridMonitorCoordinates(designArea);
+                               monitorActualX = grid.getX();
+                               monitorActualY = grid.getY();
+                               grid = new Grid(designArea);
+                               grid.snapElvysFromMonitorToGrid(monitorActualX, 
monitorActualY,
+                                               designArea);
+                               elvysActualX = grid.getX();
+                               elvysActualY = grid.getY();
+
+                       } else {
+                               elvysActualX = getElvysX(monitorActualX);
+                               elvysActualY = getElvysY(monitorActualY);
+                       }
+
+                       changeCoordinatesAndProperties();
+
+                       Position newPosition = new Position(tabbedPane);
+                       newPosition.setId(id);
+                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX, 
elvysTopY,
+                                       elvysWidth, elvysHeight));
+                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
+                                       monitorTopY, monitorWidth, 
monitorHeight));
+
+                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
+                                       oldPosition, designArea, 
Layout.AddType.DESIGN, true);
+                       layout.addActionToActionsMemory(designArea);
+
+                       setNotDesigning(true);
+
+                       //designArea.remove(objects.getObject(id));
+                       //newPosition.paint(designArea);
+                       
+                       if(objects.getObject(id) != null ) {
+                               
objects.getObject(id).setLocation(newPosition.getMonitor().getTopX(), 
newPosition.getMonitor().getTopY());
+                               
objects.getObject(id).setSize(newPosition.getMonitor().getWidth(), 
newPosition.getMonitor().getHeight());
+                       }
+
+               }
+               // isn't in design mode
+               else {
+                       layout
+                                       
.selectPositionsInSelectRectangle(tabbedPane, monitorTopX,
+                                                       monitorTopY, 
monitorWidth, monitorHeight, e
+                                                                       
.isControlDown());
+                       showSelectRectangle = false;
+
+                       monitorActualX = e.getX();
+                       monitorActualY = e.getY();
+
+                       changeCoordinatesAndProperties();
+
+                       designArea.resizeDesignArea(e.getX(), e.getY(),
+                                       lastCorDesignAreaWidth, 
lastCorDesignAreaHeight);
+
+                       actualizeCursor(e.getX(), e.getY());
+               }
+               monitorTopX = 0;
+               monitorTopY = 0;
+               monitorWidth = 0;
+               monitorHeight = 0;
+               monitorStartX = 0;
+               monitorActualX = 0;
+               monitorStartY = 0;
+               monitorActualY = 0;
+
+               elvysTopX = 0;
+               elvysTopY = 0;
+               elvysWidth = 0;
+               elvysHeight = 0;
+               elvysStartX = 0;
+               elvysActualX = 0;
+               elvysStartY = 0;
+               elvysActualY = 0;
+
+               actualizeCursor(e.getX(), e.getY());
+
+               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
+                               e.getX(), e.getY());
+       }
+
+       /**
+        * Continues designing of the position - if LayoutDesigner is in design 
mode
+        * and user drags left mouse button in the design area Resizes design 
area -
+        * if LayoutDesigner isn't in design mode
+        * 
+        * @param e
+        *            mouse event
+        */
+       private void continueDesignPosition(MouseEvent e) {
+
+               if (e.isPopupTrigger()) {
+                       return;
+               }
+
+               // is in design mode
+               if (isInDesignMode) {
+
+                       monitorActualX = e.getX();
+                       monitorActualY = e.getY();
+
+                       if (isSnapToGridEnabled) {
+                               Grid grid = new Grid(monitorActualX, 
monitorActualY);
+                               grid.snapToGridMonitorCoordinates(designArea);
+                               monitorActualX = grid.getX();
+                               monitorActualY = grid.getY();
+                               grid = new Grid(designArea);
+                               grid.snapElvysFromMonitorToGrid(monitorActualX, 
monitorActualY,
+                                               designArea);
+                               elvysActualX = grid.getX();
+                               elvysActualY = grid.getY();
+
+                       } else {
+                               elvysActualX = getElvysX(monitorActualX);
+                               elvysActualY = getElvysY(monitorActualY);
+                       }
+
+                       Positions positions = layout.getLayoutPositions();
+
+                       int monitorOldTopX = monitorTopX;
+                       int monitorOldTopY = monitorTopY;
+                       int monitorOldWidth = monitorWidth;
+                       int monitorOldHeight = monitorHeight;
+
+                       int kiosekOldTopX = elvysTopX;
+                       int kiosekOldTopY = elvysTopY;
+                       int kiosekOldWidth = elvysWidth;
+                       int kiosekOldHeight = elvysHeight;
+
+                       changeCoordinatesAndProperties();
+
+                       Position newPosition = new Position(tabbedPane);
+                       newPosition.setId(id);
+                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
+                                       monitorTopY, monitorWidth, 
monitorHeight));
+                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX, 
elvysTopY,
+                                       elvysWidth, elvysHeight));
+
+                       if (!newPosition.isElvysOverlap(positions)) {
+                               oldPosition.setMonitor(new 
AbsoluteCoordinates(monitorOldTopX,
+                                               monitorOldTopY, 
monitorOldWidth, monitorOldHeight));
+                               oldPosition.setElvys(new 
AbsoluteCoordinates(kiosekOldTopX,
+                                               kiosekOldTopY, kiosekOldWidth, 
kiosekOldHeight));
+                       }
+
+                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
+                                       oldPosition, designArea, 
Layout.AddType.DESIGN, false);
+
+                       
objects.getObject(id).setLocation(newPosition.getMonitor().getTopX(), 
newPosition.getMonitor().getTopY());
+                       
objects.getObject(id).setSize(newPosition.getMonitor().getWidth(), 
newPosition.getMonitor().getHeight());
+
+                       
+                       //designArea.remove(objects.getObject(id));
+                       //newPosition.paint(designArea);
+               }
+
+               // resizes design area
+               else {
+                       monitorActualX = e.getX();
+                       monitorActualY = e.getY();
+
+                       changeCoordinatesAndProperties();
+                       designArea.resizeDesignArea(e.getX(), e.getY(),
+                                       lastCorDesignAreaWidth, 
lastCorDesignAreaHeight);
+               }
+               actualizeCursor(e.getX(), e.getY());
+
+               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
+                               e.getX(), e.getY());
+       }
+
+       /**
+        * Gets new width and height of the design area - in bounds of the 
tabbed
+        * pane
+        * 
+        * @param lastCorWidth
+        *            last correct design area width
+        * @param lastCorHeight
+        *            last correct design area height
+        * @param width
+        *            new design area width - possible out of tabbed pane bounds
+        * @param height
+        *            new design area height - possible out of tabbed pane 
bounds
+        * @param maxWidth
+        *            max possible width of design area
+        * @param maxHeight
+        *            max possible height of design area
+        */
+       private void getNewSizesInBounds(int lastCorWidth, int lastCorHeight,
+                       int width, int height, int maxWidth, int maxHeight) {
+
+               int stepX = 1;
+               int stepY = 1;
+
+               if (lastCorWidth > width)
+                       stepX = -1;
+
+               if (lastCorHeight > height)
+                       stepY = -1;
+
+               for (int x = lastCorWidth; x != width; x += stepX) {
+                       for (int y = lastCorHeight; y != height; y += stepY) {
+
+                               if (x == maxWidth) {
+                                       lastCorDesignAreaWidth = maxWidth;
+                                       lastCorDesignAreaHeight = maxWidth * 
lastCorHeight
+                                                       / lastCorWidth;
+                               }
+
+                               if (y == maxHeight) {
+                                       lastCorDesignAreaWidth = maxHeight * 
lastCorWidth
+                                                       / lastCorHeight;
+                                       lastCorDesignAreaHeight = maxHeight;
+                               }
+
+                       }
+
+               }
+       }
+
+       /**
+        * Resizes design area - keeps resolution, new width and height can be 
in
+        * wrong rate and can be detected outside tabbed pane bounds
+        * 
+        * @param width
+        *            new width of the design area
+        * @param height
+        *            new height of the design area
+        * @param lastCorWidth
+        *            last correct design area width
+        * @param lastCorHeight
+        *            last correct design area height
+        */
+       public void resizeDesignArea(int width, int height, int lastCorWidth,
+                       int lastCorHeight) {
+
+               if (isResizable) {
+                       ScreenResolution oldScreenSizes = 
layout.getScreenResolution();
+
+                       int minDesignAreaWidth = 10;
+                       int minDesignAreaHeight = minDesignAreaWidth
+                                       * oldScreenSizes.getElvysHeight()
+                                       / oldScreenSizes.getElvysWidth();
+
+                       int heightInRate = width * 
oldScreenSizes.getElvysHeight()
+                                       / oldScreenSizes.getElvysWidth();
+                       int widthInRate = height * 
oldScreenSizes.getElvysWidth()
+                                       / oldScreenSizes.getElvysHeight();
+
+                       int areaWidth = width * heightInRate;
+                       int areaHeight = widthInRate * height;
+
+                       // chooses new width and height in correct rate with 
greater area
+                       if (areaWidth > areaHeight) {
+                               height = heightInRate;
+                       } else {
+                               width = widthInRate;
+                       }
+
+                       if (width <= minDesignAreaWidth || height <= 
minDesignAreaHeight) {
+                               width = minDesignAreaWidth;
+                               height = minDesignAreaHeight;
+                       }
+
+                       int maxWidth = tabbedPane.getWidth() - 
TABBED_PANE_X_BORDER;
+                       int maxHeight = tabbedPane.getHeight() - 
TABBED_PANE_Y_BORDER;
+
+                       if (width >= maxWidth || height >= maxHeight) {
+
+                               getNewSizesInBounds(lastCorDesignAreaWidth,
+                                               lastCorDesignAreaHeight, width, 
height, maxWidth,
+                                               maxHeight);
+                               width = lastCorDesignAreaWidth;
+                               height = lastCorDesignAreaHeight;
+
+                       }
+
+                       if (width > maxWidth || height > maxHeight) {
+                               width = oldScreenSizes.getMonitorWidth();
+                               height = oldScreenSizes.getMonitorHeight();
+                       }
+
+                       lastCorDesignAreaWidth = width;
+                       lastCorDesignAreaHeight = height;
+
+                       ScreenResolution newScreenSizes = new 
ScreenResolution();
+                       newScreenSizes.setMonitorHeight(height);
+                       newScreenSizes.setMonitorWidth(width);
+                       
newScreenSizes.setElvysWidth(oldScreenSizes.getElvysWidth());
+                       
newScreenSizes.setElvysHeight(oldScreenSizes.getElvysHeight());
+
+                       layout.setScreenResolution(newScreenSizes);
+                       designArea.setSize(newScreenSizes.getMonitorWidth(), 
newScreenSizes
+                                       .getMonitorHeight());
+
+                       Positions positions = layout.getLayoutPositions();
+                       positions.changeMonitorResolution(designArea, 
oldScreenSizes,
+                                       newScreenSizes);
+
+               }
+       }
+
+       /**
+        * Decides, if it is allowed to resize design area according to actual
+        * coordinates of mouse
+        * 
+        * @param x
+        *            x coordinate of the actual position of mouse
+        * @param y
+        *            y coordinate of the actual position of mouse
+        * @return true, if you can resize, false, if you can't
+        */
+
+       private boolean isInResizableArea(int x, int y) {
+
+               ScreenResolution screenSizes = layout.getScreenResolution();
+               boolean isAroundRightBorder = x >= screenSizes.getMonitorWidth()
+                               - RESIZABLE_AREA_SIZE;
+               boolean isAroundBottomBorder = y >= 
screenSizes.getMonitorHeight()
+                               - RESIZABLE_AREA_SIZE;
+               if (isAroundRightBorder && isAroundBottomBorder) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       /**
+        * Changes parameters of the designed position according to moves of the
+        * mouse
+        */
+       private void changeCoordinatesAndProperties() {
+
+               monitorTopX = Math.min(monitorStartX, monitorActualX);
+               monitorTopY = Math.min(monitorStartY, monitorActualY);
+               monitorWidth = Math.max(monitorStartX, monitorActualX) - 
monitorTopX;
+               monitorHeight = Math.max(monitorStartY, monitorActualY) - 
monitorTopY;
+
+               int WIDTH = layout.getScreenResolution().getMonitorWidth();
+               int HEIGHT = layout.getScreenResolution().getMonitorHeight();
+
+               Position position = new Position(tabbedPane);
+               Position.IsSnappedToGrid snapped = position.isSnappedToGrid();
+               snapped.setHeight(designArea.isSnapToGridEnabled());
+               snapped.setWidth(designArea.isSnapToGridEnabled());
+               snapped.setTopX(designArea.isSnapToGridEnabled());
+               snapped.setTopY(designArea.isSnapToGridEnabled());
+               position.setSnappedToGrid(snapped);
+               AbsoluteCoordinates absolute = position
+                               
.changeCoordinatesToNotBeOutOfDesignArea(monitorTopX,
+                                               monitorTopY, monitorWidth, 
monitorHeight, WIDTH,
+                                               HEIGHT, Layout.AddType.DESIGN, 
false, designArea);
+               monitorTopX = absolute.getTopX();
+               monitorTopY = absolute.getTopY();
+               monitorWidth = absolute.getWidth();
+               monitorHeight = absolute.getHeight();
+
+               elvysTopX = Math.min(elvysStartX, elvysActualX);
+               elvysTopY = Math.min(elvysStartY, elvysActualY);
+               elvysWidth = Math.max(elvysStartX, elvysActualX) - elvysTopX;
+               elvysHeight = Math.max(elvysStartY, elvysActualY) - elvysTopY;
+
+               int kiosekWIDTH = layout.getScreenResolution().getElvysWidth();
+               int kiosekHEIGHT = 
layout.getScreenResolution().getElvysHeight();
+
+               position = new Position(tabbedPane);
+               absolute = 
position.changeCoordinatesToNotBeOutOfDesignArea(elvysTopX,
+                               elvysTopY, elvysWidth, elvysHeight, 
kiosekWIDTH, kiosekHEIGHT,
+                               Layout.AddType.DESIGN, true, designArea);
+               elvysTopX = absolute.getTopX();
+               elvysTopY = absolute.getTopY();
+               elvysWidth = absolute.getWidth();
+               elvysHeight = absolute.getHeight();
+
+       }
+
+       /**
+        * Paints all positions in the actual design area
+        * 
+        */
+       public void paintAllPositions() {
+               // paints positions
+               if (isNotMoving) {
+
+                       designArea.removeAll();
+
+                       Vector<Position> positions = layout.getLayoutPositions()
+                                       .getPositions();
+
+                       objects = new MovingObjects();
+                       for (int i = 0; i < positions.size(); ++i) {
+                               Position actualPosition = positions.get(i);
+                               objects.add(actualPosition.paint(designArea));
+                       }
+               }
+       }
+
+       /**
+        * Paints the actual design area
+        * 
+        * @param g
+        *            graphics
+        */
+       public void paintComponent(Graphics g) {
+
+               super.paintComponent(g);
+               
+               //Color lightGray = new Color(211, 211, 211);
+               //g.setColor(lightGray);
+               //int left = getLeftPanelWidthMonitor();
+               //g.drawLine(left, 0, left, getHeight());
+               //int down = getDownPanelWidthMonitor();
+               //g.drawLine(0, getHeight() - down, getWidth(), getHeight() - 
down);
+
+               // paints grid
+               if (isShowGridEnabled()) {
+
+                       Grid grid = new Grid(designArea);
+                       grid.paintGrid(g, designArea);
+               }
+
+               // paints positions selection rectangle
+               if (showSelectRectangle && !isResizable) {
+                       g.setColor(Color.lightGray);
+                       g.drawRect(monitorTopX, monitorTopY, monitorWidth, 
monitorHeight);
+               }
+
+       }
+
+       // getters & setters
+
+       /**
+        * Sets whatever some position in design area is moving
+        * 
+        * @param isNotMoving
+        *            the isNotMoving to set
+        */
+       public void setIsNotMoving(boolean isNotMoving) {
+               this.isNotMoving = isNotMoving;
+       }
+
+       /**
+        * Gets whatever some position in design area is moving
+        * 
+        * @return the isNotMoving
+        */
+       public boolean isNotMoving() {
+               return isNotMoving;
+       }
+
+       /**
+        * Sets whatever LayoutDesigner is in design mode
+        * 
+        * @param isInDesignMode
+        *            the isInDesignMode to set
+        */
+       public void setInDesignMode(boolean isInDesignMode) {
+               this.isInDesignMode = isInDesignMode;
+       }
+
+       /**
+        * Gets whatever LayoutDesigner is in design mode
+        * 
+        * @return the isInDesignMode
+        */
+       public boolean isInDesignMode() {
+               return isInDesignMode;
+       }
+
+       /**
+        * Sets whatever some position is designed
+        * 
+        * @param isNotDesigning
+        *            the isNotDesigning to set
+        */
+       public void setNotDesigning(boolean isNotDesigning) {
+               this.isNotDesigning = isNotDesigning;
+       }
+
+       /**
+        * Gets whatever some position is designed
+        * 
+        * @return the isNotDesigning
+        */
+       public boolean isNotDesigning() {
+               return isNotDesigning;
+       }
+
+       /**
+        * Sets main tabbed pane
+        * 
+        * @param tabbedPane
+        *            main tabbed pane to set
+        */
+       public void setTabbedPane(TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+       /**
+        * Sets whatever layout for this design are is saved
+        * 
+        * @param isSaved
+        *            isSaved to set
+        */
+       public void setSaved(boolean isSaved) {
+               this.isSaved = isSaved;
+       }
+
+       /**
+        * Gets whatever layout for this design area is saved
+        * 
+        * @return the isSaved
+        */
+       public boolean isSaved() {
+               return this.isSaved;
+       }
+
+       /**
+        * Gets whatever layout for this design area has ever been saved
+        * 
+        * @return the hasNeverBeenSaved
+        */
+       public boolean hasNeverBeenSaved() {
+               return this.hasNeverBeenSaved;
+       }
+
+       /**
+        * Sets whatever layout for this design area has ever been saved
+        * 
+        * @param hasNeverBeenSaved
+        *            to set
+        */
+       public void setHasNeverBeenSave(boolean hasNeverBeenSaved) {
+               this.hasNeverBeenSaved = hasNeverBeenSaved;
+       }
+
+       /**
+        * Gets layout for this design area
+        * 
+        * @return the layout
+        */
+       public Layout getMyLayout() {
+               return layout;
+       }
+
+       /**
+        * Sets layout for this design area
+        * 
+        * @param layout
+        *            the layout to set
+        */
+       public void setMyLayout(Layout layout) {
+               this.layout = layout;
+               this.isShowGridEnabled = layout.isShowGridEnabled();
+               this.isSnapToGridEnabled = layout.isSnappedToGrid();
+       }
+
+       /**
+        * Gets main tabbed pane
+        * 
+        * @return the tabbedPane
+        */
+       public TabbedPane getTabbedPane() {
+               return tabbedPane;
+       }
+
+       /**
+        * Sets whatever there are position to paste in clipboard
+        * 
+        * @param arePositionToPaste
+        *            the arePositionToPaste to set
+        */
+       public void setPositionToPaste(boolean arePositionToPaste) {
+               this.arePositionToPaste = arePositionToPaste;
+       }
+
+       /**
+        * Gets whatever there are position to paste in clipboard
+        * 
+        * @return the arePositionToPaste
+        */
+       public boolean arePositionToPaste() {
+               return arePositionToPaste;
+       }
+
+       /**
+        * Sets forward and backward action memory
+        * 
+        * @param actionMemory
+        *            the actionMemory to set
+        */
+       public void setActionMemory(ActionsMemory actionMemory) {
+               this.actionMemory = actionMemory;
+       }
+
+       /**
+        * Gets forward and backward action memory
+        * 
+        * @return the actionMemory
+        */
+       public ActionsMemory getActionMemory() {
+               return actionMemory;
+       }
+
+       /**
+        * Sets whatever is enabled to show grid for this design area
+        * 
+        * @param isShowGridEnabled
+        *            the isShowGridEnabled to set
+        */
+       public void setShowGridEnabled(boolean isShowGridEnabled) {
+               this.isShowGridEnabled = isShowGridEnabled;
+               this.layout.setShowGridEnabled(isShowGridEnabled);
+       }
+
+       /**
+        * Gets whatever is enabled to show grid for this design area
+        * 
+        * @return the isShowGridEnabled
+        */
+       public boolean isShowGridEnabled() {
+               return isShowGridEnabled;
+       }
+
+       /**
+        * Sets whatever snap to grid is enabled for this design area
+        * 
+        * @param isSnapToGridEnabled
+        *            the isSnapToGridEnabled to set
+        */
+       public void setSnapToGridEnabled(boolean isSnapToGridEnabled) {
+               this.isSnapToGridEnabled = isSnapToGridEnabled;
+               this.layout.setSnappedToGrid(isSnapToGridEnabled);
+
+       }
+
+       /**
+        * Gets whatever snap to grid is enabled for this design area
+        * 
+        * @return the isSnapToGridEnabled
+        */
+       public boolean isSnapToGridEnabled() {
+               return isSnapToGridEnabled;
+       }
+
+       /**
+        * Copies positions to clipboard
+        * 
+        * @param positionsToPaste
+        *            the positionsToPaste to set
+        */
+       public void setPositionsToPaste(Positions positionsToPaste) {
+               this.positionsToPaste = positionsToPaste;
+       }
+
+       /**
+        * Gets copied positions
+        * 
+        * @return the positionsToPaste
+        */
+       public Positions getPositionsToPaste() {
+               return positionsToPaste;
+       }
+
+       /**
+        * Gets the popup menu
+        * 
+        * @return the popupMenu
+        */
+       public PopupMenu getPopupMenu() {
+               return popupMenu;
+       }
+
+       /**
+        * Sets the popup menu
+        * 
+        * @param popupMenu
+        *            the popupMenu to set
+        */
+       public void setPopupMenu(PopupMenu popupMenu) {
+               this.popupMenu = popupMenu;
+       }
+
+       /**
+        * Gets the properties
+        * 
+        * @return the properties
+        */
+       public Properties getProperties() {
+               return tabbedPane.getProperties();
+       }
+
+       /**
+        * Sets the objects corresponding to all designed position in this 
design area
+        * 
+        * @param objects
+        *            the objects to set
+        */
+       public void setObjects(MovingObjects objects) {
+               this.objects = objects;
+       }
+
+       /**
+        * Gets objects corresponding to all designed position in this design 
area
+        * 
+        * @return the objects
+        */
+       public MovingObjects getObjects() {
+               return objects;
+       }
+       
+       /**
+        * Gets width of panel with tabs and categories on elvys
+        * @return the tabCatPanelWidth
+        */
+       public static int getTabCatPanelWidthElvys() {
+               return TAB_CAT_PANEL_WIDTH_ELVYS;
+       }
+       
+       /**
+        * Gets width of panel with tabs and categories on left side on monitor
+        * @return the tabCatPanelWidth
+        */
+       public int getLeftPanelWidthMonitor() {
+               
+               if (layout == null) {
+                       return TAB_CAT_PANEL_WIDTH_ELVYS;
+               }
+
+               int monitorWidth = 
layout.getScreenResolution().getMonitorWidth();
+               int elvysWidth = layout.getScreenResolution().getElvysWidth();
+
+               if (elvysWidth == 0) {
+                       return TAB_CAT_PANEL_WIDTH_ELVYS;
+               }
+
+               return (int) Math
+                               .round((double) (TAB_CAT_PANEL_WIDTH_ELVYS * 
monitorWidth / elvysWidth));
+       }
+       
+       /**
+        * Gets width of panel with tabs and categories on down side on monitor
+        * @return the tabCatPanelWidth
+        */
+       public int getDownPanelWidthMonitor() {
+               if (layout == null) {
+                       return TAB_CAT_PANEL_WIDTH_ELVYS;
+               }
+
+               int monitorHeight = 
layout.getScreenResolution().getMonitorHeight();
+               int elvysHeight = layout.getScreenResolution().getElvysHeight();
+
+               if (elvysHeight == 0) {
+                       return TAB_CAT_PANEL_WIDTH_ELVYS;
+               }
+
+               return (int) Math
+                               .round((double) TAB_CAT_PANEL_WIDTH_ELVYS * 
monitorHeight / elvysHeight);
+
+       }
+
+}
\ No newline at end of file

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/Icons.java 
(from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/Icons.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/Icons.java    
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/Icons.java    
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,272 @@
+package com.elvys.applet.components;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class Icons {
+
+       private final static String PATH = "/webServer2/applets/";              
                                /** path to directory with icons */
+       private final static String BACKWARD_ENABLED = "icn_back_ac.png";       
                        /** name of the file with icon for backward enabled 
button */
+       private final static String BACKWARD_DISABLED = "icn_back_ps.png";      
                        /** name of the file with icon for backward disabled 
button */ 
+       private final static String FORWARD_ENABLED = "icn_next_ac.png";        
                        /** name of the file with icon for forward enabled 
button */
+       private final static String FORWARD_DISABLED = "icn_next_ps.png";       
                        /** name of the file with icon for forward disable 
button */    
+       private final static String SAME_TOP_ENABLED = "icn_topalign_ac.png";   
                /** name of the file with icon for same top enabled button */   
+       private final static String SAME_TOP_DISABLED = "icn_topalign_ps.png";  
                /** name of the file with icon for same top disabled button */
+       private final static String SAME_BOTTOM_ENABLED = 
"icn_bottomalign_ac.png";             /** name of the file with icon for same 
bottom enabled button */
+       private final static String SAME_BOTTOM_DISABLED = 
"icn_bottomalign_ps.png";    /** name of the file with icon for same bottom 
disabled button */
+       private final static String SAME_LEFT_ENABLED = "icn_leftalign_ac.png"; 
                /** name of the file with icon for same left enabled button */  
                
+       private final static String SAME_LEFT_DISABLED = 
"icn_leftalign_ps.png";                /** name of the file with icon for same 
left disabled button */
+       private final static String SAME_RIGHT_ENABLED = 
"icn_rightalign_ac.png";               /** name of the file with icon for same 
right enabled button */
+       private final static String SAME_RIGHT_DISABLED = 
"icn_rightalign_ps.png";              /** name of the file with icon for same 
right disabled button */
+       private final static String CENTER_HOR_ENABLED = 
"icn_middlealign_ac.png";              /** name of the file with icon for 
center vertical enabled button */
+       private final static String CENTER_HOR_DISABLED = 
"icn_middlealign_ps.png";             /** name of the file with icon for center 
vertical disabled button */
+       private final static String CENTER_VER_ENABLED = 
"icn_centeralign_ac.png";              /** name of the file with icon for 
center horizontal enabled button */
+       private final static String CENTER_VER_DISABLED = 
"icn_centeralign_ps.png";             /** name of the file with icon for center 
horizontal disabled button */
+       private final static String DESIGN_ENABLED = "icn_drawnew_ac.png";      
                        /** name of the file with icon for design enabled 
button */ 
+       private final static String DESIGN_DISABLED = "icn_drawnew_ps.png";     
                        /** name of the file with icon for design disabled 
button */
+       private final static String SELECT_ENABLED = "icn_selearrow_ac.png";    
                /** name of the file with icon for select enabled button */
+       private final static String SELECT_DISABLED = "icn_selearrow_ps.png";   
                /** name of the file with icon for select disabled button */
+
+       private Image backwardEnabledImage;                     /** icon for 
backward enabled button */
+       private Image backwardDisabledImage;            /** icon for backward 
disabled button */
+       private Image forwardEnabledImage;                      /** icon for 
forward enabled button */
+       private Image forwardDisabledImage;                     /** icon for 
forward disabled button */
+       private Image sameTopEnabledImage;                      /** icon for 
same top enabled button */
+       private Image sameTopDisabledImage;                     /** icon for 
same top disabled button */
+       private Image sameBottomEnabledImage;           /** icon for same 
bottom enabled button */
+       private Image sameBottomDisabledImage;          /** icon for same 
bottom disabled button */
+       private Image sameLeftEnabledImage;                     /** icon for 
same left enabled button */
+       private Image sameLeftDisabledImage;            /** icon for same left 
disabled button */
+       private Image sameRightEnabledImage;            /** icon for same right 
enabled button */
+       private Image sameRightDisabledImage;           /** icon for same right 
disabled button */
+       private Image centerHorEnabledImage;            /** icon for center 
horizontal enabled button */
+       private Image centerHorDisabledImage;           /** icon for center 
horizontal disabled button */
+       private Image centerVerEnabledImage;            /** icon for center 
vertical enabled button */
+       private Image centerVerDisabledImage;           /** icon for center 
vertical disabled button */
+       private Image designEnabledImage;                       /** icon for 
design enabled button */
+       private Image designDisabledImage;                      /** icon for 
design disabled button */
+       private Image selectEnabledImage;                       /** icon for 
select enabled button */
+       private Image selectDisabledImage;                      /** icon for 
select disabled button */
+
+       /**
+        * Constructor of the class Icon
+        * @param urlString urlString to set
+        */
+       public Icons(String urlString) {
+               this.forwardEnabledImage = getIcon(urlString + PATH + 
FORWARD_ENABLED);
+               this.forwardDisabledImage = getIcon(urlString + PATH + 
FORWARD_DISABLED);
+               this.backwardEnabledImage = getIcon(urlString + PATH + 
BACKWARD_ENABLED);
+               this.backwardDisabledImage = getIcon(urlString + PATH + 
BACKWARD_DISABLED);
+               this.sameTopEnabledImage = getIcon(urlString + PATH + 
SAME_TOP_ENABLED);
+               this.sameTopDisabledImage = getIcon(urlString + PATH + 
SAME_TOP_DISABLED);
+               this.sameBottomEnabledImage = getIcon(urlString + PATH + 
SAME_BOTTOM_ENABLED);
+               this.sameBottomDisabledImage = getIcon(urlString + PATH + 
SAME_BOTTOM_DISABLED);
+               this.sameRightEnabledImage = getIcon(urlString + PATH + 
SAME_RIGHT_ENABLED);
+               this.sameRightDisabledImage = getIcon(urlString + PATH + 
SAME_RIGHT_DISABLED);
+               this.sameLeftEnabledImage = getIcon(urlString + PATH + 
SAME_LEFT_ENABLED);
+               this.sameLeftDisabledImage = getIcon(urlString + PATH + 
SAME_LEFT_DISABLED);
+               this.centerHorEnabledImage = getIcon(urlString + PATH + 
CENTER_HOR_ENABLED);
+               this.centerHorDisabledImage = getIcon(urlString + PATH + 
CENTER_HOR_DISABLED);
+               this.centerVerEnabledImage = getIcon(urlString + PATH + 
CENTER_VER_ENABLED);
+               this.centerVerDisabledImage = getIcon(urlString + PATH + 
CENTER_VER_DISABLED);
+               this.designEnabledImage = getIcon(urlString + PATH + 
DESIGN_ENABLED);
+               this.designDisabledImage = getIcon(urlString + PATH + 
DESIGN_DISABLED);
+               this.selectEnabledImage = getIcon(urlString + PATH + 
SELECT_ENABLED);
+               this.selectDisabledImage = getIcon(urlString + PATH + 
SELECT_DISABLED);
+       }
+       
+       /**
+        * Gets icon from given url
+        * @param iconUrlString url where icon is saved
+        * @return icon
+        */
+       private Image getIcon(String iconUrlString) {
+               try {
+                       
+                       URL url = new URL(iconUrlString);
+
+                       java.awt.Toolkit.getDefaultToolkit();
+                       Image image = 
Toolkit.getDefaultToolkit().createImage(url);
+                       return image;
+               } catch (MalformedURLException e) {
+               }
+               return null;
+       }
+
+
+       // getter & setters
+       
+
+       /**
+        * Getter for the field backwardEnabledImage
+        * @return the backwardEnabledImage
+        */
+       public Image getBackwardEnabledImage() {
+               return backwardEnabledImage;
+       }
+
+       /**
+        * Getter for the field sameTopEnabledImage
+        * @return the sameTopEnabledImage
+        */
+       public Image getSameTopEnabledImage() {
+               return sameTopEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameTopDisabledImage
+        * @return the sameTopDisabledImage
+        */
+       public Image getSameTopDisabledImage() {
+               return sameTopDisabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameBottomEnabledImage
+        * @return the sameBottomEnabledImage
+        */
+       public Image getSameBottomEnabledImage() {
+               return sameBottomEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameBottomDisabledImage
+        * @return the sameBottomDisabledImage
+        */
+       public Image getSameBottomDisabledImage() {
+               return sameBottomDisabledImage;
+       }
+
+       /**
+        * Getter for the field sameLeftEnabledImage
+        * @return the sameLeftEnabledImage
+        */
+       public Image getSameLeftEnabledImage() {
+               return sameLeftEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameLeftDisabledImage
+        * @return the sameLeftDisabledImage
+        */
+       public Image getSameLeftDisabledImage() {
+               return sameLeftDisabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameRightEnabledImage
+        * @return the sameRightEnabledImage
+        */
+       public Image getSameRightEnabledImage() {
+               return sameRightEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field sameRightDisabledImage
+        * @return the sameRightDisabledImage
+        */
+       public Image getSameRightDisabledImage() {
+               return sameRightDisabledImage;
+       }
+
+       /**
+        * Getter for the field centerHorEnabledImage
+        * @return the centerHorEnabledImage
+        */
+       public Image getCenterHorEnabledImage() {
+               return centerHorEnabledImage;
+       }
+
+       /**
+        * Getter for the field centerHorDisabledImage
+        * @return the centerHorDisabledImage
+        */
+       public Image getCenterHorDisabledImage() {
+               return centerHorDisabledImage;
+       }
+
+       /**
+        * Getter for the field centerVerEnabledImage
+        * @return the centerVerEnabledImage
+        */
+       public Image getCenterVerEnabledImage() {
+               return centerVerEnabledImage;
+       }
+
+       /**
+        * Getter for the field centerVerDisabledImage
+        * @return the centerVerDisabledImage
+        */
+       public Image getCenterVerDisabledImage() {
+               return centerVerDisabledImage;
+       }
+
+
+       /**
+        * Getter for the field backwardDisabledImage
+        * @return the backwardDisabledImage
+        */
+       public Image getBackwardDisabledImage() {
+               return backwardDisabledImage;
+       }
+
+
+       /**
+        * Getter for the field forwardEnabledImage
+        * @return the forwardEnabledImage
+        */
+       public Image getForwardEnabledImage() {
+               return forwardEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field forwardDisabledImage
+        * @return the forwardDisabledImage
+        */
+       public Image getForwardDisabledImage() {
+               return forwardDisabledImage;
+       }
+
+       /**
+        * Getter for the field designEnabledImage
+        * @return the designEnabledImage
+        */
+       public Image getDesignEnabledImage() {
+               return designEnabledImage;
+       }
+
+       /**
+        * Getter for the field designDisabledImage
+        * @return the designDisabledImage
+        */
+       public Image getDesignDisabledImage() {
+               return designDisabledImage;
+       }
+
+       /**
+        * Getter for the field selectEnabledImage
+        * @return the selectEnabledImage
+        */
+       public Image getSelectEnabledImage() {
+               return selectEnabledImage;
+       }
+
+
+       /**
+        * Getter for the field selectDisabledImage
+        * @return the selectDisabledImage
+        */
+       public Image getSelectDisabledImage() {
+               return selectDisabledImage;
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
 (from rev 1790, 
trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
                               (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,391 @@
+package com.elvys.applet.components;
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+import java.util.Vector;
+import javax.swing.*;
+import javax.swing.border.LineBorder;
+import javax.swing.JDialog;
+import javax.swing.JApplet;
+
+
+import com.elvys.applet.dialog.ResolutionChoiceDialog;
+import com.elvys.applet.dialog.WarningDialog;
+import com.elvys.applet.propertiesManager.PropertiesManager;
+import com.elvys.applet.serverCommunication.ServerSideContext;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.ScreenResolution;
+import com.elvys.applet.structures.SupportedResolutions;
+
+import java.lang.reflect.*;
+
+/**
+ * LayoutDesigner is main applet class. Initializes individual components and
+ * displays applet.
+ */
+public class LayoutDesigner extends JApplet {
+
+       private static final long serialVersionUID = 5212730162755861066L;
+
+       // fields
+       private JMenuBar menuBar;
+       /** menu bar */
+       private JTabbedPane propertiesManager;
+       /** properties manager tabbed pane */
+       private JPanel statusBar;
+       /** status bar */
+       private TabbedPane tabbedPane;
+       /** main tabbed pane */
+       private JToolBar toolBar;
+       /** tool bar */
+       private Layout layoutToOpen = null;
+       /**
+        * layout read from server - if editing layout is empty - if creating 
new
+        * layout
+        */
+       private Applet instance;
+       /** this applet */
+       private Vector<String> allPossibleDocumentTypes;
+       /** all possible document types */
+       private ComponentSizes componentSizes;
+       /** size of components */
+       private Properties properties;
+       /** properties */
+       private JRootPane rootPane;
+       /** rootPane of this applet */
+
+       // constants
+       private final static String PROPERTIES_FILE_NAME = "LayoutDesigner";
+       /** name of file with properties */
+       private final static String PROPERTIES_FILE_PATH = 
"/webServer2/applets/";
+       /** file path to properties file */
+       private final static int APPLET_WIDTH = 950;
+       /** width of applet */
+       private final static int APPLET_HEIGHT = 650;
+       /** height of applet */
+       private final static int BAR_HEIGHT = 35;
+       /** height of all bars */
+       private final static int PROPERTIES_MANAGER_WIDTH = 200;
+       /** width of properties manager */
+       private final static String NOT_LOADED_PROPERTIES = "Server 
communication error: It isn't possible to read properties file";
+       /** user error message - error loading properties file */
+       private final static String NOT_SUPPORTED = "This localization isn't 
supported";
+       /** user error message - localization is not supported */
+       private final static String WARNING = "Warning";
+       /** warning dialog title in case properties file isn't loaded */
+
+       public static LayoutDesigner getInstance() {
+               return new LayoutDesigner();
+       }
+       
+       /**
+        * Initializes applet
+        */
+       public void init() {
+
+               try {
+
+                       java.awt.EventQueue.invokeAndWait(new Runnable() {
+                               public void run() {
+
+                                       initComponents();
+
+                                       // Init context of layout- 
communication with server,
+                                       // parameters,
+                                       // etc.
+                                       try {
+                                               
ServerSideContext.newInstance(instance, tabbedPane);
+                                       } catch (Exception e) {
+                                               new WarningDialog(new JFrame(), 
properties
+                                                               
.getProperty("warning.appletNotLoaded"),
+                                                               
properties.getProperty("warning.warning"));
+                                               throw new RuntimeException(e);
+                                       }
+
+                                       try {
+                                               
ServerSideContext.getInstance().getProperties(instance,
+                                                               tabbedPane);
+                                       } catch (Exception e) {
+                                               e.printStackTrace();
+                                       }
+                                       
+                                       String localization = 
ServerSideContext.getInstance().getLocalization();
+                       
+                                       localization = "cs";
+                                       
+                                       
if(!ServerSideContext.getInstance().getLOCALIZATION().contains(localization)) {
+                                               new WarningDialog(new JFrame(), 
NOT_SUPPORTED, WARNING);
+                                               
closeLayoutDesignerBrowserWindow();
+                                       }
+                                       
+                                       
+                                       URL url = null;
+                                       try {
+                                               String urlString = 
ServerSideContext.getInstance()
+                                                               .getHost()
+                                                               + 
PROPERTIES_FILE_PATH + PROPERTIES_FILE_NAME + "_" + localization + 
".properties";
+                                               url = new URL(urlString);
+                                               
closeLayoutDesignerBrowserWindow();
+                                       } catch (MalformedURLException e1) {
+                                       }
+
+                                       // read properties file
+                                       properties = new Properties();
+                                       try {
+                                               
properties.load(url.openStream());
+                                       } catch (IOException e) {
+                                               new WarningDialog(new JFrame(), 
NOT_LOADED_PROPERTIES, WARNING);
+                                               e.printStackTrace();
+                                       }
+
+                                       tabbedPane.setProperties(properties);
+                                       
tabbedPane.setComponentSizes(componentSizes);
+
+                                       
+                                       
+                                       SupportedResolutions 
supportedAspectRatios;
+
+                                       // gets permitted types of document 
from server
+                                       allPossibleDocumentTypes = 
ServerSideContext.getInstance()
+                                                       
.getPermittedDocumentTypes();
+
+                                       // gets supported aspect ratios for 
this company
+                                       supportedAspectRatios = 
ServerSideContext.getInstance()
+                                                       
.getSupportedResolutions();
+
+                                       // gets layout
+                                       layoutToOpen = 
ServerSideContext.getInstance().getLayout();
+
+                                       // initializes components
+                                       
tabbedPane.setAllTypesOfDocuments(allPossibleDocumentTypes);
+
+                                       boolean isLocked = 
ServerSideContext.getInstance()
+                                                       .isLocked();
+                                       MenuBar myMenuBar = new 
MenuBar(menuBar, properties,
+                                                       rootPane);
+
+                                       ToolBar myToolBar = new 
ToolBar(toolBar, ServerSideContext
+                                                       
.getInstance().getHost(), propertiesManager,
+                                                       tabbedPane);
+                                       StatusBar myStatusBar = new 
StatusBar(statusBar);
+
+                                       // sets components fields
+                                       
tabbedPane.setSupportedResolutions(supportedAspectRatios);
+                                       myMenuBar.setTabbedPane(tabbedPane);
+                                       myToolBar.setTabbedPane(tabbedPane);
+
+                                       myStatusBar.setTabbedPane(tabbedPane);
+                                       tabbedPane.setToolBar(myToolBar);
+                                       tabbedPane.setStatusBar(myStatusBar);
+                                       tabbedPane.setMenuBar(myMenuBar);
+
+                                       if (isLocked) {
+                                               new WarningDialog(new JFrame(), 
properties
+                                                               
.getProperty("warning.isLocked")
+                                                               + 
ServerSideContext.getInstance()
+                                                                               
.getLockedUser(), properties
+                                                               
.getProperty("warning.warning"));
+                                               
closeLayoutDesignerBrowserWindow();
+                                       } else {
+                                               // opens new layout, if it is 
loaded from server
+                                               if (layoutToOpen != null) {
+                                                       DesignArea 
editedLayoutDesignArea;
+                                                       editedLayoutDesignArea 
= new DesignArea(tabbedPane,
+                                                                       
layoutToOpen);
+
+                                                       
tabbedPane.addNewTab(layoutToOpen.getName(),
+                                                                       
editedLayoutDesignArea);
+
+                                                       
editedLayoutDesignArea.setTabbedPane(tabbedPane);
+
+                                                       tabbedPane.repaint();
+                                               } else {
+                                                       openNewLayout();
+                                               }
+
+                                       }
+
+                                       PropertiesManager myPropertiesManager = 
new PropertiesManager(
+                                                       propertiesManager, 
allPossibleDocumentTypes,
+                                                       tabbedPane, properties, 
componentSizes);
+                                       
tabbedPane.setPropertiesManager(myPropertiesManager);
+                                       tabbedPane.repaint();
+
+                               }
+                       });
+               } catch (Exception ex) {
+                       tabbedPane.repaint();
+                       ex.printStackTrace();
+               }
+
+       }
+
+       /**
+        * Initializes applet's main components
+        */
+       private void initComponents() {
+
+               instance = this;
+
+               // initializes sizes of components
+               componentSizes = new ComponentSizes();
+               componentSizes.setApplet(new Dimension(APPLET_WIDTH, 
APPLET_HEIGHT));
+               int propertiesManagerHeight = APPLET_HEIGHT - 3 * BAR_HEIGHT;
+               componentSizes.setPropertiesManager(new Dimension(
+                               PROPERTIES_MANAGER_WIDTH, 
propertiesManagerHeight));
+               componentSizes.setStatusBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
+               componentSizes.setToolBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
+               componentSizes.setMenuBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
+               int tabbedPaneWidth = APPLET_WIDTH - PROPERTIES_MANAGER_WIDTH;
+               componentSizes.setTabbedPane(new Dimension(tabbedPaneWidth,
+                               propertiesManagerHeight));
+
+               // sets border around whole applet
+               this.getRootPane().setBorder(new LineBorder(Color.black));
+
+               // sets sizes of whole applet
+               this.setPreferredSize(componentSizes.getApplet());
+
+               // creates content pane
+               JPanel contentPane = new JPanel();
+               contentPane.setLayout(new BorderLayout());
+               contentPane.setPreferredSize(componentSizes.getApplet());
+
+               // creates components
+               menuBar = new JMenuBar();
+               menuBar.setPreferredSize(componentSizes.getMenuBar());
+               setJMenuBar(menuBar);
+
+               toolBar = new JToolBar();
+               toolBar.setPreferredSize(componentSizes.getToolBar());
+               contentPane.add(toolBar, BorderLayout.PAGE_START);
+
+               tabbedPane = new TabbedPane(properties, 
allPossibleDocumentTypes);
+               tabbedPane.setPreferredSize(componentSizes.getTabbedPane());
+               contentPane.add(tabbedPane, BorderLayout.CENTER);
+
+               propertiesManager = new JTabbedPane();
+               propertiesManager.setPreferredSize(componentSizes
+                               .getPropertiesManager());
+               contentPane.add(propertiesManager, BorderLayout.LINE_END);
+
+               statusBar = new JPanel();
+               statusBar.setMaximumSize(componentSizes.getStatusBar());
+               statusBar.setMinimumSize(componentSizes.getStatusBar());
+               statusBar.setPreferredSize(componentSizes.getStatusBar());
+               contentPane.add(statusBar, BorderLayout.PAGE_END);
+
+               // sets appplet's content pane
+
+               this.setContentPane(contentPane);
+
+               rootPane = this.getRootPane();
+
+       }
+
+       /**
+        * Closes browser window with LayoutDesigner
+        */
+       public void closeLayoutDesignerBrowserWindow() {
+
+               String jscmd = "window.close()"; 
+               try {
+                       Method getw = null, eval = null;
+                       Object jswin = null;
+                       Class c = 
Class.forName("netscape.javascript.JSObject"); 
+                       Method ms[] = c.getMethods();
+                       for (int i = 0; i < ms.length; i++) {
+                               if (ms[i].getName().compareTo("getWindow") == 
0) {
+                                       getw = ms[i];
+                               }
+                               else if (ms[i].getName().compareTo("eval") == 
0) {
+                                       eval = ms[i];
+                               }
+                       }
+                       
+                       Object a[] = new Object[1]; 
+                       a[0] = this; 
+                       jswin = getw.invoke(c, a);
+                       a[0] = jscmd; 
+                       eval.invoke(jswin, a); 
+                       
+               } catch (Exception e) {
+
+               }
+
+       }
+
+       /**
+        * Opens new empty layout
+        */
+       public void openNewLayout() {
+
+               ResolutionChoiceDialog resolutionChoiceDialog = new 
ResolutionChoiceDialog(
+                               new JDialog(), properties,
+                               tabbedPane.getSupportedResolutions(), rootPane);
+               ScreenResolution screenSizes = resolutionChoiceDialog
+                               .showResolutionChoiceDialog();
+
+               if (screenSizes == null) {
+                       closeLayoutDesignerBrowserWindow();
+                       return;
+               }
+               String newDesignAreaName = 
tabbedPane.getProperties().getProperty(
+                               "newDesignArea.label");
+
+               Layout newDesignAreaLayout = new Layout();
+               newDesignAreaLayout.setLayoutAspectRatio((double) screenSizes
+                               .getElvysWidth()
+                               / (double) screenSizes.getElvysHeight());
+
+               newDesignAreaLayout.setId(0);
+               newDesignAreaLayout.setIsNew(true);
+               newDesignAreaLayout.setName(newDesignAreaName);
+               newDesignAreaLayout.setRevision(0);
+               newDesignAreaLayout.setScreenResolution(screenSizes);
+               newDesignAreaLayout.setLayoutPositions(new Positions(
+                               newDesignAreaLayout));
+
+               DesignArea designArea = new DesignArea(tabbedPane, 
newDesignAreaLayout);
+               tabbedPane.addNewTab(newDesignAreaName, designArea);
+
+       }
+
+       /**
+        * When applet is started, it locks edited layout, nobody else is able 
to
+        * edit this layout
+        */
+       public void start() {
+               Layout layout = ServerSideContext.getInstance().getLayout();
+               if (layout != null) {
+                       try {
+                               ServerSideContext.getInstance().lockLayout();
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+       /**
+        * When applet end, edited layout is unlocked
+        */
+       public void destroy() {
+
+               Layout layout = ServerSideContext.getInstance().getLayout();
+               if (layout != null) {
+                       try {
+                               ServerSideContext.getInstance().unlockLayout();
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               }
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java 
(from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/MenuBar.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java  
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java  
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,378 @@
+package com.elvys.applet.components;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.Properties;
+import javax.swing.*;
+
+
+import com.elvys.applet.dialog.ResolutionChoiceDialog;
+import com.elvys.applet.dialog.SaveAsDialog;
+import com.elvys.applet.dialog.SaveLayoutOnServer;
+import com.elvys.applet.serverCommunication.ServerSideContext;
+import com.elvys.applet.structures.CloseLayout;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.ScreenResolution;
+
+/**
+ * MenuBar.java
+ * @author Eva Viktorinova
+ * 
+ */
+
+/**
+ * @class MenuBar
+ * Menu bar represent menu in LayoutDesigner application
+ */
+@SuppressWarnings("serial")
+public class MenuBar extends JMenuBar {
+       // fields
+       private JMenuBar menuBar;                                               
        /** parent menu bar where menu is displayed */
+       private TabbedPane tabbedPane;                                          
/** tabbed pane */
+       private Properties properties;                                          
/** properties */
+       private JRootPane rootPane;                                             
        /** root pane of the LayoutDesigner */
+       private JMenuItem menuItemNew;                                          
/** menu item New layout */ 
+       private JMenuItem menuItemSaveOnServer;                         /** 
menu item Save */
+       private JMenuItem menuItemClose;                                        
/** menu item Close */
+       private JMenuItem menuItemCloseAll;                                     
/** menu item Close all */
+       private JMenuItem menuItemChangeResolution;                     /** 
menu item Change resolution */
+       private JCheckBoxMenuItem menuItemSnapToGrid;           /** menu item 
Snap to grid */
+       private JCheckBoxMenuItem menuItemShowGrid;                     /** 
menu item Show grid */
+
+       // constructors
+       /**
+        * Constructor of the class MenuBar
+        * @param menuBar parent menu bar where menu bar is displayed
+        * @param properties properties to set
+        * @param rootPane root pane to set
+        * @param isOpenedNewLayout flag whatever LayoutDesigner is opened to 
create new layout or to edit already designed layout
+        */
+       public MenuBar(final JMenuBar menuBar, Properties properties,
+                       JRootPane rootPane) {
+
+               this.menuBar = menuBar;
+               this.properties = properties;
+               this.rootPane = rootPane;
+
+               // sets bottom border
+               menuBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
+                               Color.LIGHT_GRAY));
+
+               JMenu menuFile = new JMenu(properties.getProperty("menu.file"));
+               JMenu menuEdit = new JMenu(properties.getProperty("menu.edit"));
+               JMenu menuView = new JMenu(properties.getProperty("menu.view"));
+
+               menuBar.add(menuFile);
+               menuBar.add(menuEdit);
+               menuBar.add(menuView);
+
+               // creates menu items
+               menuItemNew = new JMenuItem(properties.getProperty("menu.new"));
+               menuItemSaveOnServer = new JMenuItem(properties
+                               .getProperty("menu.saveOnServer"));
+               menuItemClose = new 
JMenuItem(properties.getProperty("menu.close"));
+               menuItemCloseAll = new JMenuItem(properties
+                               .getProperty("menu.closeAll"));
+               menuItemChangeResolution = new JMenuItem(properties
+                               .getProperty("menu.changeResolution"));
+               menuItemShowGrid = new JCheckBoxMenuItem(properties
+                               .getProperty("menu.showGrid"));
+               menuItemSnapToGrid = new JCheckBoxMenuItem(properties
+                               .getProperty("menu.snapToGrid"));
+
+               // sets selection state for menu item check box
+               menuItemShowGrid.setSelected(false);
+               menuItemSnapToGrid.setSelected(false);
+
+               // sets menu items accelerators
+               menuItemNew.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
+                               ActionEvent.CTRL_MASK));
+               menuItemSaveOnServer.setAccelerator(KeyStroke.getKeyStroke(
+                               KeyEvent.VK_S, ActionEvent.CTRL_MASK));
+
+               // adds menu items action listeners
+               menuItemNew.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               //openNewLayout();
+                       }
+               });
+
+               menuItemSaveOnServer.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               saveActualLayoutOnServer();
+                       }
+               });
+
+               menuItemClose.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               closeActualTab();
+                       }
+               });
+
+               menuItemCloseAll.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               closeAllTabs();
+                       }
+               });
+
+               menuItemChangeResolution.addActionListener(new ActionListener() 
{
+                       public void actionPerformed(ActionEvent evt) {
+                               changeActualDesignAreaResolution();
+                       }
+
+               });
+
+               menuItemShowGrid.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               enableShowGrid(evt);
+                       }
+               });
+
+               menuItemSnapToGrid.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               enableSnapToGrid(evt);
+                       }
+               });
+
+               menuFile.add(menuItemSaveOnServer);
+               menuFile.add(menuItemClose);
+
+               menuEdit.add(menuItemChangeResolution);
+
+               menuView.add(menuItemShowGrid);
+               menuView.add(menuItemSnapToGrid);
+
+               // sets default cursor for menus
+               setDefaultCursor(menuFile);
+               setDefaultCursor(menuEdit);
+               setDefaultCursor(menuView);
+
+       }
+
+       /**
+        * Sets default cursor for menuBar
+        * 
+        * @param menu the menuBar menu
+        */
+       private void setDefaultCursor(final JMenu menu) {
+
+               menu.addMouseMotionListener(new MouseAdapter() {
+                       public void mouseMoved(MouseEvent e) {
+
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                               if (designArea != null) {
+                                       designArea.actualizeCursor(-1, -1);
+                               }
+                               menuBar.requestFocusInWindow();
+                               menu.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
+                       }
+               });
+               menu.addMouseListener(new MouseAdapter() {
+                       public void mouseClicked(MouseEvent e) {
+
+                               menuBar.requestFocusInWindow();
+                               menu.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
+                       }
+               });
+       }
+
+       /**
+        * Enables or disables snap to grid for the actual layout
+        * 
+        * @param evt action event
+        */
+       private void enableSnapToGrid(ActionEvent evt) {
+
+               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
+               if (actualDesignArea == null) {
+                       return;
+               }
+
+               JCheckBoxMenuItem menuItemSnapToGrid = (JCheckBoxMenuItem) evt
+                               .getSource();
+               if (menuItemSnapToGrid.isSelected()) {
+                       actualDesignArea.setSnapToGridEnabled(true);
+                       actualDesignArea.getMyLayout().setSnappedToGrid(true);
+                       
actualDesignArea.getActionMemory().addActionToActionsMemory(tabbedPane.getActualDesignArea());
+               } else {
+                       actualDesignArea.setSnapToGridEnabled(false);
+                       actualDesignArea.getMyLayout().setSnappedToGrid(false);
+               }
+               
+       }
+
+       /**
+        * Enables or disables showing of grid for the actual layout
+        * 
+        * @param evt action event
+        */
+       private void enableShowGrid(ActionEvent evt) {
+
+               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
+               JCheckBoxMenuItem menuItemShowGrid = (JCheckBoxMenuItem) evt
+                               .getSource();
+               if (menuItemShowGrid.isSelected()) {
+                       actualDesignArea.setShowGridEnabled(true);
+                       actualDesignArea.repaint();
+               } else {
+                       actualDesignArea.setShowGridEnabled(false);
+                       actualDesignArea.repaint();
+               }
+               
actualDesignArea.getActionMemory().addActionToActionsMemory(tabbedPane.getActualDesignArea());
+       }
+
+       /**
+        * Changes resolution of the actual design area
+        */
+       private void changeActualDesignAreaResolution() {
+
+               // shows new resolution choice dialog and sets new resolution
+               ResolutionChoiceDialog resolutionChoiceDialog = new 
ResolutionChoiceDialog(
+                               new JDialog(), properties, 
tabbedPane.getSupportedResolutions(), rootPane);
+               ScreenResolution newResolution = resolutionChoiceDialog
+                               .showResolutionChoiceDialog();
+
+               if (newResolution == null) {
+                       return;
+               }
+
+               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
+               if (actualDesignArea == null) {
+                       return;
+               }
+               Layout layout = actualDesignArea.getMyLayout();
+
+               ScreenResolution oldResolution = layout.getScreenResolution();
+               layout.setScreenResolution(newResolution);
+               layout.setLayoutAspectRatio((double) 
newResolution.getElvysWidth()
+                               / (double) newResolution.getElvysHeight());
+
+               Positions positions = layout.getLayoutPositions();
+               positions.changeElvysResolution(actualDesignArea, oldResolution,
+                               newResolution);
+
+               actualDesignArea.setSize(actualDesignArea.getWidth(), 
actualDesignArea
+                               .getHeight());
+               actualDesignArea.paintAllPositions();
+
+       }
+
+
+
+       /**
+        * Saves actual layout on server
+        */
+       private void saveActualLayoutOnServer() {
+
+               if (tabbedPane == null || tabbedPane.getActualDesignArea() == 
null) {
+                       return;
+               }
+
+               String layoutName = properties
+               .getProperty("dialog.defaultName");
+               Layout layout = tabbedPane.getActualDesignArea().getMyLayout();
+               
+               if(!layout.isNew()) {
+                       layoutName = layout.getName();
+               }
+
+               SaveAsDialog saveAsDialog = new SaveAsDialog(new JDialog(), 
properties,
+                               rootPane, layoutName);
+               String newLayoutName = saveAsDialog.showSaveAsDialog();
+               if (newLayoutName == null) {
+                       return;
+               }
+
+               SaveLayoutOnServer saveLayoutOnServer = new SaveLayoutOnServer(
+                               tabbedPane);
+               String oldLayoutName = tabbedPane.getActualDesignArea()
+                               .getMyLayout().getName();
+               saveLayoutOnServer.saveLayout(oldLayoutName, newLayoutName);
+       }
+
+       /**
+        * Closes actual tab
+        */
+       private void closeActualTab() {
+
+               CloseLayout closeDesignArea = new CloseLayout(tabbedPane, 
properties);
+               
closeDesignArea.closeActualLayout(tabbedPane.getActualDesignArea(),
+                               rootPane);
+               Layout layout = ServerSideContext.getInstance().getLayout();
+               if (layout != null) {
+                       try {
+                               ServerSideContext.getInstance().unlockLayout();
+                       } catch (Exception e) {
+                               e.printStackTrace();
+                       }
+               }
+
+       }
+
+       /**
+        * Closes all tabs
+        */
+       private void closeAllTabs() {
+
+               CloseLayout closeDesignArea = new CloseLayout(tabbedPane, 
properties);
+               closeDesignArea.closeAllLayouts(rootPane);
+
+       }
+
+       /**
+        * Actualizes menu items
+        */
+       public void actualize() {
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               if (designArea == null) {
+
+                       menuItemSaveOnServer.setEnabled(false);
+                       menuItemClose.setEnabled(false);
+                       menuItemCloseAll.setEnabled(false);
+                       menuItemChangeResolution.setEnabled(false);
+                       
+                       menuItemShowGrid.setSelected(false);
+                       menuItemShowGrid.setEnabled(false);
+
+                       menuItemSnapToGrid.setSelected(false);
+                       menuItemSnapToGrid.setEnabled(false);
+
+               }
+
+               else {
+
+                       menuItemSaveOnServer.setEnabled(true);
+                       menuItemClose.setEnabled(true);
+                       menuItemCloseAll.setEnabled(true);
+                       menuItemChangeResolution.setEnabled(true);
+                       
+                       
menuItemShowGrid.setSelected(designArea.getMyLayout().isShowGridEnabled());
+                       menuItemShowGrid.setEnabled(true);
+
+                       
menuItemSnapToGrid.setSelected(designArea.getMyLayout().isSnappedToGrid());
+                       menuItemSnapToGrid.setEnabled(true);
+                       
+                       designArea.repaint();
+               }
+
+       }
+
+       // getters & setters
+       /**
+        * Setter of the field tabbedPane
+        * @param tabbedPane
+        *            the tabbedPane to set
+        */
+       public void setTabbedPane(TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/PopupMenu.java
 (from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/PopupMenu.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/PopupMenu.java
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/PopupMenu.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,269 @@
+package com.elvys.applet.components;
+/**
+ * PopupMenu.java
+ * @author Eva Viktorinova
+ */
+import java.awt.Graphics;
+import java.awt.event.*;
+import java.util.Properties;
+import javax.swing.*;
+
+
+import com.elvys.applet.dialog.WarningDialog;
+import com.elvys.applet.structures.AbsoluteCoordinates;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+
+/**
+ * @class PopupMenu
+ * Popup menu enables to copy, paste and delete actually selected positions
+ */
+@SuppressWarnings("serial")
+public class PopupMenu extends JPopupMenu {
+       private Properties properties;                  /** properties */       
+       private PopupMenu popupMenu;                    /** this popup menu */
+       private DesignArea designArea;                  /** design area which 
corresponds to this menu */
+       private int topX;                                               /** x 
coordinate of place where copied positions are pasted */ 
+       private int topY;                                               /** y 
coordinate of place where copied positions are pasted */
+       private JMenuItem menuItemPaste;                /** menu item for 
pasting of positions */
+       private JMenuItem menuItemCopy;                 /** menu item for 
copying of positions */
+       private JMenuItem menuItemDelete;               /** menu item for 
deleting of positions */
+
+       /**
+        * @class PopupListener 
+        * Listens for changes in popup menu
+        */
+       public class PopupListener extends MouseAdapter {
+               public PopupListener(PopupMenu _popupMenu) {
+                       popupMenu = _popupMenu;
+               }
+               
+               public void mousePressed(MouseEvent e) {
+                       designArea.paintAllPositions();
+                       maybeShowPopup(e);
+               }
+
+               public void mouseReleased(MouseEvent e) {
+                       designArea.paintAllPositions();
+                       maybeShowPopup(e);
+               }
+
+               private void maybeShowPopup(MouseEvent e) {
+                       if (e.isPopupTrigger()) {
+                               popupMenu.show(e.getComponent(), e.getX(), 
e.getY());
+                               popupMenu.topX = e.getX();
+                               popupMenu.topY = e.getY();
+                       }
+               }
+       }
+
+       /**
+        * Constructor of the class PopupMenu. Initializes menu items and sets 
actions for menu items 
+        * @param designArea design area from which this popup menu was 
triggered
+        * @param properties properties
+        */
+       public PopupMenu(DesignArea _designArea, Properties properties) {
+
+               this.setFocusable(false);
+               this.designArea = _designArea;
+               this.properties = properties;
+               designArea.paintAllPositions();
+               
+               // initializes paste menu item
+               menuItemPaste = new 
JMenuItem(properties.getProperty("popupMenu.paste"));
+               
menuItemPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
+                               ActionEvent.CTRL_MASK));
+               menuItemPaste.setFocusable(false);
+
+               menuItemPaste.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               paste(designArea, topX, topY);
+                               menuItemPaste.setEnabled(false);
+                       }
+               });
+
+               this.add(menuItemPaste);
+
+               // initializes copy menu item
+               menuItemCopy = new 
JMenuItem(properties.getProperty("popupMenu.copy"));
+               
menuItemCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
+                               ActionEvent.CTRL_MASK));
+               menuItemCopy.setFocusable(false);
+
+               menuItemCopy.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               copy(designArea);
+                               menuItemPaste.setEnabled(true);
+                       }
+               });
+               this.add(menuItemCopy);
+
+               // initializes delete menu item
+               menuItemDelete = new JMenuItem(properties
+                               .getProperty("popupMenu.delete"));
+               
menuItemDelete.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
+               menuItemDelete.setFocusable(false);
+               
+               menuItemDelete.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               delete(designArea);
+                       }
+               });
+               this.add(menuItemDelete);
+
+       }
+
+       /**
+        * Actualizes popup menu items according to the actual state 
+        * @param designArea design area from which this popup menu was 
triggered
+        */
+       public void actualize(DesignArea designArea) {
+               if(designArea == null) {
+                       menuItemCopy.setEnabled(false);
+                       menuItemDelete.setEnabled(false);
+                       menuItemPaste.setEnabled(false);
+               }
+               else {
+                       
menuItemPaste.setEnabled(designArea.arePositionToPaste());
+                       boolean isAnyPositionSelected  = 
(designArea.getMyLayout().getSelectedPositions().getPositions().size() >= 1);
+                       menuItemCopy.setEnabled(isAnyPositionSelected);
+                       menuItemDelete.setEnabled(isAnyPositionSelected);
+               }
+               
+       }
+       
+       
+       /**
+        * Copies actually selected positions
+        * @param designArea design area where positions are copied
+        */
+       public void copy(DesignArea designArea) {
+
+               Layout layout = designArea.getMyLayout();
+               Positions selectedPositions = layout
+                               .getSelectedPositions();
+
+               designArea.setPositionsToPaste(selectedPositions.clone());
+               designArea.setPositionToPaste(true);
+               
designArea.getTabbedPane().getPropertiesManager().actualizePropertiesTable();
+               designArea.setIsNotMoving(true);
+               designArea.paintAllPositions();
+               designArea.requestFocusInWindow();
+
+       }
+
+       /**
+        * Deletes actually selected positions 
+        * @param designArea design area where positions are deleted
+        */
+       public void delete(DesignArea designArea) {
+
+               Layout layout = designArea.getMyLayout();
+
+               Positions selectedPositions = layout
+                               .getSelectedPositions();
+
+               for (int i = 0; i < selectedPositions.getPositions().size(); 
++i) {
+                       
layout.removePosition(selectedPositions.getPositions().get(i)
+                                       .getId(), designArea);
+               }
+               designArea.setIsNotMoving(true);
+               designArea.setMyLayout(layout);
+               designArea.paintAllPositions();
+               designArea.requestFocusInWindow();
+
+       }
+       
+       /**
+        * Pastes copied positions
+        * @param designArea design area where positions are pasted
+        * @param x x coordinate of place where copied positions are pasted
+        * @param y y coordinate of place where copied positions are pasted
+        */
+
+       public void paste(DesignArea designArea, int x, int y) {
+
+               
+               if (designArea.arePositionToPaste()) {
+
+                       Layout oldLayout = designArea.getMyLayout();
+                       Layout newLayout = oldLayout.clone();
+                       
+                       Positions pastePositions = 
designArea.getPositionsToPaste();
+
+                       int oldX = pastePositions.getMonitorTopX();
+                       int oldY = pastePositions.getMonitorTopY();
+                       
+               
+
+                       int deltaX = x - oldX;
+                       int deltaY = y - oldY;
+
+                       Positions pastedPositions = new Positions();
+                       for (int i = 0; i < 
pastePositions.getPositions().size(); ++i) {
+
+                               Position position = 
pastePositions.getPositions().get(i)
+                                               .clone();
+                               AbsoluteCoordinates monitor = 
position.getMonitor();
+                               monitor.setTopX(monitor.getTopX() + deltaX);
+                               monitor.setTopY(monitor.getTopY() + deltaY);
+                               position.setMonitor(monitor);
+                               position.setElvysFromMonitor(monitor);
+
+                               if(designArea.isSnapToGridEnabled()) {
+                                       position = position.snapToGrid();
+                               }
+                               
+                               
+
+                               Positions allPositions = newLayout
+                                               .getLayoutPositions();
+
+
+                               int pasteDocumentID = 
allPositions.getPositions().size() + 1;
+                               position.setId(pasteDocumentID);
+                               position.setSelected(true);
+                               
newLayout.addPosition(newLayout.getLayoutPositions(), position, position, 
designArea,
+                                                               
Layout.AddType.PASTE, true);
+                               pastedPositions.addPosition(position);
+
+                               
+                               
+                       }
+
+                       
+                       int kiosekWidth = 
oldLayout.getScreenResolution().getElvysWidth();
+                       int kiosekHeight = 
oldLayout.getScreenResolution().getElvysHeight();
+                       
+                       if(newLayout.getLayoutPositions().isOutOf(kiosekWidth, 
kiosekHeight, designArea)) {
+                               new WarningDialog(new JFrame(), 
properties.getProperty("warning.pasteNotAllowed"), 
properties.getProperty("warning.warning"));
+                       }
+                       else {
+                               designArea.setMyLayout(newLayout);
+                               newLayout.selectPositions(pastedPositions);
+                               
designArea.getActionMemory().addActionToActionsMemory(designArea);
+                       }
+                       
+                       
+                       
+                       designArea.requestFocusInWindow();
+
+               }
+       }
+
+
+       /**
+        * Repaints design area if popup menu was triggered
+        * @param g graphics
+        */
+       public void paintComponent(Graphics g) {
+               super.paintComponent(g);
+               if(designArea != null) {
+                       designArea.paintAllPositions();
+               }
+       }
+       
+
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/StatusBar.java
 (from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/StatusBar.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/StatusBar.java
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/StatusBar.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,86 @@
+/**
+ * StatusBar.java
+ * @author Eva Viktorinova
+ */
+package com.elvys.applet.components;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.ScreenResolution;
+
+
+/**
+ * @class StatusBar
+ * Displays actual coordinates of the mouse
+ *
+ */
+@SuppressWarnings("serial")
+public class StatusBar extends JPanel {
+
+       // fields
+       private JLabel mouseCoordinatesLabel;           /** label with mouse 
coordinates */
+       @SuppressWarnings("unused")
+       private TabbedPane tabbedPane;                          /**  tabbed 
pane */
+
+       // constructors
+       /**
+        * Constructor of the class StatusBar
+        * @param statusBar panel where status bar is displayed
+        */
+       public StatusBar(JPanel statusBar) {
+               this.setFocusable(false);
+               int x = 0;
+               int y = 0;
+               String xy = Integer.toString(x) + " : " + Integer.toString(y);
+               mouseCoordinatesLabel = new JLabel(xy);
+               mouseCoordinatesLabel.setFocusable(false);
+               statusBar.add(mouseCoordinatesLabel);
+               
+       }
+
+       // methods
+       /**
+        * Sets new label text according to new mouse coordinates
+        * @param x new mouse x coordinate
+        * @param y new mouse y coordinate
+        */
+       public void actualizeXY(int x, int y) {
+               String xy = Integer.toString(x) + " : " + Integer.toString(y);
+               mouseCoordinatesLabel.setText(xy);
+       }
+       
+       
+       /**
+        * Actualizes mouse coordinates in status bar
+        * @param layout layout of the actual design area
+        * @param x new x coordinate
+        * @param y new y coordinate
+        */
+       public void actualizeStatusBarMouseCoordinates(Layout layout, int x,
+                       int y) {
+
+               ScreenResolution screenResolution = 
layout.getScreenResolution();
+
+               if (x <= screenResolution.getElvysWidth()
+                               && y <= screenResolution.getElvysHeight()) {
+                       actualizeXY(x, y);
+               }
+               else {
+                       actualizeXY(screenResolution.getElvysWidth(), 
screenResolution.getElvysHeight());
+               }
+
+       }
+
+       // getter & setters
+       /**
+        * Setter for the field tabbedPane
+        * @param tabbedPane the tabbedPane to set
+        */
+       public void setTabbedPane(TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
 (from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/TabbedPane.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
                           (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,369 @@
+package com.elvys.applet.components;
+
+/**
+ * TabbedPane.java
+ * @author Eva Viktorinova
+ */
+import java.awt.Cursor;
+import java.awt.Graphics;
+import java.util.Properties;
+import java.util.Vector;
+import javax.swing.JRootPane;
+import javax.swing.JTabbedPane;
+
+
+import com.elvys.applet.propertiesManager.PropertiesManager;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.SupportedResolutions;
+
+/**
+ * @class TabbedPane
+ * In tabbed pane layout are opened to be designed. 
+ */
+@SuppressWarnings("serial")
+public
+class TabbedPane extends JTabbedPane {
+       // fields
+       private JTabbedPane tabbedPane;                                         
        /** tabbed pane where tabbed pane is displayed */
+       private Properties properties;                                          
        /** properties */
+       private Vector<String> allTypesOfDocuments;                             
/** all permitted types of documents */
+       private PropertiesManager propertiesManager;                    /** 
properties manager */
+       private StatusBar statusBar;                                            
        /** status bar */
+       private ToolBar toolBar;                                                
                /** tool bar */
+       private MenuBar menuBar;                                                
                /** menu bar */
+       private JRootPane rootPane;                                             
                /** root pane of the LayoutDesigner */
+       private ComponentSizes componentSizes;                                  
/** size of components */
+       private SupportedResolutions supportedResolutions;              /** 
supported resolutions */
+       
+               
+
+       // constructors
+       /**
+        * Constructor of the class TabbedPane
+        * @param properties properties to set
+        * @param allTypesOfDocuments all types of documents to set
+        */
+       public TabbedPane(Properties properties, Vector<String> 
allTypesOfDocuments) {
+               this.setAllTypesOfDocuments(allTypesOfDocuments);
+               this.setProperties(properties);
+               this.setFocusable(false);
+       }
+
+       // methods
+       /**
+        * Adds new tab with new design area to tabbed pane
+        * @param tabName name of the new layout
+        * @param newDesignArea design area where layout is designed
+        */
+       public void addNewTab(String tabName, DesignArea newDesignArea) {
+
+               addTab(tabName, newDesignArea);
+               setSelectedComponent(newDesignArea);
+               setTabComponentAt(getSelectedIndex(), new 
TabbedPaneCloseTabButton(this,
+                               tabName, newDesignArea));
+
+               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) {
+               return ((DesignArea) 
this.getComponentAt(layoutTabID)).isSaved();
+       }
+
+       /**
+        * Finds whatever layout at actual design area is saved 
+        * @return whatever layout at actual design area is saved
+        */
+       public boolean isActualLayoutSaved() {
+               return ((DesignArea) this.getSelectedComponent()).isSaved();
+       }
+
+       /**
+        * 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 ((DesignArea) this.getComponentAt(layoutTabID))
+                               .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 ((DesignArea) this.getSelectedComponent())
+                               .getMyLayout().getName();
+       }
+
+       /** 
+        * Gets actual design area
+        * @return actual design area
+        */
+       public DesignArea getActualDesignArea() {
+               if (this.getComponentCount() == 0) {
+                       return null;
+               }
+               return ((DesignArea) this.getSelectedComponent());
+       }
+
+       /**
+        * 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 ((DesignArea) this.getComponentAt(layoutTabID));
+       }
+
+       
+       /**
+        * Actualizes all components according to the actual state of the 
LayoutDesigner
+        */
+       private void actualizeAllComponents() {
+
+               DesignArea designArea = getActualDesignArea();
+               if (designArea == null) {
+                       this.getToolBar().setEnabledForAllButtons(false);
+
+                       
this.getPropertiesManager().actualizePropertiesTableFields();
+                       this.getPropertiesManager().actualizeDocumentTypes();
+                       this.getPropertiesManager().actualizePositionsList();
+
+                       this.getMenuBar().setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
+                       this.getMenuBar().actualize();
+
+               } else {
+
+                       designArea.getPopupMenu().actualize(designArea);
+                       this.getToolBar().setEnabledForAllButtons(true);
+                       toolBar.actualizeMemoryActionButtons(designArea);
+
+                       if 
(!this.getPropertiesManager().isPropertiesTableFocusOwner()) {
+                               
this.getPropertiesManager().actualizePropertiesTableFields();
+                               
this.getPropertiesManager().actualizePropertiesTable();
+                       }
+                       this.getPropertiesManager().actualizePositionsList();
+
+                       this.getMenuBar().actualize();
+                       designArea.paintAllPositions();
+
+                       int layoutCount = getTabCount();
+                       // setSelectedIndex(0);
+                       for (int i = 0; i < layoutCount; ++i) {
+                               DesignArea actual = (DesignArea) 
getComponentAt(i);
+
+                               String layoutName = actual.getMyLayout()
+                                               .getName();
+
+                               if (!actual.isSaved()) {
+                                       layoutName = 
actual.getMyLayout().getNotSavedName();
+                               }
+
+                               TabbedPaneCloseTabButton buttonTab = 
(TabbedPaneCloseTabButton) getTabComponentAt(i);
+                               buttonTab.setNewTabTitle(layoutName);
+
+                       }
+                       
+                       this.getMenuBar().setCursor(new 
Cursor(Cursor.WAIT_CURSOR));
+               }
+
+       }
+
+       /**
+        * Paints tabbed pane
+        * @param g graphics
+        */
+       public void paintComponent(Graphics g) {
+               super.paintComponent(g);
+               actualizeAllComponents();
+       }
+
+       /**
+        * Changes title of the tab to the title of unsaved file
+        * @return
+        */
+       public void changeActualTitleToNotSavedTitle(Layout layout) {
+               
+               String notSavedFileName = layout.getNotSavedName();
+               setTitleAt(getSelectedIndex(), notSavedFileName);
+       }
+
+       // getters & setters
+
+
+       /**
+        * Getter for the field tabbedPane
+        * @return the tabbedPane
+        */
+       public JTabbedPane getTabbedPane() {
+               return tabbedPane;
+       }
+
+       /**
+        * Setter for the field tabbedPane 
+        * @param tabbedPane
+        *            the tabbedPane to set
+        */
+       public void setTabbedPane(JTabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+       /**
+        * Getter for the field propertiesManager
+        * @return the propertiesManager
+        */
+       public PropertiesManager getPropertiesManager() {
+               return propertiesManager;
+       }
+
+       /**
+        * Setter for the field propertiesManager
+        * @param propertiesManager
+        *            the propertiesManager to set
+        */
+       public void setPropertiesManager(PropertiesManager propertiesManager) {
+               this.propertiesManager = propertiesManager;
+       }
+
+       /**
+        * Getter for the field statusBar
+        * @return the statusBar
+        */
+       public StatusBar getStatusBar() {
+               return statusBar;
+       }
+
+       /**
+        * Getter for the field statusBar
+        * @param statusBar
+        *            the statusBar to set
+        */
+       public void setStatusBar(StatusBar statusBar) {
+               this.statusBar = statusBar;
+       }
+
+       /**
+        * Getter for the field toolBar
+        * @return the toolBar
+        */
+       public ToolBar getToolBar() {
+               return toolBar;
+       }
+
+       /**
+        * Setter for the field toolBar
+        * @param toolBar
+        *            the toolBar to set
+        */
+       public void setToolBar(ToolBar toolBar) {
+               this.toolBar = toolBar;
+       }
+
+       /**
+        * Setter for the field menuBar
+        * @param menuBar
+        *            the menuBar to set
+        */
+       public void setMenuBar(MenuBar menuBar) {
+               this.menuBar = menuBar;
+       }
+
+       /**
+        * Getter for the field menuBar
+        * @return the menuBar
+        */
+       public MenuBar getMenuBar() {
+               return menuBar;
+       }
+
+       /**
+        * Setter for the field properties
+        * @param properties
+        *            the properties to set
+        */
+       public void setProperties(Properties properties) {
+               this.properties = properties;
+       }
+
+       /**
+        * Getter for the field properties
+        * @return the properties
+        */
+       public Properties getProperties() {
+               return properties;
+       }
+
+       /**
+        * Setter for the field allTypesOfDocuments
+        * @param allTypesOfDocuments
+        *            the allTypesOfDocuments to set
+        */
+       public void setAllTypesOfDocuments(Vector<String> allTypesOfDocuments) {
+               this.allTypesOfDocuments = allTypesOfDocuments;
+       }
+
+       /**
+        * Getter for the field allTypesOfDocuments
+        * @return the allTypesOfDocuments
+        */
+       public Vector<String> getAllTypesOfDocument() {
+               return allTypesOfDocuments;
+       }
+
+       /**
+        * Setter for the field componentSizes
+        * @param componentSizes
+        *            the componentSizes to set
+        */
+       public void setComponentSizes(ComponentSizes componentSizes) {
+               this.componentSizes = componentSizes;
+       }
+
+       /**
+        * Getter for the field componentSizes
+        * @return the componentSizes
+        */
+       public ComponentSizes getComponentSizes() {
+               return componentSizes;
+       }
+
+       /**
+        * Setter for the field rootPane
+        * @param rootPane
+        *            the rootPane to set
+        */
+       public void setRootPane(JRootPane appletRootPane) {
+               this.rootPane = appletRootPane;
+       }
+
+       /**
+        * Getter for the field rootPane
+        * @return the rootPane
+        */
+       public JRootPane getRootPane() {
+               return rootPane;
+       }
+
+       /**
+        * Setter for the field supportedResolutions
+        * @param supportedResolutions the supportedResolutions to set
+        */
+       public void setSupportedResolutions(SupportedResolutions 
supportedAspectRatios) {
+               this.supportedResolutions = supportedAspectRatios;
+       }
+
+       /**
+        * Getter for the filed supportedResolutions
+        * @return the supportedResolutions
+        */
+       public SupportedResolutions getSupportedResolutions() {
+               return supportedResolutions;
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/TabbedPaneCloseTabButton.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
                             (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
     2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,126 @@
+package com.elvys.applet.components;
+
+/**
+ * TabbedPaneCloseTabButton.java
+ * @author EvaV
+ */
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.plaf.basic.BasicButtonUI;
+
+import com.elvys.applet.structures.CloseLayout;
+
+
+@SuppressWarnings("serial")
+/**
+ * TabbedPaneCloseTabButton implements cross button which enables to close tab 
of main tabbed pane  
+ */
+public class TabbedPaneCloseTabButton extends JPanel {
+       private final TabbedPane tabbedPane;    /** main tabbed pane */
+       private DesignArea designArea;                  /** design area 
corresponding to this tab */
+       private JLabel tabTitleLabel;                   /** title of the tab - 
name of the layout of design area */
+
+       /**
+        * Constructor of the class TabbedPaneCloseTabButton
+        * @param tabbedPane main tabbed pane
+        * @param tabTitleText title of the tab - name of the layout of design 
area 
+        * @param designArea design area corresponding to this tab 
+        */
+       public TabbedPaneCloseTabButton(TabbedPane tabbedPane, String 
tabTitleText,
+                       DesignArea designArea) {
+       
+               super(new FlowLayout(FlowLayout.LEFT, 0, 0));
+
+               
+               this.tabbedPane = tabbedPane;
+               this.designArea = designArea;
+               this.setOpaque(false);
+               this.setFocusable(false);
+
+               tabTitleLabel = new JLabel(tabTitleText);
+               
+               add(tabTitleLabel);
+               tabTitleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 
0, 2));
+               tabTitleLabel.setFocusable(false);
+               
+               JButton button = new CrossCloseButton();
+               add(button);
+
+               setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
+       }
+
+       /**
+        * Sets new title for the actual tab
+        * @param newTitle new title to set
+        */
+       public void setNewTabTitle(String newTitle) {
+               tabTitleLabel.setText(newTitle);
+               repaint();
+
+       }
+
+       /**
+        * @class CrossCloseButton
+        * CrossCloseButton displays button which enables to close tab 
+        * 
+        */
+       private class CrossCloseButton extends JButton implements 
ActionListener {
+               private final static int CROSS_BUTTON_SIZE = 17;        /** 
size of the cross button */
+               private final static int DELTA = 6;                             
        /** size of the cross */
+               
+               /**
+                * Constructor of the class CrossCloseButton
+                */
+               public CrossCloseButton() {
+                       setPreferredSize(new Dimension(CROSS_BUTTON_SIZE, 
CROSS_BUTTON_SIZE));
+                       setUI(new BasicButtonUI());
+                       setContentAreaFilled(false);
+                       setBorder(BorderFactory.createEtchedBorder());
+                       setBorderPainted(false);
+                       setRolloverEnabled(true);
+                       addActionListener(this);
+               }
+
+               /**
+                * Handles closing of the tab
+                * @param e action event
+                */
+               public void actionPerformed(ActionEvent e) {
+
+                       CloseLayout closeDesignArea = new 
CloseLayout(tabbedPane, tabbedPane
+                                       .getProperties());
+                       closeDesignArea.closeActualLayout(designArea, 
tabbedPane.getRootPane());
+               }
+
+
+               /**
+                * Paints the close cross
+                * @param g graphics 
+                */
+               protected void paintComponent(Graphics g) {
+                       super.paintComponent(g);
+                       Graphics2D g2 = (Graphics2D) g.create();
+                       
+                       g2.setStroke(new BasicStroke(2));
+                       g2.setColor(Color.BLACK);
+                
+                       g2.drawLine(DELTA, DELTA, getWidth() - DELTA - 1, 
getHeight()
+                                       - DELTA - 1);
+                       g2.drawLine(getWidth() - DELTA - 1, DELTA, DELTA, 
getHeight()
+                                       - DELTA - 1);
+                       g2.dispose();
+               }
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java 
(from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/ToolBar.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,593 @@
+package com.elvys.applet.components;
+
+/**
+ * ToolBar.java
+ * @author Eva Viktorinova
+ */
+import java.awt.*;
+import java.awt.event.*;
+
+import javax.swing.BorderFactory;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JTabbedPane;
+import javax.swing.JToolBar;
+
+import com.elvys.applet.structures.ActionsMemory;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.ScreenResolution;
+
+
+/**
+ * @class ToolBar 
+ * Toolbar displays tools which allows manipulating with the LayoutDesigner
+ */
+
+@SuppressWarnings("serial")
+public class ToolBar extends JToolBar {
+       // fields
+       private TabbedPane tabbedPane;                          /** tabbed pane 
*/
+       private JButton designPositionButton;           /** enables or disables 
designing of positions */
+       private JButton backwardButton;                         /** goes 
backward in memory of actions */
+       private JButton forwardButton;                          /** goes 
forward in memory of actions */ 
+       private JButton centerHorizontalButton;         /** centers 
horizontally selected positions */
+       private JButton centerVerticalButton;           /** centers vertically 
selected positions */    
+       private JButton sameTopButton;                          /** aligns 
selected positions to the same top */
+       private JButton sameBottomButton;                       /** aligns 
selected positions to the same bottom */
+       private JButton sameLeftButton;                         /** aligns 
selected positions to the same left */
+       private JButton sameRightButton;                        /** aligns 
selected positions to the same right */
+       private JButton propertiesManagerButton;        /** makes visible 
properties manager */
+       private String urlString;                                       /** url 
of toolbar buttons location */
+
+       // constants
+       private final static int BORDER_SIZE = 1;                               
/** size of border of toolbar buttons */
+       private final static int CENTER_MIN_COUNT = 3;                  /** min 
count of selected positions for centering */
+       private final static int SAME_COORDINATE_MIN_COUNT = 2; /** min count 
of selected positions for aligning */
+
+       // methods
+       /**
+        * Enables or disables designing of positions
+        * 
+        * @param enabled enabled to set
+        */
+       public void designPositionButtonSetEnabled(boolean enabled) {
+               designPositionButton.setEnabled(enabled);
+               Icons icons = new Icons(urlString);
+               if (!enabled) {
+                       designPositionButton.setIcon(new 
ImageIcon(icons.getSelectDisabledImage()));
+               } else {
+                       if (tabbedPane.getActualDesignArea().isInDesignMode()) {
+                               designPositionButton.setIcon(new 
ImageIcon(icons.getDesignEnabledImage()));
+                       } else {
+                               designPositionButton.setIcon(new 
ImageIcon(icons.getSelectEnabledImage()));
+                       }
+               }
+
+       }
+
+       /**
+        * Enables going forward in memory of actions
+        * @param enabled enabled to set
+        */
+       public void forwardButtonSetEnabled(boolean enabled) {
+               forwardButton.setEnabled(enabled);
+       }
+
+       /** Enables going backward in memory of actions
+        * @param enabled enabled to set
+        */
+       public void backwardButtonSetEnabled(boolean enabled) {
+               backwardButton.setEnabled(enabled);
+       }
+
+       /**
+        * Enables horizontal centering of actually selected positions
+        * @param enabled enabled to set
+        */
+       public void centerHorizontalButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if (designArea.getMyLayout()
+                                       .getSelectedPositions().size() < 
CENTER_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               centerHorizontalButton.setEnabled(enabled);
+       }
+
+       /** 
+        * Enables vertical centering of actually selected positions 
+        * @param enabled enabled to set
+        */
+       public void centerVerticalButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if 
(designArea.getMyLayout().getSelectedPositions().size() < CENTER_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               centerVerticalButton.setEnabled(enabled);
+
+       }
+
+       /**
+        * Enables aligning of actually selected position to the same top
+        * @param enabled enabled to set
+        */
+       public void sameTopButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if (designArea.getMyLayout()
+                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               sameTopButton.setEnabled(enabled);
+
+       }
+
+       /**
+        * Enables aligning of actually selected positions to the same bottom
+        * @param enabled enabled to set
+        */
+       public void sameBottomButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if (designArea.getMyLayout()
+                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               sameBottomButton.setEnabled(enabled);
+
+       }
+
+       /** 
+        * Enables aligning of actually selected positions to the same right 
+        * @param enabled enabled to set
+        */
+       public void sameRightButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if (designArea.getMyLayout()
+                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               sameRightButton.setEnabled(enabled);
+
+       }
+
+       /** 
+        * Enables aligning of actually selected positions to the same left
+        * @param enabled enabled to set
+        */
+       public void sameLeftButtonSetEnabled(boolean enabled) {
+
+               if (enabled) {
+                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                       if (designArea == null) {
+                               return;
+                       }
+                       if (designArea.getMyLayout()
+                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
+                               enabled = false;
+                       }
+               }
+               sameLeftButton.setEnabled(enabled);
+
+       }
+
+       
+       /**
+        * Enables centering and aligning buttons
+        * @param enabled enabled to set
+        */
+       public void setEnabledForCenterAndAlignButtons(boolean enabled) {
+
+               this.centerHorizontalButtonSetEnabled(enabled);
+               this.centerVerticalButtonSetEnabled(enabled);
+
+               this.sameBottomButtonSetEnabled(enabled);
+               this.sameLeftButtonSetEnabled(enabled);
+               this.sameRightButtonSetEnabled(enabled);
+               this.sameTopButtonSetEnabled(enabled);
+
+       }
+
+       /**
+        * Enables all buttons 
+        * @param enabled enabled to set
+        */
+       public void setEnabledForAllButtons(boolean enabled) {
+
+               this.backwardButtonSetEnabled(enabled);
+               this.centerHorizontalButtonSetEnabled(enabled);
+               this.centerVerticalButtonSetEnabled(enabled);
+               this.designPositionButtonSetEnabled(enabled);
+               this.forwardButtonSetEnabled(enabled);
+
+               this.sameBottomButtonSetEnabled(enabled);
+               this.sameLeftButtonSetEnabled(enabled);
+               this.sameRightButtonSetEnabled(enabled);
+               this.sameTopButtonSetEnabled(enabled);
+
+       }
+       
+       /**
+        * Sets border for button in toolbar
+        * 
+        * @param toolbarButton
+        *            button in toolbar
+        */
+       private void setToolbarButtonBorder(final JButton toolbarButton) {
+               
toolbarButton.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE,
+                               BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
+               toolbarButton.addMouseListener(new MouseAdapter() {
+                       public void mouseEntered(MouseEvent e) {
+                               if (toolbarButton.isEnabled()) {
+                                       toolbarButton.setBorder(BorderFactory
+                                                       
.createLineBorder(Color.black));
+                               } else {
+                                       toolbarButton
+                                                       
.setBorder(BorderFactory.createEmptyBorder(
+                                                                       
BORDER_SIZE, BORDER_SIZE, BORDER_SIZE,
+                                                                       
BORDER_SIZE));
+                               }
+                       }
+
+                       public void mouseExited(MouseEvent e) {
+                               
toolbarButton.setBorder(BorderFactory.createEmptyBorder(
+                                               BORDER_SIZE, BORDER_SIZE, 
BORDER_SIZE, BORDER_SIZE));
+                       }
+               });
+       }
+       
+       /**
+        * Actualizes forward and backward buttons in toolbar according to the 
state of the actual design area
+        * @param actualDesignArea the actual design area 
+        */
+       public void actualizeMemoryActionButtons(DesignArea actualDesignArea) {
+               if (actualDesignArea.getActionMemory().getBackward().size() == 
1) {
+                       
actualDesignArea.getTabbedPane().getToolBar().backwardButtonSetEnabled(
+                                       false);
+               } else {
+                       
actualDesignArea.getTabbedPane().getToolBar().backwardButtonSetEnabled(
+                                       true);
+               }
+
+               if (actualDesignArea.getActionMemory().getForward().isEmpty()) {
+                       actualDesignArea.getTabbedPane().getToolBar()
+                                       .forwardButtonSetEnabled(false);
+               } else {
+                       actualDesignArea.getTabbedPane().getToolBar()
+                                       .forwardButtonSetEnabled(true);
+               }
+       }
+
+       // constructors
+       
+       /**
+        * Constructor of the class ToolBar. Initializes buttons in toolbar and 
their actions
+        * @param toolBar tool bar where this toolbar is displayed
+        * @param _urlString location of icons for buttons
+        * @param propertiesManagerTabbedPane tabbed pane with properties 
manager
+        * @param layoutTabbedPane tabbed pane with layouts
+        */
+       public ToolBar(JToolBar toolBar, String _urlString,
+                       final JTabbedPane propertiesManagerTabbedPane,
+                       final TabbedPane layoutTabbedPane) {
+
+               toolBar.setFloatable(false);
+               toolBar.setRollover(false);
+               this.tabbedPane = layoutTabbedPane;
+               urlString = _urlString;
+               Insets insets = new Insets(1, 1, 1, 1);
+               toolBar.setMargin(insets);
+
+               // toolBar.setFocusable(false);
+
+               Icons icons = new Icons(urlString);
+
+               propertiesManagerButton = new JButton(tabbedPane.getProperties()
+                               .getProperty("propertiesManager.label"));
+               propertiesManagerButton.setVisible(false);
+               propertiesManagerButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               propertiesManagerTabbedPane.setVisible(true);
+                               propertiesManagerButton.setVisible(false);
+
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                               if (designArea == null) {
+                                       return;
+                               }
+                               ScreenResolution screenSizes = designArea
+                                               
.getMyLayout().getScreenResolution();
+
+                               Layout layout = designArea.getMyLayout();
+                               ScreenResolution newScreenSizes = new 
ScreenResolution(
+                                               screenSizes.getElvysWidth(), 
screenSizes
+                                                               
.getElvysHeight());
+
+                               layout.setScreenResolution(newScreenSizes);
+                               
designArea.setSize(newScreenSizes.getMonitorWidth(),
+                                               
newScreenSizes.getMonitorHeight());
+
+                               Positions positions = 
layout.getLayoutPositions();
+                               positions.changeMonitorResolution(designArea, 
screenSizes,
+                                               newScreenSizes);
+
+                       }
+               });
+
+               Icon icon = new ImageIcon(icons.getSelectEnabledImage());
+
+               designPositionButton = new JButton(icon);
+               designPositionButton.setEnabled(false);
+               designPositionButton.setDisabledIcon(new 
ImageIcon(icons.getSelectDisabledImage()));
+               
designPositionButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
+
+               // pushing document button enables designing in the selected 
design area
+               designPositionButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+
+                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
+                                               .getSelectedComponent();
+                               boolean isEnabledToDesign = selectedDesignArea
+                                               .isInDesignMode();
+                               Icons icons = new Icons(urlString);
+                               if (isEnabledToDesign) {
+                                       designPositionButton
+                                                       .setIcon(new 
ImageIcon(icons.getSelectEnabledImage()));
+                                       selectedDesignArea.setCursor(new Cursor(
+                                                       Cursor.DEFAULT_CURSOR));
+                               } else {
+                                       designPositionButton.setIcon(new 
ImageIcon(icons.getDesignEnabledImage()));
+
+                                       selectedDesignArea.setCursor(new Cursor(
+                                                       
Cursor.CROSSHAIR_CURSOR));
+                               }
+                               selectedDesignArea
+                                               
.setInDesignMode(!isEnabledToDesign);
+
+                       }
+               });
+
+               icon = new ImageIcon(icons.getBackwardEnabledImage());
+
+               backwardButton = new JButton(icon);
+
+               backwardButton.setDisabledIcon(new 
ImageIcon(icons.getBackwardDisabledImage()));
+               backwardButton.setEnabled(false);
+
+
+               backwardButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
+                                               .getSelectedComponent();
+                               ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
+                                               .getActionMemory();
+                               
selectedDesignAreaActionMemory.backwardAction(selectedDesignArea);
+
+                       }
+               });
+
+               forwardButton = new JButton(new 
ImageIcon(icons.getForwardEnabledImage()));
+               forwardButton.setDisabledIcon(new 
ImageIcon(icons.getForwardDisabledImage()));
+
+               forwardButton.setEnabled(false);
+               forwardButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
+                                               .getSelectedComponent();
+                               ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
+                                               .getActionMemory();
+                               selectedDesignAreaActionMemory
+                                               
.forwardAction(selectedDesignArea);
+
+                       }
+               });
+
+               sameTopButton = new JButton(new 
ImageIcon(icons.getSameTopEnabledImage()));
+               sameTopButton.setDisabledIcon(new 
ImageIcon(icons.getSameTopDisabledImage()));
+               sameTopButton.setEnabled(false);
+               sameTopButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {          
 
+                           DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.setSameTopCoordinate(designArea);
+                       }
+               });
+
+               sameBottomButton = new JButton(
+                               new 
ImageIcon(icons.getSameBottomEnabledImage()));
+               sameBottomButton.setDisabledIcon(new ImageIcon(icons
+                               .getSameBottomDisabledImage()));
+               sameBottomButton.setEnabled(false);
+               sameBottomButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.setSameBottomCoordinate(designArea);
+                       }
+               });
+
+               sameLeftButton = new JButton(new 
ImageIcon(icons.getSameLeftEnabledImage()));
+               sameLeftButton
+                               .setDisabledIcon(new 
ImageIcon(icons.getSameLeftDisabledImage()));
+               sameLeftButton.setEnabled(false);
+               sameLeftButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.setSameLeftCoordinate(designArea);
+                       }
+               });
+
+               sameRightButton = new JButton(new 
ImageIcon(icons.getSameRightEnabledImage()));
+               sameRightButton.setDisabledIcon(new ImageIcon(icons
+                               .getSameRightDisabledImage()));
+               sameRightButton.setEnabled(false);
+
+               sameRightButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.setSameRightCoordinate(designArea);
+                       }
+               });
+
+               centerHorizontalButton = new JButton(new 
ImageIcon(icons.getCenterHorEnabledImage()));
+               centerHorizontalButton.setDisabledIcon(new ImageIcon(icons
+                               .getCenterHorDisabledImage()));
+               centerHorizontalButton.setEnabled(false);
+               centerHorizontalButton.addActionListener(new ActionListener() {
+
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.centerHorizontal(designArea);
+                       }
+               });
+
+               centerVerticalButton = new JButton(new 
ImageIcon(icons.getCenterVerEnabledImage()));
+               centerVerticalButton
+                               .setDisabledIcon(new 
ImageIcon(icons.getCenterVerDisabledImage()));
+               centerVerticalButton.setEnabled(false);
+               centerVerticalButton.addActionListener(new ActionListener() {
+
+                       public void actionPerformed(ActionEvent evt) {
+                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
+                           Layout layout = designArea.getMyLayout();
+                           layout.centerVertical(designArea);
+                       }
+               });
+
+               // sets toolbar's buttons border
+               setToolbarButtonBorder(backwardButton);
+               setToolbarButtonBorder(centerHorizontalButton);
+               setToolbarButtonBorder(centerVerticalButton);
+               setToolbarButtonBorder(designPositionButton);
+               setToolbarButtonBorder(forwardButton);
+               setToolbarButtonBorder(sameBottomButton);
+               setToolbarButtonBorder(sameLeftButton);
+               setToolbarButtonBorder(sameRightButton);
+               setToolbarButtonBorder(sameTopButton);
+
+               // there is not need to be focusable
+               this.setFocusable(false);
+               this.backwardButton.setFocusable(false);
+               this.centerHorizontalButton.setFocusable(false);
+               this.centerVerticalButton.setFocusable(false);
+               this.designPositionButton.setFocusable(false);
+               this.forwardButton.setFocusable(false);
+               this.sameBottomButton.setFocusable(false);
+               this.sameLeftButton.setFocusable(false);
+               this.sameRightButton.setFocusable(false);
+               this.sameTopButton.setFocusable(false);
+
+               
+               // 
+               //this.backButton.setMnemonic(KeyEvent.VK_Z);
+               //this.forwardButton.setMnemonic(KeyEvent.VK_Y);
+               
+               // adds tool tip text to buttons
+
+               
designPositionButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.draw"));
+               
backwardButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.back"));
+               
forwardButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.forward"));
+               
sameTopButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.sameTop"));
+               
sameBottomButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.sameBottom"));
+               
sameRightButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.sameRight"));
+               
sameLeftButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.sameLeft"));
+               
centerVerticalButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.centerVertical"));
+               
centerHorizontalButton.setToolTipText(tabbedPane.getProperties().getProperty(
+                               "toolbar.centerHorizontal"));
+
+               // adds buttons to tool bar
+
+               toolBar.add(designPositionButton);
+               toolBar.addSeparator();
+               toolBar.add(backwardButton);
+               toolBar.add(forwardButton);
+               toolBar.addSeparator();
+               toolBar.add(sameTopButton);
+               toolBar.add(sameBottomButton);
+               toolBar.add(sameLeftButton);
+               toolBar.add(sameRightButton);
+               toolBar.addSeparator();
+               toolBar.add(centerHorizontalButton);
+               toolBar.add(centerVerticalButton);
+               toolBar.addSeparator();
+               toolBar.add(propertiesManagerButton);
+       }
+
+
+       /*
+        * Getters & setters
+        */
+
+       /**
+        * Setter for the field tabbedPane
+        * @param tabbedPane
+        *            the tabbedPane to set
+        */
+       public void setTabbedPane(TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+       /**
+        * Getter for the field tabbedPane
+        * @return the tabbedPane
+        */
+       public TabbedPane getTabbedPane() {
+               return tabbedPane;
+       }
+
+       /**
+        * Getter for the field propertiesManagerButton
+        * @return the propertiesManagerButton
+        */
+       public JButton getPropertiesManagerButton() {
+               return propertiesManagerButton;
+       }
+
+       /**
+        * Setter for the field propertiesManagerButton
+        * @param propertiesManagerButton
+        *            the propertiesManagerButton to set
+        */
+       public void setPropertiesManagerButton(JButton propertiesManagerButton) 
{
+               this.propertiesManagerButton = propertiesManagerButton;
+       }
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/ResolutionChoiceDialog.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
                           (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,237 @@
+package com.elvys.applet.dialog;
+/**
+ * ResolutionChoiceDialog.java
+ * @author Eva Viktorinova
+ */
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+
+import com.elvys.applet.structures.ScreenResolution;
+import com.elvys.applet.structures.SupportedResolutions;
+
+
+/**
+ * @class ResolutionChoiceDialog
+ * Resolution choice dialog allows choosing of resolution for opened layout
+ */
+@SuppressWarnings("serial")
+public class ResolutionChoiceDialog extends JDialog implements ActionListener,
+               PropertyChangeListener {
+       // fields
+       private JComboBox resolutionList;               /** combo box with list 
of resolutions */ 
+       private int kioskWidth = 0;                             /** chosen 
width of kiosk */
+       private int kioskHeight = 0;                    /** chosen height of 
kiosk */
+       private boolean isNotSet = false;               /** flag whatever 
resolution was chosen */
+       private SupportedResolutions supportedResolutions;              /** 
supported resolutions */
+       private JOptionPane optionPane;                 /** option pane */
+       private String okButtonName;                    /** name of the button 
which confirms dialog choice */
+       private String cancelButtonName;                /** name of the button 
which cancels dialog choice */
+       private ResolutionChoiceDialog resolutionChoiceDialog;  /** this 
resolution choice dialog */
+       private JRootPane rootPane;                             /** root pane 
of the design area */
+       private JDialog dialog;                                 /** parent 
dialog where resolution choice dialog is shown */
+
+       
+       // classes
+       /**
+        * @class ResolutionListItem
+        * Represents item displayed in combo box 
+        */
+       private class ResolutionListItem {
+               private String itemName;        /** name of the item in 
resolution list */ 
+               private int kioskWidth;         /** width of kiosk */
+               private int kioskHeight;        /** height of kiosk */
+               
+               /**
+                * Constructor of the class ResolutionListItem
+                * @param itemName item name to set
+                * @param kioskWidth width of kiosk to set
+                * @param kiskHeight height of kiosk to set
+                */
+               public ResolutionListItem(String itemName, int kioskWidth, int 
kioskHeight) {
+                       this.itemName = itemName;
+                       this.kioskWidth = kioskWidth;
+                       this.kioskHeight = kioskHeight;
+               }
+               
+               /**
+                * Gets name of item
+                */
+               public String toString() {
+                       return itemName;
+               }
+       }
+       
+       /**
+        * Prepares resolution list displayed in combo box
+        * @return items for resolution list
+        */
+       private Vector<ResolutionListItem> prepareResolutionList() {
+               
+               Vector<ResolutionListItem> resolutionList = new 
Vector<ResolutionListItem>();
+               for (int i = 0; i < supportedResolutions.size(); ++i) {
+                       Vector<String> resolutionsString = 
supportedResolutions.get(i).getResolutionsString();
+                       Vector<ScreenResolution> resolutions = 
supportedResolutions.get(i).getResolutions();
+                       String basicResolution = 
supportedResolutions.get(i).getBasicResolution();
+                       for (int j = 0; j < resolutionsString.size(); ++j) {
+                               String itemName = resolutionsString.get(j) + " 
(" + basicResolution + ")";
+                               ResolutionListItem item = new 
ResolutionListItem(itemName, resolutions.get(j).getElvysWidth(), 
resolutions.get(j).getElvysHeight());
+                               resolutionList.add(item);
+                       }
+               }
+               
+               if(resolutionList.isEmpty()) {
+                       resolutionList.add(new ResolutionListItem("16x9: 
1600x900", 1600, 900));
+                       resolutionList.add(new ResolutionListItem("12x9: 
1200x900", 1200, 900));
+               }
+               return resolutionList;
+       }
+       
+       /**
+        * Shows resolution choice dialog and sets resolution of the screens
+        * @return screen resolution chosen in dialog
+        */
+       public ScreenResolution showResolutionChoiceDialog() {
+               
+               dialog.pack();
+               dialog.setLocationRelativeTo(rootPane);
+               resolutionChoiceDialog.pack();
+               resolutionChoiceDialog.setLocationRelativeTo(rootPane);
+               resolutionChoiceDialog.setVisible(true);
+
+               if (resolutionChoiceDialog.isNotSet()) {
+                       return null;
+               }
+
+               return new ScreenResolution(resolutionChoiceDialog
+                               .getKioskWidth(), 
resolutionChoiceDialog.getKioskHeight());
+
+       }
+
+       /**
+        * Constructor of the class ResolutionChoiceDialog. Initializes 
ResolutionChoiceDialog components.
+        * @param dialog parent dialog to set
+        * @param properties properties to set
+        * @param supportedResolution supported resolutions to set
+        */
+       public ResolutionChoiceDialog(JDialog dialog, Properties properties,
+                       SupportedResolutions supportedResolution, JRootPane 
rootPane) {
+               super(dialog, 
properties.getProperty("dialog.resolutionChoice"), true);
+               this.resolutionChoiceDialog = this;
+               this.supportedResolutions = supportedResolution;
+               this.dialog = dialog;
+               this.rootPane = rootPane;
+               
+
+               // create an array of the components to be displayed
+               resolutionList = new JComboBox();
+               Vector<ResolutionListItem> ratioStrings = 
prepareResolutionList();
+               resolutionList.setModel(new DefaultComboBoxModel(ratioStrings));
+               
+               resolutionList.setSelectedIndex(0);
+               Object[] array = { resolutionList };
+
+               // create an array specifying the number of dialog buttons and 
their text
+               okButtonName = properties.getProperty("dialog.OK");
+               cancelButtonName = properties.getProperty("dialog.cancel");
+               Object[] options = { okButtonName, cancelButtonName };
+
+
+               optionPane = new JOptionPane(array, 
JOptionPane.QUESTION_MESSAGE,
+                               JOptionPane.YES_NO_OPTION, null, options, 
options[0]);
+
+
+               setContentPane(optionPane);
+
+               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+               addWindowListener(new WindowAdapter() {
+                       public void windowClosing(WindowEvent we) {
+                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
+                       }
+               });
+
+               resolutionList.addActionListener(this);
+               optionPane.addPropertyChangeListener(this);
+       }
+
+       /** 
+        * Handles events for the resolution list
+        */
+       public void actionPerformed(ActionEvent e) {
+               optionPane.setValue(okButtonName);
+       }
+
+
+       /** 
+        * Reacts to the change of state in the option pane. 
+        */
+       public void propertyChange(PropertyChangeEvent e) {
+               String prop = e.getPropertyName();
+
+               if (isVisible()
+                               && (e.getSource() == optionPane)
+                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
+                                               .equals(prop))) {
+                       Object value = optionPane.getValue();
+
+                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
+                               return;
+                       }
+
+                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
+
+                       if (okButtonName.equals(value)) {
+                               ResolutionListItem selectedItem = 
(ResolutionListItem) resolutionList.getSelectedItem();
+                               isNotSet = false;
+                               
+                               kioskWidth = selectedItem.kioskWidth;
+                               kioskHeight = selectedItem.kioskHeight;
+
+                               setVisible(false);
+                       } else {
+                               
+                               isNotSet = true;
+                               kioskWidth = 0;
+                               kioskHeight = 0;
+                               setVisible(false);
+                       }
+               }
+       }
+
+       // getters & setters
+
+       /**
+        * Getter of the field kioskWidth
+        * @return the kioskWidth
+        */
+       public int getKioskWidth() {
+               return kioskWidth;
+       }
+
+       /**
+        * Getter of the field kioskHeight
+        * @return the kioskHeight
+        */
+       public int getKioskHeight() {
+               return kioskHeight;
+       }
+       
+       /**
+        * Getter of the fiels isNotSet
+        * @return the isNotSet
+        */
+       public boolean isNotSet() {
+               return isNotSet;
+       }
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveAsDialog.java 
(from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/SaveAsDialog.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveAsDialog.java 
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveAsDialog.java 
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,156 @@
+package com.elvys.applet.dialog;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Properties;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+import javax.swing.JTextField;
+
+/**
+ * SaveAsDialog.java
+ * @author EvaV
+ * 
+ */
+
+/**
+ * @class SaveAsDialog
+ * Shows dialog where user can choose name of the layout under which layout is 
saved 
+ */
+@SuppressWarnings("serial")
+public class SaveAsDialog extends JDialog implements ActionListener,
+               PropertyChangeListener {
+
+       // fields
+       private JOptionPane optionPane;                                 /** 
option pane */
+       private JTextField layoutNameTextField;                 /** text field 
where layout name is typed */
+       private String typedText = null;                                /** 
text typed in text field */
+       private String okButtonName = "Enter";                  /** name of the 
button which confirms dialog choice */ 
+       private String cancelButtonName = "Cancel";             /** name of the 
button which cancels dialog choice */
+       private SaveAsDialog saveAsDialog;                              /** 
this save as dialog */
+       private JDialog dialog;                                                 
/** parent dialog where this dialog is displayed */
+       private JRootPane rootPane;                                             
/** root pane of the LayoutDesigner */
+
+       // constants
+       private final static int MAX_LAYOUT_NAME_LENGHT = 100;          /** max 
length of the layout name */ 
+       private final static String INVALID_TEXT = "";                          
/** empty text is invalid */
+
+       /**
+        * Constructor of class SaveAsDialog. Initializes SaveAsDialog
+        * 
+        * @param dialog parent dialog where this dialog is displayed
+        * @param properties properties
+        * @param rootPane root pane of the LayoutDesigner
+        */
+       public SaveAsDialog(JDialog dialog, Properties properties,
+                       JRootPane rootPane, String layoutName) {
+               super(dialog, properties.getProperty("dialog.saveAs"), true);
+
+               this.saveAsDialog = this;
+               this.rootPane = rootPane;
+               this.dialog = dialog;
+
+               // creates an array with dialog message and text field for 
layout name
+               layoutNameTextField = new JTextField(MAX_LAYOUT_NAME_LENGHT);
+               layoutNameTextField.setText(layoutName);
+               String dialogMessage = 
properties.getProperty("dialog.insertName");
+               Object[] array = { dialogMessage, layoutNameTextField };
+
+               // create an array specifying the number of dialog buttons and 
their
+               // text
+               okButtonName = properties.getProperty("dialog.OK");
+               cancelButtonName = properties.getProperty("dialog.cancel");
+               Object[] options = { okButtonName, cancelButtonName };
+
+               optionPane = new JOptionPane(array, 
JOptionPane.QUESTION_MESSAGE,
+                               JOptionPane.YES_NO_OPTION, null, options, 
options[0]);
+
+               setContentPane(optionPane);
+
+               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+               addWindowListener(new WindowAdapter() {
+                       public void windowClosing(WindowEvent we) {
+                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
+                       }
+               });
+
+               // ensures the text field always gets the first focus
+               addComponentListener(new ComponentAdapter() {
+                       public void componentShown(ComponentEvent ce) {
+                               layoutNameTextField.requestFocusInWindow();
+                       }
+               });
+
+               layoutNameTextField.addActionListener(this);
+               optionPane.addPropertyChangeListener(this);
+
+       }
+
+       /**
+        * Handles events for the text field
+        * 
+        * @param e action event
+        */
+       public void actionPerformed(ActionEvent e) {
+               optionPane.setValue(okButtonName);
+       }
+
+       /**
+        * Shows saveAsDialog and sets new layout name
+        * @return new layout name
+        */
+       public String showSaveAsDialog() {
+               dialog.setLocationRelativeTo(rootPane);
+               dialog.pack();
+               saveAsDialog.pack();
+               saveAsDialog.setLocationRelativeTo(rootPane);
+               saveAsDialog.setVisible(true);
+
+               String newLayoutName = saveAsDialog.typedText;
+               return newLayoutName;
+       }
+
+       /**
+        * Reacts to state changes in the option pane
+        * @param e property change event
+        */
+       public void propertyChange(PropertyChangeEvent e) {
+               String prop = e.getPropertyName();
+
+               if (isVisible()
+                               && (e.getSource() == optionPane)
+                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
+                                               .equals(prop))) {
+                       Object value = optionPane.getValue();
+
+                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
+                               return;
+                       }
+
+                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
+
+                       if (okButtonName.equals(value)) {
+                               typedText = layoutNameTextField.getText();
+
+                               if (!typedText.equals(INVALID_TEXT)) {
+                                       setVisible(false);
+                               } else {
+                                       typedText = null;
+                                       setVisible(false);
+                               }
+                       } else {
+                               typedText = null;
+                               setVisible(false);
+                       }
+               }
+       }
+
+
+}
\ No newline at end of file

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/SaveLayoutOnServer.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
                               (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,185 @@
+package com.elvys.applet.dialog;
+
+import java.util.Properties;
+
+import javax.swing.JFrame;
+
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.components.TabbedPaneCloseTabButton;
+import com.elvys.applet.serverCommunication.Marshaller;
+import com.elvys.applet.serverCommunication.ServerSideContext;
+import com.elvys.applet.structures.Layout;
+
+
+/**
+ * SaveLayoutOnServer.java
+ * @author Eva Viktorinova
+ */
+
+/**
+ * @class SaveLayoutOnServer Saves layout on server
+ */
+public class SaveLayoutOnServer {
+
+       private TabbedPane tabbedPane;
+
+       /** main tabbed pane */
+
+       /**
+        * Constructor of the class SaveLayoutOnServer
+        * 
+        * @param tabbedPane
+        *            tabbed pane to set
+        */
+       public SaveLayoutOnServer(TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+       }
+
+       /**
+        * Saves layout on the server for the actual design area
+        * 
+        * @param oldLayoutName
+        *            old name of the layout
+        * @param newLayoutName
+        *            new name of the layout
+        */
+       public void saveLayout(String oldLayoutName, String newLayoutName) {
+
+               if (tabbedPane == null || tabbedPane.getProperties() == null
+                               || tabbedPane.getActualDesignArea() == null) {
+                       return;
+               }
+
+               Properties properties = tabbedPane.getProperties();
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               Layout layout = designArea.getMyLayout();
+               System.out.println(layout.getId());
+               System.out.println(layout.getRevision());
+
+               try {
+
+                       // increasing revision number
+                       int layoutRevision = layout.getRevision();
+                       ++layoutRevision;
+
+                       // renames layout in tabbedPane
+
+                       TabbedPaneCloseTabButton buttonTab = 
(TabbedPaneCloseTabButton) tabbedPane
+                                       
.getTabComponentAt(tabbedPane.getSelectedIndex());
+                       buttonTab.setNewTabTitle(newLayoutName);
+
+                       tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), 
newLayoutName);
+
+                       if (layout.isChangedPositionCount()) {
+                               System.out.println("changed position count");
+                               layout.setIsNew(true);
+                               ServerSideContext.getInstance().unlockLayout();
+                       }
+
+                       // this layout has never been saved on server
+                       if (layout.isNew()) {
+                               System.out.println("saved new layout");
+                               layout.setName(newLayoutName);
+                               String xml = new 
Marshaller().marshallLayoutToString(layout);
+                               System.out.println(xml);
+                               int layoutID = 
ServerSideContext.getInstance().storeLayout(xml);
+
+                               designArea.setSaved(true);
+
+                               layout.setId(layoutID);
+                               layout.setIsNew(false);
+                               layout.setRevision(0);
+                               layout.setIsChangedPositionCount(false);
+                               layout.setInformedThatIsEditing(false);
+                               
ServerSideContext.getInstance().setLayoutID(layoutID);
+                       } else {
+                               // saves old layout under new name
+                               if (oldLayoutName.compareTo(newLayoutName) != 
0) {
+                                       
+                                       
+                                       
+                                       System.out.println("old layout saved 
under new name");
+                                       layout.setName(newLayoutName);
+                                       layout.setIsNew(true);
+                                       layout.setRevision(0);
+                                       String xml = new Marshaller()
+                                                       
.marshallLayoutToString(layout);
+                                       int layoutID = 
ServerSideContext.getInstance()
+                                                       .storeLayout(
+                                                                       xml);
+                                       System.out.println(xml);
+                                       layout.setId(layoutID);
+                                       layout.setIsNew(false);
+                                       layout.setRevision(0);
+                                       layout.setIsChangedPositionCount(false);
+                                       layout.setInformedThatIsEditing(false);
+                                       designArea.setSaved(true);
+                                       
ServerSideContext.getInstance().unlockLayout();
+                                       
ServerSideContext.getInstance().setLayoutID(layoutID);
+                               }
+                               // saves already saved layout
+                               else {
+                                       boolean isLockedByMe = 
ServerSideContext.getInstance().isLayoutLockedByMe(null);
+                                       
+                                       if(isLockedByMe) {
+                                               System.out.println("layout 
saved");
+
+                                               
layout.setRevision(layoutRevision);
+                                               
System.out.println(layout.getId());
+                                               
System.out.println(layout.getRevision());
+                                               String xml = new Marshaller()
+                                                       
.marshallLayoutToString(layout);
+                                               
ServerSideContext.getInstance().storeLayout(xml);
+                                               System.out.println(xml);
+                                               designArea.setSaved(true);
+                                       }
+                                       else {
+                                               layout.setName(newLayoutName);
+                                               layout.setIsNew(true);
+                                               String xml = new Marshaller()
+                                                               
.marshallLayoutToString(layout);
+                                               int layoutID = 
ServerSideContext.getInstance()
+                                                               .storeLayout(
+                                                                               
xml);
+                                               System.out.println(xml);
+                                               layout.setId(layoutID);
+                                               layout.setIsNew(false);
+                                               layout.setRevision(0);
+                                               
layout.setIsChangedPositionCount(false);
+                                               
layout.setInformedThatIsEditing(false);
+                                               designArea.setSaved(true);
+
+                                               
ServerSideContext.getInstance().unlockLayout();
+                                               
ServerSideContext.getInstance().setLayoutID(layoutID);
+                                               
+                                               new WarningDialog(new JFrame(), 
properties
+                                                               
.getProperty("warning.isNotLocked"), properties
+                                                               
.getProperty("warning.warning"));
+                                               
+                                       }
+
+                               }
+                       }
+
+                       ServerSideContext.getInstance().setLayout(layout);
+                       ServerSideContext.getInstance().setLocked(true);
+                       
ServerSideContext.getInstance().setLayoutID(layout.getId());
+                       System.out.println(layout.getId());
+                       System.out.println(layout.getRevision());
+
+               } catch (Exception e) {
+                       if (tabbedPane.getSelectedIndex() != 0) {
+                               
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(),
+                                               oldLayoutName);
+                       }
+
+                       new WarningDialog(new JFrame(), properties
+                                       .getProperty("warning.saveError"), 
properties
+                                       .getProperty("warning.warning"));
+                       return;
+               }
+
+       }
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/UnsavedLayoutClosedDialog.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/UnsavedLayoutClosedDialog.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/UnsavedLayoutClosedDialog.java
                                (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/UnsavedLayoutClosedDialog.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,153 @@
+package com.elvys.applet.dialog;
+
+/**
+ * UnsavedClosedDialog.java
+ * @author Eva Viktorinova
+ */
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Properties;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JRootPane;
+
+/**
+ * @class UnsavedClosedDialog
+ * Shows dialog where user can choose if unsaved design area should or 
shouldn't be saved before closing, or closing should be canceled 
+ *
+ */
+@SuppressWarnings("serial")
+public class UnsavedLayoutClosedDialog extends JDialog implements
+               PropertyChangeListener {
+
+       public enum DialogResultOption { /** Result of the unsaved dialog close 
*/
+               YES,            /** save unsaved design area */ 
+               NO,             /** don't save unsaved design area */
+               CANCELED;       /** cancel closing of the design area */
+       }
+
+       private JOptionPane optionPane;                         /** option pane 
*/
+       private String buttonYesName = "Yes";                   /** button 
label for yes action */
+       private String buttonNoName = "No";                             /** 
button label for no action */
+       private String buttonCancelName = "Cancel";             /** button 
label for cancel */
+       private DialogResultOption dialogResult;        /** result of the 
unsaved design area close dialog */
+       private JRootPane rootPane;                                     /** 
root pane of the LayoutDesigner */                  
+
+       /**
+        * Empty constructor of class UnsavedClosedDialog
+        */
+       public UnsavedLayoutClosedDialog(JRootPane rootPane) {
+               this.rootPane = rootPane;
+       }
+
+       /**
+        * Constructor of class UnsavedClosedDialog
+        * 
+        * @param dialog parent dialog where unsaved closed dialog should be 
displayed
+        * @param unsavedLayoutName name of the unsaved layout
+        * @param properties properties
+        */
+       public UnsavedLayoutClosedDialog(JDialog dialog, String 
unsavedLayoutName,
+                       Properties properties) {
+               super(dialog, properties.getProperty("dialog.closeUnsaved"), 
true);
+
+               setTitle(properties.getProperty("dialog.closeUnsaved"));
+
+               String message = 
properties.getProperty("dialog.closeUnsavedQuestion");
+               message += " " + unsavedLayoutName + " ?";
+
+               // initialization of button labels 
+               buttonYesName = properties.getProperty("dialog.yes");
+               buttonNoName = properties.getProperty("dialog.no");
+               buttonCancelName = properties.getProperty("dialog.cancel");
+
+               Object[] options = { buttonYesName, buttonNoName, 
buttonCancelName };
+
+               optionPane = new JOptionPane(message, 
JOptionPane.QUESTION_MESSAGE,
+                               JOptionPane.YES_NO_CANCEL_OPTION, null, 
options, options[2]);
+
+               setContentPane(optionPane);
+
+               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+               addWindowListener(new WindowAdapter() {
+                       public void windowClosing(WindowEvent we) {
+                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
+                       }
+               });
+
+               addComponentListener(new ComponentAdapter() {
+                       public void componentShown(ComponentEvent ce) {
+                       }
+               });
+
+               optionPane.addPropertyChangeListener(this);
+
+       }
+
+       /**
+        * Handles change of property in unsaved design area closed dialog
+        * @param e change of property
+        */
+       public void propertyChange(PropertyChangeEvent e) {
+               String prop = e.getPropertyName();
+
+               if (isVisible()
+                               && (e.getSource() == optionPane)
+                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
+                                               .equals(prop))) {
+                       Object value = optionPane.getValue();
+
+                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
+                               return;
+                       }
+
+                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
+
+                       if (buttonYesName.equals(value)) {
+                               dialogResult = DialogResultOption.YES;
+                               setVisible(false);
+                       } else if (buttonNoName.equals(value)) {
+                               dialogResult = DialogResultOption.NO;
+                               setVisible(false);
+                       } else {
+                               dialogResult = DialogResultOption.CANCELED;
+                               setVisible(false);
+                       }
+                       
+               }
+       }
+
+       /**
+        * Shows unsaved design area closed dialog
+        * @param properties properties
+        * @param unsavedLayoutName name of the unsaved layout
+        * @return result of the dialog
+        */
+       public DialogResultOption showUnsavedLayoutClosedDialog(
+                       Properties properties, String unsavedLayoutName) {
+               JDialog dialog = new JDialog();
+               UnsavedLayoutClosedDialog unsavedClosedDialog = new 
UnsavedLayoutClosedDialog(
+                               dialog, unsavedLayoutName, properties);
+               dialog.pack();
+               unsavedClosedDialog.pack();
+               unsavedClosedDialog.setLocationRelativeTo(rootPane);
+               unsavedClosedDialog.setVisible(true);
+               return unsavedClosedDialog.getDialogResult();
+       }
+
+       // getters & setters
+
+       /**
+        * Getter of field dialogResult
+        * 
+        * @return the dialogResult
+        */
+       public DialogResultOption getDialogResult() {
+               return dialogResult;
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/WarningDialog.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/WarningDialog.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/WarningDialog.java
                            (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/WarningDialog.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,36 @@
+package com.elvys.applet.dialog;
+
+/**
+ * WarningDialog.java
+ * @author EvaV
+ */
+
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+
+@SuppressWarnings("serial")
+/**
+ * WarningDialog shows warning dialog to the user
+ */
+public class WarningDialog extends JDialog {
+
+       // constructors
+
+       /**
+        * Creates and shows warning dialog with
+        * @param frame frame in which the warning dialog is displayed
+        * @param warningMessage message displayed in the warning dialog
+        * @param warningDialogTitle title of the warning dialog
+        */
+       public WarningDialog(JFrame frame, String warningMessage, String 
warningDialogTitle) {
+               super(frame, warningDialogTitle, true);
+               
+               JOptionPane optionPane = new JOptionPane();
+               add(optionPane);
+               JOptionPane.showMessageDialog(frame, warningMessage, 
warningDialogTitle,
+                               JOptionPane.WARNING_MESSAGE);
+
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
 (from rev 1790, 
trunk/layouteditor/LayoutDesigner/src/applet/DocumentTypes.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
                         (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/DocumentTypes.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,298 @@
+/**
+ * DocumentTypes.java
+ * @author Eva Viktorinova
+ */
+package com.elvys.applet.propertiesManager;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Properties;
+import java.util.Vector;
+import javax.swing.BoxLayout;
+import javax.swing.JCheckBox;
+import javax.swing.JPanel;
+
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.PermittedDocumentTypes;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.Layout.AddType;
+
+
+/**
+ * @class DocumentTypes Represents part of the properties manager - manages
+ *        permitted document typesOfDocuments for actual selected positions
+ * 
+ */
+@SuppressWarnings("serial")
+public class DocumentTypes extends JPanel {
+
+       private JCheckBox allTypesPermitedButton;                       /** 
button which decides whatever all types of documents are permitted */
+       private Vector<JCheckBox> typePermittedButtons;         /** buttons 
which decides whatever this type of document is permitted */
+       private PropertiesManager propertiesManager;            /** properties 
manager */
+       private Vector<String> typesOfDocuments;                        /** 
list of all types of document */
+
+       /**
+        * Constructor of the class DocumentTypes
+        * @param propertiesManager properties manager
+        * @param documentTypesPanel panel where document types is shown
+        * @param properties properties
+        */
+       public DocumentTypes(PropertiesManager propertiesManager,
+                       JPanel documentTypesPanel, Properties properties) {
+               
+               this.propertiesManager = propertiesManager;
+               this.typesOfDocuments = 
propertiesManager.getAllTypesOfDocuments();
+               
+               this.setFocusable(false);
+               
+               documentTypesPanel.setLayout(new BoxLayout(documentTypesPanel, 
BoxLayout.Y_AXIS));
+               
+               // initializes and adds all types permitted button
+               allTypesPermitedButton = new JCheckBox(properties
+                               .getProperty("documentTypes.all"));
+               allTypesPermitedButton.setSelected(true);
+               allTypesPermitedButton.setFocusable(false);
+               allTypesPermitedButton.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent evt) {
+                               permitAllTypesOfDocuments();
+                       }
+               });
+
+               documentTypesPanel.add(allTypesPermitedButton);
+
+               // initializes and add type permitted buttons
+               typePermittedButtons = new Vector<JCheckBox>();
+               for (int i = 0; i < typesOfDocuments.size(); ++i) {
+                       JCheckBox typePermittedButton = new 
JCheckBox(properties.getProperty(typesOfDocuments.get(i)));
+                       typePermittedButton.setFocusable(false);
+                       typePermittedButton.setEnabled(false);
+                       typePermittedButton.addActionListener(new 
ActionListener() {
+                               public void actionPerformed(ActionEvent evt) {
+                                       permitDocumentTypes();
+                               }
+                       });
+                       typePermittedButtons.add(typePermittedButton);
+                       documentTypesPanel.add(typePermittedButton);
+               }
+               actualize();
+       }
+
+       /** 
+        * Enables type permitted buttons 
+        * @param enabled enabled to set
+        */
+       private void setEnabledForTypePermittedButtons(boolean enabled) {
+               for (int i = 0; i < typePermittedButtons.size(); ++i) {
+                       typePermittedButtons.get(i).setEnabled(enabled);
+               }
+       }
+
+       /**
+        * Selects and deselects type permitted buttons
+        * @param selected selected to set
+        */
+       private void setSelectedForButtons(boolean selected) {
+               for (int i = 0; i < typePermittedButtons.size(); ++i) {
+                       typePermittedButtons.get(i).setSelected(selected);
+               }
+       }
+
+       /**
+        * Permits all type of documents for actually selected positions if all 
types permitted button is selected
+        */
+       private void permitAllTypesOfDocuments() {
+               if (allTypesPermitedButton.isSelected()) {
+                       setEnabledForTypePermittedButtons(false);
+                       setSelectedForButtons(false);
+                       permitDocumentTypes();
+               } else {
+                       setEnabledForTypePermittedButtons(true);
+                       permitDocumentTypes();
+               }
+
+       }
+
+       /**
+        * Permits document type for actually selected positions if 
corresponding type button is selected
+        */
+       public void permitDocumentTypes() {
+
+               TabbedPane tabbedPane = propertiesManager.getLayoutTabbedPane();
+               DesignArea designArea = (DesignArea) 
tabbedPane.getSelectedComponent();
+               Layout layout = designArea.getMyLayout();
+
+               Positions positions = layout
+                               .getSelectedPositions();
+               if (positions.getPositions().size() == 0) {
+               } else if (positions.getPositions().size() == 1) {
+                       Position oldPosition = positions.getPositions().get(0);
+                       Position newPosition = oldPosition.clone();
+                       PermittedDocumentTypes permitted = new 
PermittedDocumentTypes(
+                                       typesOfDocuments);
+                       if (!allTypesPermitedButton.isSelected()) {
+                               permitted.setPermittedAll(false);
+                               permitted.setPermittedDocumentTypes(new 
Vector<String>());
+                               for (int i = 0; i < typesOfDocuments.size(); 
++i) {
+                                       if 
(typePermittedButtons.get(i).isSelected()) {
+                                               
permitted.addPermittedDocumentType(typesOfDocuments
+                                                               .get(i));
+                                       }
+                               }
+                       }
+
+                       newPosition.setPermittedDocumentTypes(permitted);
+                       
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
+                                       oldPosition, designArea, 
Layout.AddType.DESIGN, false);
+                       
+                       if(positions.isAtLeastOneDocumentTypePermitted()) {
+                               
designArea.getMyLayout().addActionToActionsMemory(
+                                       designArea);
+
+                       }
+                       designArea.paintAllPositions();
+
+               } else {
+                       for (int i = 0; i < positions.getPositions().size(); 
++i) {
+                               Position oldPosition = 
positions.getPositions().get(i);
+                               Position newPosition = oldPosition.clone();
+                               PermittedDocumentTypes permitted = new 
PermittedDocumentTypes(
+                                               typesOfDocuments);
+                               if (!allTypesPermitedButton.isSelected()) {
+                                       permitted.setPermittedAll(false);
+                                       permitted.setPermittedDocumentTypes(new 
Vector<String>());
+                                       for (int j = 0; j < 
typesOfDocuments.size(); ++j) {
+                                               if 
(typePermittedButtons.get(j).isSelected()) {
+                                                       
permitted.addPermittedDocumentType(typesOfDocuments
+                                                                       
.get(j));
+                                               }
+                                       }
+                               }
+
+                               
newPosition.setPermittedDocumentTypes(permitted);
+                               
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
+                                               oldPosition, designArea, 
Layout.AddType.DESIGN, false);
+
+                               designArea.repaint();
+                       }
+                       if (positions.isAtLeastOneDocumentTypePermitted()) {
+                               
designArea.getActionMemory().addActionToActionsMemory(designArea);
+                       }
+               }
+       }
+
+       /**
+        * Selects and deselects all types permitted button
+        * @param selected selected to set
+        */
+       public void setAllTypesPermittedButtonSelected(boolean selected) {
+               allTypesPermitedButton.setSelected(selected);
+               setEnabledForTypePermittedButtons(!selected);
+       }
+
+       /**
+        * Enables  all types permitted button
+        * @param enabled enabled to set
+        */
+       public void setAllTypesPermittedButtonEnabled(boolean enabled) {
+               allTypesPermitedButton.setEnabled(enabled);
+       }
+
+       /**
+        * Actualize permitted document types according to this position
+        * @param position position
+        */
+       private void actualize(Position position) {
+               if (position.getPermittedDocumentTypes().isPermittedAll()) {
+                       allTypesPermitedButton.setEnabled(true);
+                       allTypesPermitedButton.setSelected(true);
+                       setEnabledForTypePermittedButtons(false);
+                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
+                               typePermittedButtons.get(i).setSelected(false);
+                       }
+               } else {
+                       PermittedDocumentTypes permitted = position
+                                       .getPermittedDocumentTypes();
+                       allTypesPermitedButton.setSelected(false);
+                       setEnabledForTypePermittedButtons(true);
+                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
+                               typePermittedButtons
+                                               .get(i)
+                                               .setSelected(
+                                                               permitted
+                                                                               
.isPermittedDocumentTypeAllowed(typesOfDocuments
+                                                                               
                .get(i)));
+                               System.out.println(typesOfDocuments.get(i) + " 
" + permitted
+                                               
.isPermittedDocumentTypeAllowed(typesOfDocuments
+                                                               .get(i)));
+
+                       }
+
+               }
+
+               
+       }
+       
+       /**
+        * Actualizes document types panel in properties manager according to 
selected positions
+        * If more positions is selected it allows selecting of permitted types 
if they have same permitted types
+        */
+       public void actualize() {
+
+               TabbedPane tabbedPane = propertiesManager.getLayoutTabbedPane();
+
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               if (designArea == null) {
+                       allTypesPermitedButton.setEnabled(false);
+                       allTypesPermitedButton.setSelected(false);
+                       setEnabledForTypePermittedButtons(false);
+                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
+                               typePermittedButtons.get(i).setSelected(false);
+                       }
+                       return;
+               }
+
+               Positions selectedPositions = 
designArea.getMyLayout().getSelectedPositions();
+               if (selectedPositions.isTooSmall(tabbedPane)) {
+                       return;
+               }
+
+               Layout layout = designArea.getMyLayout();
+               Positions positions = layout
+                               .getSelectedPositions();
+
+               if (positions.size() == 0) {
+                       allTypesPermitedButton.setEnabled(false);
+                       allTypesPermitedButton.setSelected(false);
+                       setEnabledForTypePermittedButtons(false);
+                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
+                               typePermittedButtons.get(i).setSelected(false);
+                       }
+               } else if (positions.getPositions().size() == 1) {
+                       Position position = positions.getPositions().get(0);
+                       actualize(position);
+                       
+               } else {
+
+                       if 
(!positions.hasSamePermittedDocumentTypes(typesOfDocuments)) {
+
+                               
+                               allTypesPermitedButton.setSelected(false);
+                               allTypesPermitedButton.setEnabled(false);
+                               for (int i = 0; i < typesOfDocuments.size(); 
++i) {
+                                       
typePermittedButtons.get(i).setSelected(false);
+                               }
+                               setEnabledForTypePermittedButtons(false);
+                       } else {
+                               
+                               Position position = 
positions.getPositions().get(0);
+                               actualize(position);
+                       }
+               }
+
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
                         (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PositionsList.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,194 @@
+package com.elvys.applet.propertiesManager;
+
+/**
+ * PositionsList.java
+ * @author Eva Viktorinova
+ */
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+
+
+/**
+ * @class PositionList
+ * Displays list with positions, enlightens selected positions and allows 
selecting of positions 
+ */
+@SuppressWarnings("serial")
+public class PositionsList extends JPanel {
+
+       private TabbedPane tabbedPane;          /** main tabbed pane of the 
LayoutDesigner */
+       private String positionItemName;                /** name of position 
item */    
+       private JPanel positionPanel;           /** panel with positions */
+       private JScrollPane scroller;           /** scroller in panel with 
positions */
+
+       
+       /**
+        * @class PositionListItem
+        * Represent one item in position list
+        */
+       private class PositionListItem extends JLabel {
+               private int positionID;
+               private String positionItemName;
+
+               /**
+                * Constructor of the class PositionListItem
+                * @param positionID id of position
+                * @param positionItemName name of position
+                */
+               public PositionListItem(int positionID, String 
positionItemName) {
+                       super();
+                       this.positionID = positionID;
+                       this.positionItemName = positionItemName;
+                       this.positionItemName += Integer.toString(positionID);
+                       this.setText(this.positionItemName);
+               }
+
+       }
+
+       // constructors
+       /**
+        * Constructor of the class PositionsList
+        * @param positionList position list to set
+        * @param tabbedPane tabbed pane to set
+        */
+       public PositionsList(JPanel positionList, TabbedPane tabbedPane) {
+               this.tabbedPane = tabbedPane;
+               this.positionItemName = 
tabbedPane.getProperties().getProperty("positionList.position");;
+               
+               this.setFocusable(false);
+               positionList.setBorder(BorderFactory.createEmptyBorder());
+               
+               
+               positionPanel = new JPanel();
+               positionPanel.setLayout(new BoxLayout(positionPanel, 
BoxLayout.PAGE_AXIS));
+               
+               
+               scroller = new JScrollPane(positionPanel, 
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+                             JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+               scroller.setPreferredSize(new Dimension(80, 185));
+               positionList.add(scroller);
+       }
+
+       /**
+        * Actualizes position list. It only makes invisible deleted positions 
to make displaying faster
+        */
+       public void actualize() {               
+               
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+               if (designArea == null) {
+                       for (int k = 0; k < positionPanel.getComponentCount(); 
++k) {
+                               PositionListItem item = (PositionListItem) 
positionPanel
+                                               .getComponent(k);
+                               item.setVisible(false);
+                       }
+                       
+                       return;
+               }
+
+               Positions selectedPositions = 
designArea.getMyLayout().getSelectedPositions();
+               
+               if(selectedPositions.isTooSmall(tabbedPane)) {
+                       return;
+               }
+               
+               int i = 0;
+               int j = 0;
+
+               for (i = 0; i < designArea.getMyLayout()
+                               .getLayoutPositions().getPositions().size(); 
++i) {
+                       Position position = designArea.getMyLayout()
+                                       
.getLayoutPositions().getPositions().get(i);
+
+                       if (j >= positionPanel.getComponentCount()) {
+                               addDocumentListItem(position, i);
+                       } else {
+                               PositionListItem item = (PositionListItem) 
positionPanel
+                                               .getComponent(j);
+                               item.setVisible(true);
+                               item.positionID = position.getId();
+                               item.positionItemName = positionItemName + 
position.getId();
+                               if (position.isSelected()) {
+                                       item.setForeground(Color.blue);
+                               } else {
+                                       item.setForeground(Color.black);
+                               }
+
+                               item.setText(positionItemName + 
position.getId());
+                       }
+                       ++j;
+               }
+               
+               for (int k = i; k < positionPanel.getComponentCount(); ++k) {
+                       PositionListItem item = (PositionListItem) positionPanel
+                                       .getComponent(k);
+                       item.setVisible(false);
+               }
+
+       }
+
+       /**
+        * Adds new position to position list
+        * @param position position to add
+        * @param i order of position in position list
+        */
+       private void addDocumentListItem(Position position, int i) {
+
+
+               PositionListItem newDocumentListItem = new 
PositionListItem(position
+                               .getId(), positionItemName);
+
+               
+               newDocumentListItem.setFocusable(false);
+               if(position.isSelected()) {
+                       newDocumentListItem.setForeground(Color.blue);
+               }
+               
+               positionPanel.add(newDocumentListItem);
+               
+       
+               newDocumentListItem.addMouseListener(new MouseAdapter() {
+                       public void mouseClicked(MouseEvent e) {
+                               positionSelected(e);
+                       }
+
+               });
+               
+       }
+       /**
+        * If item is selected in position list corresponding position is 
selected
+        * @param e mouse event
+        */
+       public void positionSelected(MouseEvent e) {
+               PositionListItem item = (PositionListItem)e.getSource();
+               int id = item.positionID;
+               
+               
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+               if (designArea == null) {
+                       return;
+               }
+
+               Layout layout = designArea.getMyLayout();
+               
+               Position position = layout.getLayoutPositions().getPosition(id);
+               
+               position.selectPosition(e.isControlDown(), designArea);
+               designArea.paintAllPositions();
+               
+               tabbedPane.getPropertiesManager().actualizeAll();
+               
+               
designArea.getActionMemory().addActionToActionsMemory(designArea);
+       }
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManager.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManager.java
                             (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManager.java
     2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,239 @@
+package com.elvys.applet.propertiesManager;
+
+/** 
+ * PropertiesManager.java
+ * @author Eva Viktorinova
+ */
+import java.awt.Dimension;
+import java.util.Properties;
+import java.util.Vector;
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSeparator;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingConstants;
+
+import com.elvys.applet.components.ComponentSizes;
+import com.elvys.applet.components.TabbedPane;
+
+
+/**
+ * @class Properties Manager
+ * PropertiesManager displays actual values for selected position and actual
+ * layout
+ * 
+ */
+
+@SuppressWarnings("serial")
+public class PropertiesManager extends JPanel {
+       // fields
+
+       private TabbedPane layoutTabbedPane;            /** main tabbed pane */
+       private Vector<String> allTypesOfDocuments;     /** all types of 
permitted documents */
+       private JPanel propertiesManagerPanel;          /** panel where 
properties manager is displayed */
+       private PositionsList positionsList;            /** component with 
position list */
+       private DocumentTypes documentTypes;            /** component with 
document types */
+       private PropertiesTable propertiesTable;        /** component with 
properties table */
+       private boolean isMinimalized;                          /** flag 
whatever tab with properties manager is minimalized */
+       
+       // constants
+       private final static int LIST_HEIGHT = 250;                     /** 
height of the position list component */
+       private final static int DOCUMENT_TYPES_HEIGHT = 150;   /** height of 
the document types componnt */
+       private final static int SPACE = 5;                                     
        /** size of the space among components */
+       
+       
+       // constructors
+       
+       /**
+        * Constructor of the class PropertiesManager - initializes components
+        * @param propertiesManagerTabbedPane properties manager tabbed pane to 
set
+        * @param allTypesOfDocuments all permitted types of documents
+        * @param layoutTabbedPane main tabbed pane of the LayoutDesigner
+        * @param properties properties
+        * @param componentSizes sizes of components in LayoutDesigner
+        */
+       public PropertiesManager(JTabbedPane propertiesManagerTabbedPane, 
Vector<String> allTypesOfDocuments,
+                       TabbedPane layoutTabbedPane, Properties properties, 
ComponentSizes componentSizes) {
+
+               this.allTypesOfDocuments = allTypesOfDocuments;
+               this.propertiesManagerPanel = new JPanel();
+               propertiesManagerTabbedPane.setFocusable(false);
+               
propertiesManagerTabbedPane.addTab(properties.getProperty("propertiesManager.label"),
 propertiesManagerPanel);
+               
propertiesManagerTabbedPane.setTabComponentAt(propertiesManagerTabbedPane.getSelectedIndex(),
+                               new 
PropertiesManagerTabCloseButton(propertiesManagerTabbedPane, 
properties.getProperty("propertiesManager.label"), layoutTabbedPane));
+
+
+               this.layoutTabbedPane = layoutTabbedPane;
+               this.setMinimalized(false);
+               this.setFocusable(false);
+
+               addComponents(properties, componentSizes);
+
+       }
+
+       // methods
+       /**
+        * Adds all components to the properties manager
+        * @param properties properties
+        * @param componentSizes size of components in the LayoutDesigner
+        */
+       public void addComponents(Properties properties, ComponentSizes 
componentSizes) {
+
+               JPanel propertiesTablePanel = new JPanel();
+               
+               Dimension propertiesManagerSizes = 
componentSizes.getPropertiesManager();
+               int width = (int)propertiesManagerSizes.getWidth();
+               
+               
+               // creates separators 
+               JSeparator separator1 = new 
JSeparator(SwingConstants.HORIZONTAL);
+               JSeparator separator2 = new 
JSeparator(SwingConstants.HORIZONTAL);
+
+               // creates panel's labels
+               JLabel propertiesTableLabel = new 
JLabel(properties.getProperty("propertiesTable.label"));
+               JLabel documentTypesLabel = new 
JLabel(properties.getProperty("documentTypes.label"));
+               JLabel positionListLabel = new 
JLabel(properties.getProperty("positionList.label"));
+               
+               
+               propertiesTable = new PropertiesTable(layoutTabbedPane,
+                               propertiesTablePanel);
+
+               JPanel documentTypesPanel = new JPanel();
+               documentTypesPanel.setPreferredSize(new Dimension(width, 
DOCUMENT_TYPES_HEIGHT));
+               documentTypes = new DocumentTypes(this, documentTypesPanel, 
properties);
+               documentTypesPanel.setFocusable(false);
+               
+
+               JPanel documentListPanel = new JPanel();
+               documentListPanel.setPreferredSize(new Dimension(width, 
LIST_HEIGHT));
+
+               positionsList = new PositionsList(documentListPanel, 
layoutTabbedPane);
+               positionsList.setFocusable(false);
+       
+       
+               
+               // sets empty border around components to ensure empty space 
among them
+               
propertiesTableLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
+               
propertiesTablePanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
+
+               
documentTypesLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
+               
documentTypesPanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
+               
+               
positionListLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
+               
documentListPanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
+       
+       
+               
+               // sets layout
+               propertiesManagerPanel.setLayout(new 
BoxLayout(propertiesManagerPanel, BoxLayout.PAGE_AXIS));
+               
+               // adds components 
+               propertiesManagerPanel.add(propertiesTableLabel);
+               propertiesTableLabel.setFocusable(false);
+               propertiesManagerPanel.add(propertiesTablePanel);
+               propertiesManagerPanel.add(separator1);
+               
+               propertiesManagerPanel.add(documentTypesLabel);
+               documentTypesLabel.setFocusable(false);
+               propertiesManagerPanel.add(documentTypesPanel);
+               propertiesManagerPanel.add(separator2);
+               
+               propertiesManagerPanel.add(positionListLabel);
+               positionListLabel.setFocusable(false);
+               propertiesManagerPanel.add(documentListPanel);
+               
+       }
+
+       /**
+        * Actualizes all components in properties manager
+        */
+       public void actualizeAll() {
+               this.positionsList.actualize();
+               this.propertiesTable.actualize();
+               this.documentTypes.actualize();
+       }
+       
+       /**
+        * Actualizes properties table
+        */
+       public void actualizePropertiesTable() {
+               this.propertiesTable.actualize();
+       }
+       
+       /**
+        * Actualizes positions list
+        */
+       public void actualizePositionsList() {
+               this.positionsList.actualize();
+       }
+       
+       /**
+        * Actualizes document types
+        */
+       public void actualizeDocumentTypes() {
+               this.documentTypes.actualize();
+       }
+       
+       /**
+        * Actualizes field in properties table
+        */
+       public void actualizePropertiesTableFields() {
+               this.propertiesTable.actualizeFields();
+       }
+
+       /**
+        * Decides whatever properties table is owner of the focus
+        * @return whatever properties table is owner of the focus
+        */
+       public boolean isPropertiesTableFocusOwner() {
+               return propertiesTable.isFocusOwner();
+       }
+       // getters & setters
+
+
+       /**
+        * Getter for the field layoutTabbedPane
+        * @return the layoutTabbedPane
+        */
+       public TabbedPane getLayoutTabbedPane() {
+               return layoutTabbedPane;
+       }
+
+
+       /**
+        * Getter of the filed allTypesOfDocuments
+        * @return the all type of documents
+        */
+       public Vector<String> getAllTypesOfDocuments() {
+               return allTypesOfDocuments;
+       }
+
+       
+       /**
+        * Getter of the field documentTypes
+        * @return the documentTypes
+        */
+       public DocumentTypes getDocumentTypes() {
+               return documentTypes;
+       }
+
+
+       /**
+        * Setter for the field isMinimalized
+        * @param isMinimalized the isMinimalized to set
+        */
+       public void setMinimalized(boolean isMinimalized) {
+               this.isMinimalized = isMinimalized;
+       }
+
+       /**
+        * Getter for the field isMinimalized
+        * @return the isMinimalized
+        */
+       public boolean isMinimalized() {
+               return isMinimalized;
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManagerTabCloseButton.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManagerTabCloseButton.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManagerTabCloseButton.java
                               (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesManagerTabCloseButton.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,111 @@
+package com.elvys.applet.propertiesManager;
+
+/**
+ * PropertiesManagerTabCloseButton.java
+ * @author EvaV
+ */
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.plaf.basic.BasicButtonUI;
+
+import com.elvys.applet.components.TabbedPane;
+
+
+/**
+ * @class PropertisManagerTabCloseButton
+ * Implements cross button which enables to close tab of properties manager 
tabbed pane  
+ */
+@SuppressWarnings("serial")
+public class PropertiesManagerTabCloseButton extends JPanel {
+       private final JTabbedPane propertiesManagerTabbedPane;  /** properties 
manager tabbed pane */
+       private final TabbedPane layoutsTabbedPane;                     /** 
main tabbed pane */
+       private JLabel tabTitleLabel;                                           
        /** title of the tab with the properties manager */
+       
+       /**
+        * Constructor of the class PropertiesManagerTabCloseButton
+        * @param propertiesManagerTabbedPane properties manager tabbed pane
+        * @param tabTitleText  title of the tab with properties manager
+        * @param layoutsTabbedPane     main tabbed pane
+        */
+       public PropertiesManagerTabCloseButton(JTabbedPane 
propertiesManagerTabbedPane, String tabTitleText, TabbedPane layoutsTabbedPane) 
{
+
+               super(new FlowLayout(FlowLayout.LEFT, 0, 0));
+               
+               this.propertiesManagerTabbedPane = propertiesManagerTabbedPane;
+               this.layoutsTabbedPane = layoutsTabbedPane;
+               setOpaque(false);
+
+               tabTitleLabel = new JLabel(tabTitleText);
+               add(tabTitleLabel);
+               tabTitleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 
0, 2));
+               
+               JButton button = new CrossCloseButton();
+               add(button);
+               setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
+       }
+
+       
+
+       /**
+        * @class CrossCloseButton
+        * CrossCloseButton displays button which enables to close tab with 
propertis manager 
+        */
+       private class CrossCloseButton extends JButton implements 
ActionListener {
+               private final static int CROSS_BUTTON_SIZE = 17;        /** 
size of the cross button */
+               private final static int DELTA = 6;                             
        /** size of the cross */
+               
+               /**
+                * Constructor of the class CrossCloseButton
+                */
+               public CrossCloseButton() {
+                       
+                       setPreferredSize(new Dimension(CROSS_BUTTON_SIZE, 
CROSS_BUTTON_SIZE));
+                       
+                       setUI(new BasicButtonUI());
+                       setContentAreaFilled(false);
+                       setBorder(BorderFactory.createEtchedBorder());
+                       setBorderPainted(false);
+                       setRolloverEnabled(true);
+                       addActionListener(this);
+               }
+
+               /**
+                * Makes properties manager invisible
+                * @param e action event
+                */
+               public void actionPerformed(ActionEvent e) {
+
+                       propertiesManagerTabbedPane.setVisible(false);
+                       
layoutsTabbedPane.getToolBar().getPropertiesManagerButton().setVisible(true);
+
+               }
+
+               /**
+                *  Paints the close cross
+                *  @param g graphics
+                */
+               protected void paintComponent(Graphics g) {
+                       super.paintComponent(g);
+                       Graphics2D g2 = (Graphics2D) g.create();
+                       g2.setStroke(new BasicStroke(2));
+                       g2.setColor(Color.BLACK);
+                       g2.drawLine(DELTA, DELTA, getWidth() - DELTA - 1, 
getHeight()
+                                       - DELTA - 1);
+                       g2.drawLine(getWidth() - DELTA - 1, DELTA, DELTA, 
getHeight()
+                                       - DELTA - 1);
+                       g2.dispose();
+               }
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesTable.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/PropertiesTable.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesTable.java
                               (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/propertiesManager/PropertiesTable.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,521 @@
+package com.elvys.applet.propertiesManager;
+
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.text.NumberFormat;
+import java.util.Properties;
+import javax.swing.AbstractAction;
+import javax.swing.JFormattedTextField;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+import javax.swing.text.DefaultFormatterFactory;
+import javax.swing.text.NumberFormatter;
+
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.Layout.AddType;
+
+
+@SuppressWarnings("serial")
+public class PropertiesTable extends JPanel implements FocusListener {
+
+       // fields
+       private JLabel idLabel;
+       private JLabel widthLabel;
+       private JLabel heightLabel;
+       private JLabel topXLabel;
+       private JLabel topYLabel;
+       private JFormattedTextField idField;
+       private JFormattedTextField widthField;
+       private JFormattedTextField heightField;
+       private JFormattedTextField topXField;
+       private JFormattedTextField topYField;
+       private TabbedPane tabbedPane;
+
+       // constants
+       private final static int ROW = 5;
+       private final static int COL = 2;
+       private final static int WIDTH = 50;
+       private final static int HEIGHT = 10;
+
+       private int oldTopX;
+       private int oldTopY;
+       private int oldWidth;
+       private int oldHeight;
+       private int newTopX;
+       private int newTopY;
+       private int newWidth;
+       private int newHeight;
+
+       // constructors
+       /**
+        * Constructor of class DocumentPropertiesTable
+        * 
+        * @param tabbedPane
+        * @param propertiesTablePanel
+        */
+       public PropertiesTable(TabbedPane tabbedPane, JPanel 
propertiesTablePanel) {
+               super();
+
+               this.tabbedPane = tabbedPane;
+               Properties properties = tabbedPane.getProperties();
+
+               // initializes properties' label
+               idLabel = new 
JLabel(properties.getProperty("propertiesTable.ID"));
+               widthLabel = new 
JLabel(properties.getProperty("propertiesTable.width"));
+               heightLabel = new JLabel(properties
+                               .getProperty("propertiesTable.height"));
+               topXLabel = new 
JLabel(properties.getProperty("propertiesTable.topX"));
+               topYLabel = new 
JLabel(properties.getProperty("propertiesTable.topY"));
+
+               // initializes properties' text fields
+               idField = new JFormattedTextField();
+               idField.setFocusable(false);
+               idField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+               idField.setEditable(false);
+               widthField = new JFormattedTextField();
+               widthField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+               heightField = new JFormattedTextField();
+               heightField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+               topXField = new JFormattedTextField();
+               topXField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+               topYField = new JFormattedTextField();
+               topYField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+
+               // sets bounds for editable text fields
+               int maxWidth = 0;
+               int maxHeight = 0;
+               int minWidth = 0;
+               int minHeight = 0;
+
+               setFields(idField, 0, 0);
+               setFields(topXField, minWidth, maxWidth);
+               setFields(topYField, minHeight, maxHeight);
+               setFields(widthField, minWidth, maxWidth);
+               setFields(heightField, minHeight, maxHeight);
+
+               // sets propertiesTable layout
+               propertiesTablePanel.setLayout(new GridLayout(ROW, COL, 2, 0));
+               propertiesTablePanel.add(idLabel);
+               propertiesTablePanel.add(idField);
+
+               propertiesTablePanel.add(topXLabel);
+               propertiesTablePanel.add(topXField);
+
+               propertiesTablePanel.add(topYLabel);
+               propertiesTablePanel.add(topYField);
+
+               propertiesTablePanel.add(widthLabel);
+               propertiesTablePanel.add(widthField);
+
+               propertiesTablePanel.add(heightLabel);
+               propertiesTablePanel.add(heightField);
+
+               topXField.addFocusListener(this);
+               topYField.addFocusListener(this);
+               widthField.addFocusListener(this);
+               heightField.addFocusListener(this);
+               actualize();
+       }
+
+       // methods
+       /**
+        * Sets max and min bounds for editable text field and size of all text
+        * field
+        * 
+        * @param textField
+        * @param max
+        */
+       private void setFields(JFormattedTextField textField, int min, int max) 
{
+
+               if (textField.isEditable()) {
+                       int minimum = new Integer(min);
+                       int maximum = new Integer(max);
+
+                       NumberFormat integerFormat = 
NumberFormat.getIntegerInstance();
+                       NumberFormatter intFormatter = new 
NumberFormatter(integerFormat);
+                       intFormatter.setFormat(integerFormat);
+                       intFormatter.setMinimum(minimum);
+                       intFormatter.setMaximum(maximum);
+                       textField.setFormatterFactory(new 
DefaultFormatterFactory(
+                                       intFormatter));
+               }
+               textField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
+
+       }
+
+       /**
+        * Decides if text field in properties table is focus owner
+        * 
+        * @returns if properties table text field is focus owner
+        */
+       public boolean isFocusOwner() {
+               return !tabbedPane.getActualDesignArea().isFocusOwner();
+               // if (idField.isFocusOwner() || widthField.isFocusOwner()
+               // || heightField.isFocusOwner() || topXField.isFocusOwner()
+               // || topYField.isFocusOwner()) {
+               // return true;
+               // }
+               // return false;
+       }
+
+       /**
+        * Actualizes values in properties table according to the actual layout 
and
+        * actual selected positions
+        */
+       public void actualize() {
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               // there is none actual design area
+               if (designArea == null) {
+                       idField.setValue(null);
+                       widthField.setValue(null);
+                       heightField.setValue(null);
+                       topXField.setValue(null);
+                       topYField.setValue(null);
+
+                       topXField.setEditable(false);
+                       topYField.setEditable(false);
+                       widthField.setEditable(false);
+                       heightField.setEditable(false);
+               } else {
+
+                       Positions selectedPositions = designArea.getMyLayout()
+                                       .getSelectedPositions();
+
+                       // selected positions are too small to be displayed
+                       if (selectedPositions.isTooSmall(tabbedPane)) {
+                               return;
+                       }
+
+                       // there aren't any selected positions
+                       if (selectedPositions.isEmpty()) {
+                               idField.setValue(null);
+                               widthField.setValue(null);
+                               heightField.setValue(null);
+                               topXField.setValue(null);
+                               topYField.setValue(null);
+                               topXField.setEditable(false);
+                               topYField.setEditable(false);
+                               widthField.setEditable(false);
+                               heightField.setEditable(false);
+                               return;
+                       }
+
+                       // displays values of properties for selected positions
+                       idField.setValue(new String(selectedPositions.getID()));
+                       topXField.setValue(new 
Integer(selectedPositions.getElvysTopX()));
+                       topYField.setValue(new 
Integer(selectedPositions.getElvysTopY()));
+                       newTopX = selectedPositions.getElvysTopX();
+                       newTopY = selectedPositions.getElvysTopY();
+                       oldTopX = selectedPositions.getElvysTopX();
+                       oldTopY = selectedPositions.getElvysTopY();
+
+                       // if more than one position is selected, width and 
height isn't
+                       // displayed
+                       if (selectedPositions.isNotOnlyOne()) {
+                               widthField.setValue(null);
+                               heightField.setValue(null);
+                               widthField.setEditable(false);
+                               heightField.setEditable(false);
+
+                       } else {
+                               topXField.setEditable(true);
+                               topYField.setEditable(true);
+                               widthField.setEditable(true);
+                               heightField.setEditable(true);
+                               widthField.setValue(new 
Integer(selectedPositions
+                                               .getElvysWidth()));
+                               newWidth = selectedPositions.getElvysWidth();
+                               oldWidth = selectedPositions.getElvysWidth();
+                               heightField.setValue(new 
Integer(selectedPositions
+                                               .getElvysHeight()));
+                               newHeight = selectedPositions.getElvysHeight();
+                               oldHeight = selectedPositions.getElvysHeight();
+                       }
+               }
+       }
+
+       /**
+        * Actualizes bounds for text fields and decides if they are editable
+        */
+       public void actualizeFields() {
+
+               int maxWidth = 0;
+               int maxHeight = 0;
+
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               if (designArea == null
+                               || 
designArea.getMyLayout().getSelectedPositions().isEmpty()) {
+                       topXField.setEditable(false);
+                       topYField.setEditable(false);
+                       widthField.setEditable(false);
+                       heightField.setEditable(false);
+               } else {
+                       if 
(!designArea.getMyLayout().getSelectedPositions().isEmpty()) {
+                               topXField.setEditable(true);
+                               topYField.setEditable(true);
+                               widthField.setEditable(true);
+                               heightField.setEditable(true);
+                       }
+
+                       maxWidth = 
designArea.getMyLayout().getScreenResolution()
+                                       .getElvysWidth();
+                       maxHeight = 
designArea.getMyLayout().getScreenResolution()
+                                       .getElvysHeight();
+
+                       Position pos = new Position();
+                       int minWidth = pos.getMinElvysWidth(designArea);
+                       int minHeight = pos.getMinElvysHeight(designArea);
+
+                       setFields(idField, 0, 0);
+                       setFields(topXField, 0, maxWidth);
+                       setFields(topYField, 0, maxHeight);
+                       setFields(widthField, minWidth, maxWidth);
+                       setFields(heightField, minHeight, maxHeight);
+
+                       // if more than one position is selected, width and 
height isn't
+                       // editable
+                       if 
(designArea.getMyLayout().getSelectedPositions().isNotOnlyOne()) {
+                               widthField.setEditable(false);
+                               heightField.setEditable(false);
+                       }
+
+               }
+
+               // adds change listener to text fields
+               addListener(idField);
+               addListener(topXField);
+               addListener(topYField);
+               addListener(widthField);
+               addListener(heightField);
+
+       }
+
+       /**
+        * Decides type of change - if position should be resized or moved
+        * 
+        * @param oldTopX
+        * @param oldTopY
+        * @param oldWidth
+        * @param oldHeight
+        * @param newTopX
+        * @param newTopY
+        * @param newWidth
+        * @param newHeight
+        * @return
+        */
+       protected Layout.AddType decideTypeOfChange(int oldTopX, int oldTopY,
+                       int oldWidth, int oldHeight, int newTopX, int newTopY,
+                       int newWidth, int newHeight) {
+               if (oldTopX != newTopX || oldTopY != newTopY) {
+                       return Layout.AddType.MOVE;
+               } else {
+                       return Layout.AddType.RESIZE;
+               }
+       }
+
+       /**
+        * Changes properties of selected positions in the actual layout 
according
+        * to the given new values
+        * 
+        * @param oldTopX
+        * @param oldTopY
+        * @param oldWidth
+        * @param oldHeight
+        */
+       protected void changeSelectedPositionsProperties(int oldTopX, int 
oldTopY,
+                       int oldWidth, int oldHeight) {
+
+               // if(!isChange) {
+               // return;
+               // }
+
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               // gets new values of properties
+               int newTopX = Integer.valueOf(topXField.getValue().toString());
+               int newTopY = Integer.valueOf(topYField.getValue().toString());
+               
+               int newWidth = oldWidth;
+               int newHeight = oldHeight;
+               if(widthField.isEditable()) {
+                       newWidth = 
Integer.valueOf(widthField.getValue().toString());
+                       newHeight = 
Integer.valueOf(heightField.getValue().toString());
+               }
+
+               // decides type of change, if selected positions should be 
moved or
+               // resized
+               Layout.AddType type = decideTypeOfChange(oldTopX, oldTopY, 
oldWidth,
+                               oldHeight, newTopX, newTopY, newWidth, 
newHeight);
+
+               
designArea.getMyLayout().moveOrResizePositionsWithPropertiesTable(
+                               designArea, newTopX - oldTopX, newTopY - 
oldTopY,
+                               newWidth - oldWidth, newHeight - oldHeight, 
type);
+
+               // if (designArea.isSnapToGridEnabled()) {
+               // designArea.getThisDesignAreaLayout().getLayoutPositions()
+               // .snapToGrid(designArea);
+               // }
+
+               designArea.paintAllPositions();
+
+               // sets new properties values
+
+               Positions positions = 
designArea.getMyLayout().getSelectedPositions();
+
+               if (positions.size() == 1) {
+
+                       topXField.setValue(new 
Integer(positions.getElvysTopX()));
+                       topYField.setValue(new 
Integer(positions.getElvysTopY()));
+                       widthField.setValue(new 
Integer(positions.getElvysWidth()));
+                       heightField.setValue(new 
Integer(positions.getElvysHeight()));
+               }
+       }
+
+       protected void changeSelectedPositionsProperties() {
+
+               // if(!isChange) {
+               // return;
+               // }
+
+               DesignArea designArea = tabbedPane.getActualDesignArea();
+
+               // decides type of change, if selected positions should be 
moved or
+               // resized
+               Layout.AddType type = decideTypeOfChange(oldTopX, oldTopY, 
oldWidth,
+                               oldHeight, newTopX, newTopY, newWidth, 
newHeight);
+
+               
designArea.getMyLayout().moveOrResizePositionsWithPropertiesTable(
+                               designArea, newTopX - oldTopX, newTopY - 
oldTopY,
+                               newWidth - oldWidth, newHeight - oldHeight, 
type);
+
+               // if (designArea.isSnapToGridEnabled()) {
+               // designArea.getThisDesignAreaLayout().getLayoutPositions()
+               // .snapToGrid(designArea);
+               // }
+
+               designArea.paintAllPositions();
+
+               // sets new properties values
+               Positions positions = 
designArea.getMyLayout().getSelectedPositions();
+               if (positions.size() == 1) {
+                       topXField.setValue(new 
Integer(positions.getElvysTopX()));
+                       topYField.setValue(new 
Integer(positions.getElvysTopY()));
+                       widthField.setValue(new 
Integer(positions.getElvysWidth()));
+                       heightField.setValue(new 
Integer(positions.getElvysHeight()));
+               }
+       }
+
+       /**
+        * Adds change listener to text field
+        * 
+        * @param textField
+        */
+       protected void addListener(final JFormattedTextField textField) {
+
+               textField.setHorizontalAlignment(JTextField.TRAILING);
+               textField.setFocusLostBehavior(JFormattedTextField.REVERT);
+
+               if (!textField.isEditable()) {
+                       return;
+               }
+
+               textField.getInputMap().put(
+                               KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), 
"check");
+               textField.getActionMap().put("check", new AbstractAction() {
+                       public void actionPerformed(ActionEvent e) {
+                               if (!textField.isEditValid()) {
+                                       
textField.setValue(textField.getValue());
+                                       textField.postActionEvent();
+                               } else
+                                       try {
+                                               oldTopX = 
Integer.valueOf(topXField.getValue()
+                                                               .toString());
+                                               oldTopY = 
Integer.valueOf(topYField.getValue()
+                                                               .toString());
+                                               
+                                               if(widthField.isEditable()) {
+                                                       oldWidth = 
Integer.valueOf(widthField.getValue()
+                                                               .toString());
+                                                       oldHeight = 
Integer.valueOf(heightField.getValue()
+                                                               .toString());
+                                               }
+
+                                               textField.commitEdit();
+                                               textField.postActionEvent();
+
+                                               
changeSelectedPositionsProperties(oldTopX, oldTopY,
+                                                               oldWidth, 
oldHeight);
+
+                                       } catch (java.text.ParseException exc) {
+                                       }
+                       }
+               });
+       }
+
+       @Override
+       public void focusGained(FocusEvent e) {
+
+               changeSelectedPositionsProperties();
+
+       }
+
+       @Override
+       public void focusLost(FocusEvent e) {
+               JFormattedTextField textField = null;
+
+               if (e.getSource().equals(topXField)) {
+                       textField = topXField;
+               }
+
+               if (e.getSource().equals(topYField)) {
+                       textField = topYField;
+               }
+
+               if (e.getSource().equals(widthField)) {
+                       textField = widthField;
+               }
+
+               if (e.getSource().equals(heightField)) {
+                       textField = heightField;
+               }
+
+               if (!textField.isEditValid()) {
+                       textField.setValue(textField.getValue());
+               } else
+                       try {
+                               if(widthField.isEditable()) {
+                                       oldTopX = 
Integer.valueOf(topXField.getValue().toString());
+                                       oldTopY = 
Integer.valueOf(topYField.getValue().toString());     
+                                       oldWidth = 
Integer.valueOf(widthField.getValue().toString());
+                                       oldHeight = 
Integer.valueOf(heightField.getValue().toString());
+                               }
+
+                               textField.commitEdit();
+
+                               if(widthField.isEditable()) {
+                                       newTopX = 
Integer.valueOf(topXField.getValue().toString());
+                                       newTopY = 
Integer.valueOf(topYField.getValue().toString());     
+                                       newWidth = 
Integer.valueOf(widthField.getValue().toString());
+                                       newHeight = 
Integer.valueOf(heightField.getValue().toString());
+                               }
+
+                               // changeSelectedPositionsProperties(oldTopX, 
oldTopY,
+                               // oldWidth, oldHeight);
+
+                       } catch (java.text.ParseException exc) {
+                       }
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/Marshaller.java
 (from rev 1789, trunk/layouteditor/LayoutDesigner/src/applet/Marshaller.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/Marshaller.java
                          (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/Marshaller.java
  2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,143 @@
+package com.elvys.applet.serverCommunication;
+
+import java.io.*;
+import javax.xml.stream.*;
+
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.RelativeCoordinates;
+
+
+/**
+ * Marshaller.java
+ * @author EvaV
+ */
+
+/**
+ * Marshaller converts layout to xml string
+ */
+public class Marshaller {
+       // fields
+       private Layout layout;                  /** layout */
+       
+       // methods
+       /**
+        * Gets string representation of xml file generated by the given layout
+        * 
+        * @param layout the given layout
+        * @return string representation of xml file generated by the given 
layout
+        * @throws Exception
+        */
+       public String marshallLayoutToString(Layout layout) throws Exception {
+               this.layout = layout;
+
+               // initializes writer
+               StringWriter strOut = new StringWriter();
+               XMLOutputFactory factory = XMLOutputFactory.newInstance();
+               XMLStreamWriter writer = factory.createXMLStreamWriter(strOut);
+               writer.setPrefix("xsi", "cz/elvys/jaxbgen/layout");
+
+               
+               
+               // writes head of xml file
+               writeHead(writer);
+
+               // writes individual position in layout
+               for (int i = 0; i < layout.getLayoutPositions().size(); ++i) {
+                       writeDocument(layout.getLayoutPositions().get(i), 
writer);
+               }
+
+               // writes end of xml file
+               writeEnd(writer);
+
+               // closes writer
+               writer.flush();
+               writer.close();
+               strOut.close();
+
+               System.out.println(strOut.toString());
+               return strOut.toString();
+       }
+
+       /**
+        * Writes the head of xml file
+        * @param writer xml writer
+        * @throws XMLStreamException
+        */
+       private void writeHead(XMLStreamWriter writer) throws 
XMLStreamException {
+
+
+               
+               writer.writeStartDocument("UTF-8", "1.0");
+
+               
writer.writeStartElement("a","layout","http://www.w3.org/2001/XMLSchema";); // 
<layout>
+               writer.writeAttribute("xmlns:a", "cz/elvys/jaxbgen/layout");
+               //writer.writeAttribute("elvysVersion", "0.3");
+               
+               if (!layout.isNew()) {
+                       writer.writeAttribute("id", 
Integer.toString(layout.getId()));
+               }
+
+               writer.writeAttribute("revision", Integer.toString(layout
+                               .getRevision()));
+
+               String layoutName = "layout";
+               if (!layout.getName().isEmpty()) {
+                       layoutName = layout.getName();
+               }
+               writer.writeAttribute("name", layoutName);
+
+               writer.writeStartElement("aspect-ratio"); // <aspect-ratio>
+               double width = layout.getScreenResolution().getElvysWidth();
+               double height = layout.getScreenResolution().getElvysHeight();
+               double ratio = (double) width / (double) height;
+               writer.writeAttribute("aspect-ratio", Double.toString(ratio));
+               writer.writeEndElement(); // </aspect-ratio>
+
+       }
+
+       /**
+        * Writes individual position in layout to xml writer
+        * 
+        * @param position position
+        * @param writer xml writer
+        * @throws XMLStreamException
+        */
+       private void writeDocument(Position position, XMLStreamWriter writer)
+                       throws XMLStreamException {
+               writer.writeStartElement("doc"); // <pdf_doc>
+               writer.writeAttribute("id", Integer.toString(position.getId()));
+               writer.writeStartElement("rect"); // <rect>
+
+               RelativeCoordinates relative = 
position.getRelativeFromElvys(layout.getScreenResolution());
+
+               writer.writeAttribute("x", Double.toString(relative.getTopX()));
+               writer.writeAttribute("y", Double.toString(relative.getTopY()));
+               writer.writeAttribute("w", 
Double.toString(relative.getWidth()));
+               writer.writeAttribute("h", 
Double.toString(relative.getHeight()));
+               writer.writeEndElement(); // </rect>
+
+               for (int i = 0; i < position.getPermittedDocumentTypes()
+                               .getPermittedDocumentTypes().size(); ++i) {
+                       writer.writeStartElement("doc_type");
+                       
writer.writeCharacters(position.getPermittedDocumentTypes()
+                                       .getPermittedDocumentTypes().get(i));
+                       writer.writeEndElement();
+               }
+
+               writer.writeEndElement(); // </pdf_doc>
+
+       }
+
+       /**
+        * Writes end of xml file
+        * 
+        * @param writer xml writer
+        * @throws XMLStreamException
+        */
+       private void writeEnd(XMLStreamWriter writer) throws Exception {
+               writer.writeEndElement(); // </layout>
+               writer.writeEndDocument();
+       }
+
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
 (from rev 1789, 
trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
                                (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,242 @@
+package com.elvys.applet.serverCommunication;
+
+import java.util.Collections;
+import java.util.Vector;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.xml.parsers.*;
+import org.w3c.dom.*;
+
+
+import com.elvys.applet.components.LayoutDesigner;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.dialog.ResolutionChoiceDialog;
+import com.elvys.applet.dialog.WarningDialog;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.PermittedDocumentTypes;
+import com.elvys.applet.structures.Position;
+import com.elvys.applet.structures.Positions;
+import com.elvys.applet.structures.RelativeCoordinates;
+import com.elvys.applet.structures.ScreenResolution;
+import com.elvys.applet.structures.SupportedResolutions;
+
+import java.io.*;
+
+/**
+ * ReadLayoutFromServer.java
+ * @author Eva Viktorinova
+ *
+ */
+/**
+ * @class ReadLayoutFromServer
+ * Reads layout from the server
+ */
+public class ReadLayoutFromServer {
+       
+       private TabbedPane tabbedPane;                                          
        /** main tabbed pane */
+       private SupportedResolutions supportedAspectRatios;             /** 
supported aspect ratios */
+       private Vector<String> allTypesOfDocuments;                     /** all 
permitted types of documents */
+
+       /**
+        * Constructor of the class ReadLayoutFromServer
+        * @param tabbedPane tabbed pane to set
+        * @param supportedAspectRatios supported ratios to set
+        * @param allTypesOfDocuments all types of documents to set
+        */
+       public ReadLayoutFromServer(TabbedPane tabbedPane,
+                       SupportedResolutions supportedAspectRatios,
+                       Vector<String> allTypesOfDocuments) {
+               this.tabbedPane = tabbedPane;
+               this.supportedAspectRatios = supportedAspectRatios;
+               this.allTypesOfDocuments = allTypesOfDocuments;
+       }
+
+
+       /**
+        * Parses layout from the string which has come from server. Displays 
resolution choice dialog when aspect ratio is read
+        * @param layoutXmlString string with xml from server which represents 
layout
+        * @return layout layout
+        */
+       public Layout readLayout(String layoutXmlString) {
+
+               Layout layout = new Layout();
+
+               //layoutXmlString = "<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?><l:layout id="32" revision="0" name="?ulina" 
xmlns:l="cz/elvys/jaxbgen/layout"> <aspect-ratio aspect-ratio="1.77778"/> <doc 
id="3"> <rect x="0.552083333333333" w="0.286979166666667" h="0.211111111111111" 
y="0.15462962962963"/> <doc_type>text</doc_type> <doc_type>dynamic</doc_type> 
</doc> <doc id="2"> <rect x="0.403645833333333" w="0.130208333333333" 
h="0.537962962962963" y="0.291666666666667"/> <doc_type>document</doc_type> 
<doc_type>url</doc_type> </doc> <doc id="1"> <rect x="0.06875" 
w="0.181770833333333" h="0.537962962962963" y="0.0981481481481482"/> 
<doc_type>document</doc_type> <doc_type>dynamic</doc_type> </doc></l:layout>";
+               System.out.println(layoutXmlString);
+               
+               Positions layoutPositions = new Positions(layout);
+
+               boolean layoutIsNew = true;
+               int layoutRevision = 0;
+               int layoutID = 0;
+               double layoutAspectRatio = 0;
+               String layoutName = "";
+
+               if (tabbedPane == null || tabbedPane.getProperties() == null || 
supportedAspectRatios == null) {
+                       return null;
+               }
+               ScreenResolution screenResolution = new ScreenResolution();
+
+               try {
+                       DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
+                       DocumentBuilder db = dbf.newDocumentBuilder();
+                       InputSource is = new InputSource();
+                       is.setCharacterStream(new 
StringReader(layoutXmlString));
+
+                       Document doc = db.parse(is);
+                       
+                       
+                       Node rootNode = doc.getDocumentElement();
+                       String rootNodeName = rootNode.getNodeName();
+                       if (!rootNodeName.equals("l:layout")) {
+                               throw new 
Exception(tabbedPane.getProperties().getProperty("error.xml"));
+                       }
+
+                       // parses atributes of <layout>
+                       NamedNodeMap layoutNodeAttributes = 
rootNode.getAttributes();
+                       for (int i = 0; i < layoutNodeAttributes.getLength(); 
++i) {
+                               Node attribute = layoutNodeAttributes.item(i);
+
+                               if (attribute.getNodeName().equals("id")) {
+                                       layoutIsNew = false;
+                                       String nodeValue = 
attribute.getNodeValue();
+                                       layoutID = Integer.valueOf(nodeValue);
+                               }
+
+                               if (attribute.getNodeName().equals("revision")) 
{
+                                       String nodeValue = 
attribute.getNodeValue();
+                                       layoutRevision = 
Integer.valueOf(nodeValue);
+                               }
+
+                               if (attribute.getNodeName().equals("name")) {
+                                       String nodeValue = 
attribute.getNodeValue();
+                                       layoutName = nodeValue;
+                               }
+                       }
+
+                       NodeList layoutNodeList = rootNode.getChildNodes();
+                       for (int i = 0; i < layoutNodeList.getLength(); ++i) {
+                               Node layoutNode = layoutNodeList.item(i);
+
+                               if 
(layoutNode.getNodeName().equals("aspect-ratio")) {
+                                       Node aspectRatioNode = 
layoutNode.getAttributes()
+                                                       
.getNamedItem("aspect-ratio");
+                                       layoutAspectRatio = 
Double.valueOf(aspectRatioNode
+                                                       .getNodeValue());
+
+                                       SupportedResolutions resolutions = 
supportedAspectRatios.getResolutionsWithAspectRatio(layoutAspectRatio);
+                                       ResolutionChoiceDialog 
resolutionChoiceDialog = new ResolutionChoiceDialog(
+                                                       new JDialog(), 
tabbedPane.getProperties(),
+                                                       resolutions, 
tabbedPane.getRootPane());
+                                       
+                                       if(resolutions == null) {
+                                               
LayoutDesigner.getInstance().closeLayoutDesignerBrowserWindow();
+                                       }
+
+                                       screenResolution = 
resolutionChoiceDialog
+                                                       
.showResolutionChoiceDialog();
+                                       
layout.setScreenResolution(screenResolution);
+                               }
+
+                               if (layoutNode.getNodeName().equals("doc")) {
+
+                                       Position document = new 
Position(tabbedPane);
+                                       Node idAttribute = 
layoutNode.getAttributes().getNamedItem(
+                                                       "id");
+                                       
document.setId(Integer.valueOf(idAttribute.getNodeValue()));
+                                       Vector<String> doc_types = new 
Vector<String>();
+
+                                       NodeList docNodeList = 
layoutNode.getChildNodes();
+
+                                       String x = "0";
+                                       String y = "0";
+                                       String w = "0";
+                                       String h = "0";
+                                       for (int j = 0; j < 
docNodeList.getLength(); ++j) {
+                                               Node docNode = 
docNodeList.item(j);
+
+                                               if 
(docNode.getNodeName().equals("rect")) {
+                                                       NamedNodeMap 
rectAttributes = docNode
+                                                                       
.getAttributes();
+                                                       for (int l = 0; l < 
rectAttributes.getLength(); ++l) {
+                                                               Node attribute 
= rectAttributes.item(l);
+
+                                                               if 
(attribute.getNodeName().equals("x")) {
+                                                                       x = 
attribute.getNodeValue();
+                                                               }
+
+                                                               if 
(attribute.getNodeName().equals("y")) {
+                                                                       y = 
attribute.getNodeValue();
+                                                               }
+
+                                                               if 
(attribute.getNodeName().equals("w")) {
+                                                                       w = 
attribute.getNodeValue();
+                                                               }
+
+                                                               if 
(attribute.getNodeName().equals("h")) {
+                                                                       h = 
attribute.getNodeValue();
+                                                               }
+
+                                                       }
+
+                                               }
+
+                                               if 
(docNode.getNodeName().equals("doc_type")) {
+                                                       
doc_types.add(docNode.getTextContent());
+                                               }
+
+                                       }
+
+                                       double relHeight = Double.valueOf(h);
+                                       double relWidth = Double.valueOf(w);
+                                       double relTopX = Double.valueOf(x);
+                                       double relTopY = Double.valueOf(y);
+
+                                       RelativeCoordinates relativeCoordinates 
= new RelativeCoordinates(
+                                                       relTopX, relTopY, 
relWidth, relHeight);
+
+                                       
document.setElvysFromRelative(relativeCoordinates,
+                                                       screenResolution);
+                                       
document.setMonitorFromRelative(relativeCoordinates,
+                                                       screenResolution);
+
+                                       
+                                       PermittedDocumentTypes 
permittedDocumentTypes = new PermittedDocumentTypes();
+                                       
permittedDocumentTypes.setAllDocumentTypes(allTypesOfDocuments);
+                                       
+                                       System.out.println(doc_types);
+                                       for (int k = 0; k < doc_types.size(); 
++k) {
+                                               permittedDocumentTypes
+                                                               
.addPermittedDocumentType(doc_types.get(k));
+                                       }
+                                       
permittedDocumentTypes.setIsPermittedAll();
+
+                                       
document.setPermittedDocumentTypes(permittedDocumentTypes);
+
+                                       layoutPositions.addPosition(document);
+
+                               }
+                       }
+
+               } catch (Exception e) {
+                       e.printStackTrace();
+                       new WarningDialog(new JFrame(), 
tabbedPane.getProperties().getProperty("error.layoutReading"), 
tabbedPane.getProperties().getProperty("warning.warning"));
+               }
+
+               layout.setName(layoutName);
+               layout.setIsNew(layoutIsNew);
+               layout.setRevision(layoutRevision);
+               layout.setId(layoutID);
+               layoutPositions.sortID();
+               layout.setLayoutPositions(layoutPositions);
+
+               layout.setLayoutAspectRatio(layoutAspectRatio);
+               layout.setScreenResolution(screenResolution);
+               System.out.println("layoutID: " + layoutID + " layoutRevision: 
" + layoutRevision);
+
+               return layout;
+
+       }
+}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
 (from rev 1790, 
trunk/layouteditor/LayoutDesigner/src/applet/ServerSideContext.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
                           (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,678 @@
+package com.elvys.applet.serverCommunication;
+
+import java.applet.Applet;
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.structures.SupportedResolution;
+import com.elvys.applet.structures.SupportedResolutions;
+
+
+public class ServerSideContext {
+       // fields
+       private Integer companyID;                              /** id of 
company */
+       private Integer layoutID;                               /** id of 
layout */
+       private Integer userID;                                 /** id of user 
*/
+       private Vector<String> permittedDocumentTypes;          /** permitted 
document types for this company */
+       private SupportedResolutions supportedResolutions;      /** supported 
resolutions for this company */
+       private String host;                                                    
        /** host */
+       private static Charset charset = null;                          /** 
char set */
+       private Layout layout;                                                  
        /** opened layout - create new or edit */
+       private boolean isLocked;                                               
        /** flag whatever this layout is locked during opening */
+       private boolean isLockedByMe;                                           
/** flag whatever this layout is locked during saving */
+       private String lockedUser;                              /** name of 
user who has locked this layout */ 
+       private String localization;                    /** suffix of 
properties file with localization */
+
+       // singleton variable
+       private static ServerSideContext instance;                      /** 
instance of this class */
+
+       // constants
+       private static final String CHARSET_XML_NIO = "UTF-8";          /** 
charset */
+       private static final String PROPREF_COMPANY_ID = "companyID";           
/** name of parameter companyID */
+       private static final String PROPREF_LAYOUT_ID = "layoutID";             
        /** name of parameter layoutID */
+       private static final String PROPREF_USER_ID = "userID";                 
        /** name of parameter userID */
+       private static final String PROPREF_LOCALIZATION = "localization";      
/** name of parameter localization */
+       private static final String PROP_SAVE_URL = "/dispatcher/storeLayout"; 
/** name of servlet for storing layout in dispatcher */
+       private static final String PROP_TYPES_URL = "/dispatcher/permTypes";  
/** name of servlet for getting permitted types in dispatcher */
+       private static final String PROP_RESOLUTIONS_URL = 
"/dispatcher/resolutions";   /** name of servlet for getting supported 
resolution in dispatcher */
+       private static final String PROP_LOAD_LAYOUT_URL = 
"/dispatcher/loadLayoutByID";        /** name of servlet for loading layout in 
dispatcher */
+       private static final String PROP_LOCK_LAYOUT_URL = 
"/dispatcher/LayoutLocking";  /** name of servlet for layout locking in 
dispatcher */
+       private static final String ASPECT_RATIO_DELIMITER = " ";       /** 
delimiter of aspect ratios */               
+       private static final String IS_LOCKED = "locked";                       
/** dispatcher answer that layout is locked */
+       private static final String LOCK_ACTION = "lock";                       
                        /** dispatcher request input - asks to lock layout */
+       private static final String UNLOCK_ACTION = "unlock";                   
                /** dispatcher request input - asks to unlock layout */
+       private static final String LOCKED_BY_ME_ACTION ="lockedByMe";          
        /** dispatcher request input - asks whatever layout is locked by me */
+       private static final String IS_LAYOUT_LOCKED="isLocked";                
                /** dispatcher request input - asks whatever layout is locked */
+       private static final List<String> LOCALIZATION = Arrays.asList("cs");   
/** list of all supported localization */
+
+
+       // private constructor- due to singleton
+       /**
+        * Empty constructor of the class ServerSideContext
+        */
+       private ServerSideContext() {
+       }
+
+       /**
+        * Initialize ServerSideContext
+        * @initializes context object
+        * @param applet LayoutDesigner applet
+        * @parm tabbedPane main tabbed pane of the applet
+        */
+       public static void newInstance(Applet applet, TabbedPane tabbedPane)
+                       throws Exception {
+               // initialize always, applet behaves strange..
+               init(applet, tabbedPane);
+       }
+
+       /**
+        * Gets instance of the class ServerSideContext
+        * @return ServerSideContext singleton object
+        */
+       public static ServerSideContext getInstance() {
+               return instance;
+       }
+
+
+       /**
+        * Initializes host 
+        * @param applet LayoutDesigner applet
+        * @param tabbedPane main tabbed pane
+        * @throws Exception
+        */
+       private static void init(Applet applet, TabbedPane tabbedPane)
+                       throws Exception {
+               // create instance
+               instance = new ServerSideContext();
+
+               // set host
+
+               String hostAddr = applet.getCodeBase().getHost();
+               Integer port = applet.getCodeBase().getPort();
+               instance.host = "http://"; + hostAddr + ":" + port;
+
+               // for debugging: 
+                instance.host = "http://localhost:8080/";;
+
+       }
+
+       /**
+        * Gets layoutID, companyID, userID, layout, permitted types of 
documents and supported resolutions
+        * @param applet LayoutDesigner applet
+        * @param tabbedPane main tabbed pane
+        * @throws Exception
+        */
+       public void getProperties(Applet applet, TabbedPane tabbedPane)
+                       throws Exception {
+
+               // set companyID
+               String companyID = applet.getParameter(PROPREF_COMPANY_ID);
+               instance.companyID = Integer.parseInt(companyID);
+
+               // set layoutID
+               String layoutID = applet.getParameter(PROPREF_LAYOUT_ID);
+
+               // set userID
+               String userID = applet.getParameter(PROPREF_USER_ID);
+               instance.userID = Integer.parseInt(userID);
+
+               
instance.setLocalization(applet.getParameter(PROPREF_LOCALIZATION));
+               
+               
+               // set permitted document types
+               instance.permittedDocumentTypes = 
instance.preparePermittedDocumentTypes();
+
+               
tabbedPane.setAllTypesOfDocuments(instance.permittedDocumentTypes);
+
+               // set supported ratios
+               instance
+                               
.setSupportedResolutions(instance.prepareSupportedResolutions());
+
+                       try {
+                               instance.layoutID = Integer.parseInt(layoutID);
+                               instance.isLayoutLocked();
+
+                               if(!isLocked) {
+                                       instance.layout = 
instance.getLayoutToEdit(tabbedPane);
+                               }
+                               else {
+                                       instance.layout = null;
+                               }
+                                       
+                       } catch (Exception e) {
+                               instance.layout = null;
+                       }
+       }
+
+       /**
+        * Communicates with server and gets permitted types of document
+        * 
+        * @return permitted types of document
+        * @throws Exception
+        */
+       private Vector<String> preparePermittedDocumentTypes() throws Exception 
{
+               System.out.println("getting permitted types from:" + host
+                               + PROP_TYPES_URL);
+               URL url = new URL(host + PROP_TYPES_URL);
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+               conn.setDoOutput(true);
+               conn.setRequestMethod("POST");
+               conn.setRequestProperty("user-agent", companyID.toString());
+               conn.setRequestProperty("Content-type", 
"application/octet-stream");
+               OutputStream os = conn.getOutputStream();
+               // send POST
+               os.flush();
+               os.close();
+
+               // Get the response
+               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
+                               .getInputStream(), getXMLCharset()));
+               String line;
+               String result = "";
+               while ((line = rd.readLine()) != null) {
+                       result += line + "\n";
+               }
+
+               // parse input message content
+               Vector<String> permissions = new Vector<String>();
+               if (result == null || result.equals("")) {
+                       // no type permission is granted
+                       System.out.println(0 + " types");
+                       return permissions;
+               } else {
+                       StringReader strr = new StringReader(result);
+                       BufferedReader reader = new BufferedReader(strr);
+                       String perm;
+                       // one line == one permission
+                       while ((perm = reader.readLine()) != null) {
+                               if (!perm.equals("")) {
+                                       permissions.add(perm);
+                               }
+                       }
+                       System.out.println(permissions);
+                       System.out.println(permissions.size() + " types");
+                       return permissions;
+               }
+       }
+
+       /**
+        *
+        * Parses one line from server output with supported resolutions for 
one aspect ratio
+        * @param line line from server output with supported resolutions for 
one aspect ratio
+        * @return supported resolution for one aspect ratio
+        * @throws Exception
+        */
+       private SupportedResolution parseLineWithResolutions(String line)
+                       throws Exception {
+               SupportedResolution resolution = new SupportedResolution();
+               Vector<Integer> delimiterPosition = new Vector<Integer>();
+               int pos = 0;
+               while (pos != -1 && pos < line.length()) {
+                       int delPos = line.indexOf(ASPECT_RATIO_DELIMITER, pos);
+                       if (delPos != -1) {
+                               delimiterPosition.add(delPos);
+                               pos = delPos + 1;
+                       } else {
+                               pos = delPos;
+                               delimiterPosition.add(line.length());
+                       }
+               }
+
+               for (int i = 0; i < delimiterPosition.size(); ++i) {
+                       int begin = 0;
+                       int end = 0;
+                       if (i == 0) { // first aspect ratio
+                               begin = 0;
+                               end = delimiterPosition.get(i);
+                               String aspectRatioString = 
line.substring(begin, end);
+                               
resolution.setAspectRatio(Double.valueOf(aspectRatioString));
+                       } else {
+                               begin = delimiterPosition.get(i - 1) + 1;
+                               end = delimiterPosition.get(i);
+                               String resolutionString = line.substring(begin, 
end);
+                               resolution.addResolution(resolutionString);
+                       }
+
+               }
+
+               return resolution;
+       }
+
+       /**
+        * Communicates with server and gets list of supported resolutions
+        * 
+        * @return list of supported resolutions
+        */
+       private SupportedResolutions prepareSupportedResolutions() throws 
Exception {
+               System.out.println("getting supported aspect ratios from:" + 
host
+                               + PROP_RESOLUTIONS_URL);
+               URL url = new URL(host + PROP_RESOLUTIONS_URL);
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+               conn.setDoOutput(true);
+               conn.setRequestMethod("POST");
+               conn.setRequestProperty("user-agent", companyID.toString());
+               conn.setRequestProperty("Content-type", 
"application/octet-stream");
+               OutputStream os = conn.getOutputStream();
+               // send POST
+               os.flush();
+               os.close();
+
+               // Get the response
+               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
+                               .getInputStream(), getXMLCharset()));
+               String line;
+               String result = "";
+               while ((line = rd.readLine()) != null) {
+                       result += line + "\n";
+               }
+
+               // parse input message content
+               SupportedResolutions ratios = new SupportedResolutions();
+
+               if (result == null || result.equals("")) {
+                       return ratios;
+               } else {
+                       StringReader strr = new StringReader(result);
+                       BufferedReader reader = new BufferedReader(strr);
+                       String oneLine;
+                       // one line == one permission
+                       while ((oneLine = reader.readLine()) != null) {
+                               if (!oneLine.equals("")) {
+                                       SupportedResolution supportedResolution 
= parseLineWithResolutions(oneLine);
+                                       ratios.add(supportedResolution);
+                               }
+                       }
+                       return ratios;
+               }
+       }
+
+
+       /**
+        * Stores this layout on server
+        * @param xml string with xml of layout
+        * @return new id of layout
+        * @throws Exception
+        */
+       public Integer storeLayout(String xml) throws Exception {
+               return postLayoutStorage(xml);
+       }
+       
+       /**
+        * Unlocks edited layout
+        * @throws Exception
+        */
+       public void unlockLayout() throws Exception {
+               postLayoutLocking(UNLOCK_ACTION);
+               
+       }
+       
+       /**
+        * Read layout from server to be edited in LayoutDesigner
+        * @param tabbedPane tabbedPane
+        * @return layout
+        * @throws Exception
+        */
+       public Layout getLayoutToEdit(TabbedPane tabbedPane) throws Exception {
+               return postLoadLayoutByID(tabbedPane);
+       }
+       
+       /**
+        * Gets whatever saved layout is locked by me
+        * @param tabbedPane main tabbed pane
+        * @return whatever layout is locked by me
+        * @throws Exception
+        */
+       public boolean isLayoutLockedByMe(TabbedPane tabbedPane) throws 
Exception {
+               postLayoutLocking(LOCKED_BY_ME_ACTION);
+               return this.isLockedByMe;
+       }
+       
+       /**
+        * Locks edited layout  
+        * @throws Exception
+        */
+       public void lockLayout() throws Exception {
+               postLayoutLocking(LOCK_ACTION);
+       }
+       
+       /**
+        * Finds whatever this layout is locked by another user
+        * @throws Exception
+        */
+       public void isLayoutLocked() throws Exception {
+               postLayoutLocking(IS_LAYOUT_LOCKED);
+       }
+       
+       /**
+        * Sends xml of layout to the server and the server stores it into DB.
+        * @param xml xml of layout to store
+        * @return new id of stored layout
+        * @throws Exception
+        */
+       private Integer postLayoutStorage(String xml) throws Exception {
+               URL url = new URL(host + PROP_SAVE_URL);
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+               conn.setDoOutput(true);
+               conn.setRequestMethod("POST");
+               conn.setRequestProperty("user-agent", companyID.toString() + 
";" + userID.toString());
+               System.out.println(companyID.toString() + ";" + 
userID.toString() + " -> " + xml);
+               conn.setRequestProperty("Content-type", 
"application/octet-stream");
+               OutputStream os = conn.getOutputStream();
+               OutputStreamWriter writer = new OutputStreamWriter(os);
+               writer.write(xml);
+               writer.close();
+
+               // send POST
+               os.flush();
+               os.close();
+
+               // Get the response
+               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
+                               .getInputStream(), getXMLCharset()));
+               String output = "";
+               String line;
+               while ((line = rd.readLine()) != null) {
+                       output += line;
+               }
+               System.out.println(output);
+               if (output.substring(0, 2).equals("ok")) {
+                       // everything is ok
+                       String sid = output.substring(2);
+                       Integer id = Integer.parseInt(sid);
+                       return id;
+               } else {
+                       // error, propagate up and over there write message to 
user
+                       throw new Exception(output);
+               }
+       }
+
+
+       /**
+        * Locks, unlocks or decides whatever layout is locked by this user 
+        * @param type type of post action
+        * @throws Exception
+        */
+       private void postLayoutLocking(String type) throws Exception {
+               URL url = new URL(host + PROP_LOCK_LAYOUT_URL);
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+               conn.setDoOutput(true);
+               conn.setRequestMethod("POST");
+               conn.setRequestProperty("user-agent", companyID.toString() + 
";" + userID.toString() + ";" + layoutID.toString());
+               System.out.println(companyID.toString() + ";" + 
userID.toString() + layoutID.toString() + " -> " + type);
+               conn.setRequestProperty("Content-type", 
"application/octet-stream");
+               OutputStream os = conn.getOutputStream();
+               OutputStreamWriter writer = new OutputStreamWriter(os);
+               writer.write(type);
+               writer.close();
+
+
+               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
+                               .getInputStream(), getXMLCharset()));
+               
+
+               // parse input message content
+               if(type.equals(LOCKED_BY_ME_ACTION)) {
+                       
+                       
+                       String line;
+                       String result = "";
+                       while ((line = rd.readLine()) != null) {
+                               result += line;
+                       }
+                       isLockedByMe = result.equals(IS_LOCKED);        
+                       
+               }
+               
+               else if(type.equals(IS_LAYOUT_LOCKED)) {
+                       String line;
+                       String result = "";
+                       while ((line = rd.readLine()) != null) {
+                               result += line;
+                       }
+                       
+                       isLocked = result.substring(0, 
IS_LOCKED.length()).equals(IS_LOCKED);
+
+                       if(isLocked) {
+                               lockedUser = 
result.substring(IS_LOCKED.length());
+                       }
+
+                       
+               }
+
+                               
+       }
+       
+       /**
+        * Gets layout with layoutID from DB.
+        * @param tabbedPane main tabbed pane
+        * @return layout with the layoutID
+        * @throws Exception
+        */
+       private Layout postLoadLayoutByID(TabbedPane tabbedPane)
+                       throws Exception {
+
+               URL url = new URL(host + PROP_LOAD_LAYOUT_URL);
+               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
+               conn.setDoOutput(true);
+               conn.setRequestMethod("POST");
+               conn.setRequestProperty("user-agent", layoutID.toString() + ";"
+                               + companyID.toString());
+               System.out.println(layoutID.toString() + ";"
+                               + companyID.toString() + ";" + 
userID.toString());
+               conn.setRequestProperty("Content-type", 
"application/octet-stream");
+               OutputStream os = conn.getOutputStream();
+               // send POST
+               os.flush();
+               os.close();
+
+               // Get the response
+               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
+                               .getInputStream(), getXMLCharset()));
+               String line;
+               String result = "";
+               while ((line = rd.readLine()) != null) {
+                       result += line; // + "\n";
+               }
+               System.out.println(result);
+
+               // parse input message content
+
+               Layout newLayout = null;
+
+               if (result == null || result.equals("")) {
+                       // no layout is granted
+                       System.out.println("layout not opened");
+                       isLocked = false;
+                       return null;
+               } else {
+                       ReadLayoutFromServer openFile = new 
ReadLayoutFromServer(
+                                       tabbedPane, 
instance.supportedResolutions,
+                                       instance.permittedDocumentTypes);
+                       newLayout = openFile.readLayout(result);
+                       isLocked = false;
+                       System.out.println("layout opened");
+                       return newLayout;
+               }
+       }
+
+       /**
+        * Gets char set
+        * @return charset for XML data
+        */
+       private static Charset getXMLCharset() {
+               if (charset == null) {
+                       charset = Charset.forName(CHARSET_XML_NIO);
+               }
+               return charset;
+       }
+
+       /**
+        * Sets layoutID
+        * @param layoutID
+        *            the layoutID to set
+        */
+       public void setLayoutID(Integer layoutID) {
+               this.layoutID = layoutID;
+       }
+
+       /**
+        * Gets layoutID
+        * @return the layoutID
+        */
+       public Integer getLayoutID() {
+               return layoutID;
+       }
+
+       /**
+        * Sets userID
+        * @param userID
+        *            the userID to set
+        */
+       public void setUserID(Integer userID) {
+               this.userID = userID;
+       }
+
+       /**
+        * Gets userID
+        * @return the userID
+        */
+       public Integer getUserID() {
+               return userID;
+       }
+
+       /**
+        * Sets supported resolutions
+        * @param supportedResolutions
+        *            the supportedResolutions to set
+        */
+       public void setSupportedResolutions(
+                       SupportedResolutions supportedResolutions) {
+               this.supportedResolutions = supportedResolutions;
+       }
+
+       /**
+        * Gets supported resolutions
+        * @return the supportedResolutions
+        */
+       public SupportedResolutions getSupportedResolutions() {
+               return supportedResolutions;
+       }
+
+       /**
+        * Gets host
+        * @return the host
+        */
+       public String getHost() {
+               return host;
+       }
+
+       /**
+        * Sets host
+        * @param host
+        *            the host to set
+        */
+       public void setHost(String host) {
+               this.host = host;
+       }
+
+       /**
+        * Gets permitted document types
+        * @return the permittedDocumentTypes
+        */
+       public Vector<String> getPermittedDocumentTypes() {
+               return permittedDocumentTypes;
+       }
+
+       /**
+        * Sets whatever layout is locked
+        * @param isLocked isLocked to set
+        */
+       public void setLocked(boolean isLocked) {
+               this.isLocked = isLocked;
+       }
+
+       /**
+        * Gets whatever layout is locked
+        * @return whatever layout is locked
+        */
+       public boolean isLocked() {
+               return isLocked;
+       }
+
+       /**
+        * Gets companyID
+        * @return companyID
+        */
+       public Integer getCompanyID() {
+               return companyID;
+       }
+       
+       /**
+        * Gets layout
+        * @return layout
+        */
+       public Layout getLayout() {
+               return layout;
+       }
+
+       /**
+        * Sets layout
+        * @param layout layout to set
+        */
+       public void setLayout(Layout layout) {
+               this.layout = layout;
+       }
+
+       /**
+        * Sets name of user who has this layout locked
+        * @param lockedUser the lockedUser to set
+        */
+       public void setLockedUser(String lockedUser) {
+               this.lockedUser = lockedUser;
+       }
+
+       /**
+        * Gets name of user who has this layout locked
+        * @return the lockedUser
+        */
+       public String getLockedUser() {
+               return lockedUser;
+       }
+
+       /**
+        * Sets suffix of properties file with localization 
+        * @param localization the localization to set
+        */
+       public void setLocalization(String localization) {
+               this.localization = localization;
+       }
+
+       /**
+        * Gets suffix of properties file with localization
+        * @return the localization
+        */
+       public String getLocalization() {
+               return localization;
+       }
+       
+       /**
+        * Gets list of all supported localization
+        * @return the LOCALIZATION
+        */
+       public List<String> getLOCALIZATION() {
+               return LOCALIZATION;
+       }
+
+}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/AbsoluteCoordinates.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/AbsoluteCoordinates.java       
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/AbsoluteCoordinates.java
  2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 /**
  * AbsoluteCoordinates.java

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ActionsMemory.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ActionsMemory.java     
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ActionsMemory.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,7 +1,10 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Stack;
 
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.ToolBar;
+
 /**
  * ActionsMemory.java
  * Stores actions in memory and allows go backward and forward 
@@ -98,7 +101,7 @@
 
                designArea.setSize(designArea.getWidth(),
                                designArea.getHeight());
-               designArea.repaint();
+               designArea.paintAllPositions();
        }
 
        
@@ -143,7 +146,7 @@
 
                designArea.setSize(designArea.getWidth(),
                                designArea.getHeight());
-               designArea.repaint();
+               designArea.paintAllPositions();
 
        }
        

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/CloseLayout.java       
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
  2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,8 +1,13 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Properties;
 import javax.swing.JRootPane;
 
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.dialog.SaveLayoutOnServer;
+import com.elvys.applet.dialog.UnsavedLayoutClosedDialog;
+
 /**
  * 
  * CloseLayout handles closing of actual or of all design areas in 
LayoutDesigner

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ComponentSizes.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ComponentSizes.java    
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ComponentSizes.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,151 +0,0 @@
-package applet;
-
-/**
- * ComponentSizes.java
- * @author EvaV
- */
-import java.awt.Dimension;
-
-/**
- * ComponentSizes manages sizes of the components 
- *
- */
-public class ComponentSizes {
-       
-       // fields
-       private Dimension applet;                                       /** 
sizes of whole applet */
-       private Dimension tabbedPane;                           /** sizes of 
tabbed pane */
-       private Dimension designArea;                           /** sizes of 
design area */
-       private Dimension menuBar;                                      /** 
sizes of menu bar */
-       private Dimension statusBar;                            /** sizes of 
status bar */      
-       private Dimension toolBar;                                      /** 
sizes of tool bar */
-       private Dimension propertiesManager;            /** sizes of properties 
manager */
-       
-       // constructors
-       /**
-        * Empty constructor of class ComponentSizes
-        */
-       public ComponentSizes() {
-               applet = new Dimension(0, 0);
-               tabbedPane = new Dimension(0, 0);
-               designArea = new Dimension(0, 0);
-               menuBar = new Dimension(0, 0);
-               statusBar = new Dimension(0, 0);
-               toolBar = new Dimension(0, 0);
-               propertiesManager = new Dimension(0, 0);
-       }
-       
-       // getters & setters
-       /**
-        * Setter of field applet
-        * @param applet the applet to set
-        */
-       public void setApplet(Dimension applet) {
-               this.applet = applet;
-       }
-       
-       /**
-        * Getter of field applet
-        * @return the applet
-        */
-       public Dimension getApplet() {
-               return applet;
-       }
-       
-       /**
-        * Setter of field tabbedPane
-        * @param tabbedPane the tabbedPane to set
-        */
-       public void setTabbedPane(Dimension tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-       
-       /**
-        * Getter of field tabbedPane
-        * @return the tabbedPane
-        */
-       public Dimension getTabbedPane() {
-               return tabbedPane;
-       }
-       
-       /**
-        * Setter of field statusBar
-        * @param statusBar the statusBar to set
-        */
-       public void setStatusBar(Dimension statusBar) {
-               this.statusBar = statusBar;
-       }
-       
-       /**
-        * Getter of field statusBar
-        * @return the statusBar
-        */
-       public Dimension getStatusBar() {
-               return statusBar;
-       }
-       
-       /**
-        * Setter of field propertiesManager
-        * @param propertiesManager the propertiesManager to set
-        */
-       public void setPropertiesManager(Dimension propertiesManager) {
-               this.propertiesManager = propertiesManager;
-       }
-       
-       /**
-        * Getter of field propertiesManager
-        * @return the propertiesManager
-        */
-       public Dimension getPropertiesManager() {
-               return propertiesManager;
-       }
-
-       /**
-        * Setter of field designArea
-        * @param designArea the designArea to set
-        */
-       public void setDesignArea(Dimension designArea) {
-               this.designArea = designArea;
-       }
-
-       /**
-        * Getter of field designArea
-        * @return the designArea
-        */
-       public Dimension getDesignArea() {
-               return designArea;
-       }
-
-       /**
-        * Setter of field toolBar
-        * @param toolBar the toolBar to set
-        */
-       public void setToolBar(Dimension toolBar) {
-               this.toolBar = toolBar;
-       }
-
-       /**
-        * Getter of field toolBar
-        * @return the toolBar
-        */
-       public Dimension getToolBar() {
-               return toolBar;
-       }
-
-       /**
-        * Setter of field menuBar
-        * @param menuBar the menuBar to set
-        */
-       public void setMenuBar(Dimension menuBar) {
-               this.menuBar = menuBar;
-       }
-
-       /**
-        * Getter of field menuBar
-        * @return the menuBar
-        */
-       public Dimension getMenuBar() {
-               return menuBar;
-       }
-       
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Corners.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Corners.java   2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Corners.java  
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -3,7 +3,7 @@
  * @author Eva Viktorinova
  * 
  */
-package applet;
+package com.elvys.applet.structures;
 
 /**
  * @class Corners

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DesignArea.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/DesignArea.java        
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DesignArea.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,1168 +0,0 @@
-package applet;
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Graphics;
-import java.awt.event.KeyAdapter;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Properties;
-import java.util.Vector;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.border.LineBorder;
-
-/**
- * DesignArea displays positions of documents
- * 
- * @author EvaV
- */
-@SuppressWarnings("serial")
-public class DesignArea extends JPanel {
-       // fields
-       private int id = 0;                                      /** id of the 
newly designed position */
-
-       private int monitorTopX = 0;            /** topX coordinate of actually 
designed position on monitor */ 
-       private int monitorTopY = 0;            /** topY coordinate of actually 
designed position on monitor */
-       private int monitorWidth = 0;           /** width of actually designed 
position on monitor */
-       private int monitorHeight = 0;          /** height of actually designed 
position on monitor */
-
-       private int elvysTopX = 0;                      /** topX coordinate of 
actually designed position on elvys */
-       private int elvysTopY = 0;                      /** topY coordinate of 
actually designed position on elvys */
-       private int elvysWidth = 0;             /** width of actually designed 
position on elvys */
-       private int elvysHeight = 0;            /** height of actually designed 
position on elvys */
-
-       private int monitorStartX = 0;                  /** x coordinate on 
monitor of mouse position when designing of position started */
-       private int monitorActualX = 0;                 /** x coordinate on 
monitor of the actual mouse position */
-       private int monitorStartY = 0;                  /** y coordinate on 
monitor of mouse position when designing of position started */ 
-       private int monitorActualY = 0;                 /** y coordinate on 
monitor of the actual mouse position */
-
-       private int elvysStartX = 0;                    /** x coordinate on 
elvys of mouse position when designing of position started */
-       private int elvysActualX = 0;                   /** x coordinate on 
elvys of the actual mouse position */
-       private int elvysStartY = 0;                    /** y coordinate on 
elvys of mouse position when designing of position started */
-       private int elvysActualY = 0;                   /** y coordinate on 
elvys of the actual mouse position */
-
-       private int pasteTopX = 0;                              /** topX 
coordinate of location where copied positions will be pasted */
-       private int pasteTopY = 0;                              /** topY 
coordinate of location where copied positions will be pasted */
-
-       private Layout layout;                                  /** actual 
layout */
-       private Positions positionsToPaste;             /** copied positions */
-       private PopupMenu popupMenu;                    /** popup menu */
-       private Position oldPosition;                   /** old position */
-       private ActionsMemory actionMemory;             /** backward and 
forward actions */
-       private TabbedPane tabbedPane;                  /** main tabbed pane */
-       private DesignArea designArea;                  /** this design area */
-       private MovingObjects objects;                  /** object 
corresponding to positions */
-       private int lastCorDesignAreaWidth = 0;                 /** last 
correct width of design area */
-       private int lastCorDesignAreaHeight = 0;                /** last 
correct height of design area */
-
-       // flags
-       
-       private boolean showSelectRectangle;                    /** flag 
whatever to show select rectangle and allow selection of positions with it */
-       private boolean isSaved = true;                                 /** 
flag whatever layout for this design area is saved */
-       private boolean hasNeverBeenSaved = true;               /** flag 
whatever layout for this design area has ever been saved */
-       private boolean isNotDesigning = true;                  /** flag 
whatever user is designing position */
-       private boolean isInDesignMode = false;                 /** flag 
whatever applet is in design mode - it is allowed to design position */
-       private boolean isNotMoving = true;                             /** 
flag whatever user is moving or resizing position */
-       private boolean isResizable = false;                    /** flag 
whatever it is allowed to resize design area */
-       private boolean arePositionToPaste = false;             /** flag 
whatever there are position in clipboard to paste */
-       private boolean isShowGridEnabled = false;              /** flag 
whatever to show grid */
-       private boolean isSnapToGridEnabled = false;    /** flag whatever snap 
to grid of positions is enabled */
-
-
-       // constants
-       private final static int RESIZABLE_AREA_SIZE = 20;              /** 
size of area in bottom right corner of design area where design area is 
resizable */
-       private final static int TABBED_PANE_X_BORDER = 5;              /** 
size of x border of tabbed pane */
-       private final static int TABBED_PANE_Y_BORDER = 32;             /** 
size of y border of tabbed pane */
-
-
-       // constructors
-       /**
-        * Constructor of the class DesignArea
-        * @param tabbedPane main tabbed pane
-        * @param layout actual layout
-        */
-       public DesignArea(TabbedPane tabbedPane, Layout layout) {
-
-               this.actionMemory = new ActionsMemory();
-               this.tabbedPane = tabbedPane;
-
-               if (tabbedPane == null) {
-                       return;
-               }
-
-               this.layout = layout;
-               this.designArea = this;
-
-               this.arePositionToPaste = false;
-               this.isInDesignMode = false;
-               designArea.setBorder(new LineBorder(Color.black));
-
-               this.id = layout.getLayoutPositions().size();
-
-               designArea.setLayout(null);
-
-               // design are is focusable
-               this.setFocusable(true);
-               this.requestFocusInWindow(true);
-
-               // adds first empty layout to actions memory
-               actionMemory.addAction(designArea, layout.clone());
-
-               // adds popup menu
-               popupMenu = new PopupMenu(designArea, 
tabbedPane.getProperties());
-               MouseListener popupListener = popupMenu.new 
PopupListener(popupMenu);
-               addMouseListener(popupListener);
-
-               // adds key listener
-               addKeyListener(new KeyAdapter() {
-                       public void keyPressed(KeyEvent e) {
-                               designAreaKeyPressed(e);
-                       }
-               });
-
-               // adds mouse listener
-               addMouseListener(new MouseAdapter() {
-                       public void mouseClicked(MouseEvent e) {
-                               designAreaMouseClicked(e);
-                       }
-
-                       public void mousePressed(MouseEvent e) {
-                               startDesignPosition(e);
-                       }
-
-                       public void mouseReleased(MouseEvent e) {
-                               endDesignPosition(e);
-                       }
-
-               });
-
-               // adds mouse motion listener
-               addMouseMotionListener(new MouseAdapter() {
-                       @Override
-                       public void mouseDragged(MouseEvent e) {
-                               continueDesignPosition(e);
-                       }
-
-                       public void mouseMoved(MouseEvent e) {
-                               designAreaMouseMoved(e);
-                       }
-               });
-
-       }
-
-       // methods
-
-       /**
-        * Generates x coordinate on elvys from x coordinate on monitor
-        * @param monitorX x coordinate on monitor
-        * @return x coordinate on elvys
-        */
-       public int getElvysX(int monitorX) {
-
-               if (layout == null) {
-                       return monitorX;
-               }
-
-               int monitorWidth = 
layout.getScreenResolution().getMonitorWidth();
-               int elvysWidth = layout.getScreenResolution().getElvysWidth();
-
-               if (monitorWidth == 0) {
-                       return monitorX;
-               }
-
-               return (int) Math
-                               .round((double) (monitorX * elvysWidth / 
monitorWidth));
-
-       }
-
-       /**
-        * Generates y coordinate on elvys from y coordinate on monitor
-        * @param monitorY y coordinate on monitor
-        * @return y coordinate on elvys
-        */
-       public int getElvysY(int monitorY) {
-
-               if (layout == null) {
-                       return monitorY;
-               }
-
-               int monitorHeight = 
layout.getScreenResolution().getMonitorHeight();
-               int elvysHeight = layout.getScreenResolution().getElvysHeight();
-
-               if (monitorHeight == 0) {
-                       return monitorY;
-               }
-
-               return (int) Math.round((double) monitorY * elvysHeight
-                               / monitorHeight);
-
-       }
-       
-       /**
-        * Decides whatever this mouse location is in the design area
-        * @param x x coordinate of the given mouse location
-        * @param y y coordinate of the given mouse location
-        * @return whatever this location is in the design area
-        */
-       private boolean isInDesignArea(int x, int y) {
-               int height = designArea.getHeight();
-               int width = designArea.getWidth();
-
-               if (x < 0 || y < 0 || x > width || y > height) {
-                       return false;
-               }
-               return true;
-       }
-
-       /**
-        * Actualizes cursor shape according to the actual mouse position
-        * 
-        * @param x
-        *            x coordinate of the actual mouse position
-        * @param y
-        *            y coordinate of the actual mouse position
-        */
-       public void actualizeCursor(int x, int y) {
-
-               if (!isInDesignArea(x, y)) {
-                       designArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-               } else if (isInResizableArea(x, y) && !isInDesignMode) {
-                       designArea.setCursor(new 
Cursor(Cursor.SE_RESIZE_CURSOR));
-               } else if (isInDesignMode) {
-                       designArea.setCursor(new 
Cursor(Cursor.CROSSHAIR_CURSOR));
-               } else {
-                       designArea.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
-               }
-       }
-
-       /**
-        * Gets width of the design area
-        * 
-        * @return width of design area
-        */
-       public int getWidth() {
-               ScreenResolution screenSizes = layout.getScreenResolution();
-               return screenSizes.getMonitorWidth();
-       }
-
-       /**
-        * Gets height of the design area
-        * 
-        * @return height of design area
-        */
-       public int getHeight() {
-               ScreenResolution screenSizes = layout.getScreenResolution();
-               return screenSizes.getMonitorHeight();
-       }
-
-       /**
-        * Performs action according to the pressed key resizes, moves, copies,
-        * pastes or deletes selected positions - if user pressed keys at the 
design area
-        * 
-        * @param e
-        *            key event
-        */
-       public void designAreaKeyPressed(KeyEvent e) {
-               int deltaTopX = 0;
-               int deltaTopY = 0;
-               int deltaWidth = 0;
-               int deltaHeight = 0;
-
-               int KEY_MOVE_SIZE_X = 1;
-               int KEY_MOVE_SIZE_Y = 1;
-               if (isSnapToGridEnabled()) {
-                       Grid grid = new Grid(designArea);
-                       KEY_MOVE_SIZE_X = grid.getKioskGridXSize();
-                       KEY_MOVE_SIZE_Y = grid.getKioskGridYSize();
-               }
-
-               int keyCode = e.getKeyCode();
-               Layout.AddType addType;
-
-               Properties properties = tabbedPane.getProperties();
-               // if Alt is down, position is resized
-               if (e.isAltDown()) {
-                       addType = Layout.AddType.RESIZE;
-                       switch (keyCode) {
-                       case KeyEvent.VK_DOWN:
-                               deltaHeight = KEY_MOVE_SIZE_Y;
-                               break;
-                       case KeyEvent.VK_UP:
-                               deltaTopY = -KEY_MOVE_SIZE_Y;
-                               deltaHeight = KEY_MOVE_SIZE_Y;
-                               break;
-                       case KeyEvent.VK_LEFT:
-                               deltaTopX = -KEY_MOVE_SIZE_X;
-                               deltaWidth = KEY_MOVE_SIZE_X;
-                               break;
-                       case KeyEvent.VK_RIGHT:
-                               deltaWidth = KEY_MOVE_SIZE_X;
-                               break;
-                       }
-                       layout.moveOrResizePositionsWithKeyboard(designArea, 
deltaTopX,
-                                       deltaTopY, deltaWidth, deltaHeight, 
addType);
-               }
-
-               // if Ctrl is down, position is copied or pasted
-               else if (e.isControlDown()) {
-
-                       switch (keyCode) {
-                       // Ctrl + C
-                       case KeyEvent.VK_C:
-                               PopupMenu menu = new PopupMenu(designArea, 
properties);
-                               menu = new PopupMenu(designArea, properties);
-                               menu.copy(designArea);
-                               break;
-                       // Ctrl + V
-                       case KeyEvent.VK_V:
-                               addType = Layout.AddType.PASTE;
-                               menu = new PopupMenu(designArea, properties);
-                               menu.paste(designArea, pasteTopX, pasteTopY);
-                               break;
-
-                       case KeyEvent.VK_Z:
-                               actionMemory.backwardAction(designArea);
-                               break;
-                       case KeyEvent.VK_Y:
-                               actionMemory.forwardAction(designArea);
-                               break;
-                       }
-
-               }
-
-               // if Delete is pushed, position is deleted
-               else if (keyCode == KeyEvent.VK_DELETE) {
-                       PopupMenu menu = new PopupMenu(designArea, properties);
-                       menu.delete(designArea);
-               }
-
-               // else is position moved
-               else {
-
-                       addType = Layout.AddType.MOVE;
-                       switch (keyCode) {
-
-                       case KeyEvent.VK_DOWN:
-                               deltaTopY = KEY_MOVE_SIZE_Y;
-                               break;
-                       case KeyEvent.VK_UP:
-                               deltaTopY = -KEY_MOVE_SIZE_Y;
-                               break;
-                       case KeyEvent.VK_LEFT:
-                               deltaTopX = -KEY_MOVE_SIZE_X;
-                               break;
-                       case KeyEvent.VK_RIGHT:
-                               deltaTopX = KEY_MOVE_SIZE_X;
-                               break;
-                       }
-                       layout.moveOrResizePositionsWithKeyboard(designArea, 
deltaTopX,
-                                       deltaTopY, deltaWidth, deltaHeight, 
addType);
-
-               }
-
-       }
-
-       /**
-        * Deselects all positions and actualizes mouse cursor - if user 
clicked on the design area
-        * @param e mouse event
-        */
-       private void designAreaMouseClicked(MouseEvent e) {
-
-               layout.deselectAllPositions(designArea);
-               designArea.requestFocusInWindow();
-
-               actualizeCursor(e.getX(), e.getY());
-       }
-
-       /**
-        * Starts designing of the new position - if LayoutDesigner is in 
design mode and user pressed left mouse button in the design area
-        * Starts selecting of positions with select rectangle - if 
LayoutDesigner isn't in design mode and user pressed left mouse button in the 
design area
-        * @param e mouse event
-        */
-       private void startDesignPosition(MouseEvent e) {
-
-               if (e.isPopupTrigger()) {
-                       return;
-               }
-
-               // wasn't pressed left mouse button
-               if (e.getButton() != MouseEvent.BUTTON1) {
-                       return;
-               }
-
-               setNotDesigning(false);
-               setIsNotMoving(true);
-               designArea.requestFocusInWindow();
-
-               // is in design mode
-               if (isInDesignMode) {
-
-                       id = layout.getLayoutPositions().getPositions().size();
-                       ++id;
-
-                       oldPosition = new Position(tabbedPane);
-
-                       monitorStartX = e.getX();
-                       monitorStartY = e.getY();
-
-
-                       if (!isInDesignArea(monitorStartX, monitorStartY)) {
-                               monitorStartX = 0;
-                               monitorStartY = 0;
-                               elvysStartX = 0;
-                               elvysStartY = 0;
-                               return;
-                       }
-
-                       if (isSnapToGridEnabled) {
-                               Grid grid = new Grid(monitorStartX, 
monitorStartY);
-                               grid.snapToGridMonitorCoordinates(designArea);
-                               monitorStartX = grid.getX();
-                               monitorStartY = grid.getY();
-                               grid = new Grid(designArea);
-                               grid.snapElvysFromMonitorToGrid(monitorStartX, 
monitorStartY, designArea);
-                               elvysStartX = grid.getX();
-                               elvysStartY = grid.getY();
-
-                       } else {
-                               elvysStartX = getElvysX(monitorStartX);
-                               elvysStartY = getElvysY(monitorStartY);
-                       }
-
-                       monitorTopX = monitorStartX;
-                       monitorTopY = monitorStartY;
-
-                       elvysTopX = elvysStartX;
-                       elvysTopY = elvysStartY;
-
-                       Position newPosition = new Position(tabbedPane);
-
-                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
-                                       monitorTopY, monitorWidth, 
monitorHeight));
-                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX,
-                                       elvysTopY, elvysWidth, elvysHeight));
-                       newPosition.setId(id);
-                       Position.IsSnappedToGrid snapped = 
newPosition.isSnappedToGrid();
-                       snapped.setHeight(designArea.isSnapToGridEnabled());
-                       snapped.setWidth(designArea.isSnapToGridEnabled());
-                       snapped.setTopX(designArea.isSnapToGridEnabled());
-                       snapped.setTopY(designArea.isSnapToGridEnabled());
-                       newPosition.setSnappedToGrid(snapped);
-
-                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
-                                       newPosition, designArea, 
Layout.AddType.DESIGN, false);
-                       newPosition.selectPosition(e.isControlDown(), 
designArea);
-
-               } 
-               // isn't in design mode
-               else {
-                       monitorStartX = e.getX();
-                       monitorStartY = e.getY();
-
-                       monitorTopX = monitorStartX;
-                       monitorTopY = monitorStartY;
-                       showSelectRectangle = true;
-
-                       isResizable = isInResizableArea(e.getX(), e.getY());
-                       lastCorDesignAreaWidth = designArea.getWidth();
-                       lastCorDesignAreaHeight = designArea.getHeight();
-
-               }
-               actualizeCursor(e.getX(), e.getY());
-       }
-
-       /**
-        * Actualizes status bar and checks whatever at least one type of 
document is selected for the actual position 
-        * @param e mouse event
-        */
-       private void designAreaMouseMoved(MouseEvent e) {
-
-               pasteTopX = e.getX();
-               pasteTopY = e.getY();
-
-               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
-                               getElvysX(e.getX()), getElvysY(e.getY()));
-
-               isResizable = isInResizableArea(e.getX(), e.getY());
-
-               designArea.requestFocusInWindow();
-
-               Properties properties = tabbedPane.getProperties();
-               Positions positions = layout.getSelectedPositions();
-               if (positions.size() >= 1) {
-                       
tabbedPane.getPropertiesManager().actualizeDocumentTypes();
-                       if (!positions.isAtLeastOneDocumentTypePermitted()) {
-                               new WarningDialog(new JFrame(), properties
-                                               
.getProperty("warning.noneTypeOfDocumentSelected"),
-                                               
properties.getProperty("warning.warning"));
-                               
tabbedPane.getPropertiesManager().getDocumentTypes()
-                                               
.setAllTypesPermittedButtonEnabled(true);
-                               
tabbedPane.getPropertiesManager().getDocumentTypes()
-                                               
.setAllTypesPermittedButtonSelected(true);
-                               
tabbedPane.getPropertiesManager().getDocumentTypes()
-                                               .permitDocumentTypes();
-                               designArea.repaint();
-                       }
-
-               }
-
-               actualizeCursor(e.getX(), e.getY());
-       }
-
-       /**
-        * 
-        * Ends designing of the position - if LayoutDesigner is in design mode 
and user released left mouse button in the design area
-        * Selects positions in select rectangle - if LayoutDesigner isn't 
design mode and user released left mouse button in the design area
-        * @param e
-        *            mouse event
-        */
-       private void endDesignPosition(MouseEvent e) {
-
-               if (e.isPopupTrigger()) {
-                       return;
-               }
-
-               // is in design mode
-               if (isInDesignMode) {
-
-               
-                       monitorActualX = e.getX();
-                       monitorActualY = e.getY();
-
-                       if (isSnapToGridEnabled) {
-                               Grid grid = new Grid(monitorActualX, 
monitorActualY);
-                               grid.snapToGridMonitorCoordinates(designArea);
-                               monitorActualX = grid.getX();
-                               monitorActualY = grid.getY();
-                               grid = new Grid(designArea);
-                               grid.snapElvysFromMonitorToGrid(monitorActualX, 
monitorActualY, designArea);
-                               elvysActualX = grid.getX();
-                               elvysActualY = grid.getY();
-
-                       } else {
-                               elvysActualX = getElvysX(monitorActualX);
-                               elvysActualY = getElvysY(monitorActualY);
-                       }
-
-                       changeCoordinatesAndProperties();
-
-                       Position newPosition = new Position(tabbedPane);
-                       newPosition.setId(id);
-                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX,
-                                       elvysTopY, elvysWidth, elvysHeight));
-                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
-                                       monitorTopY, monitorWidth, 
monitorHeight));
-
-                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
-                                       oldPosition, designArea, 
Layout.AddType.DESIGN, true);
-                       layout.addActionToActionsMemory(designArea);
-
-                       setNotDesigning(true);
-
-                       designArea.repaint();
-                       
-               } 
-               // isn't in design mode
-               else {
-                       layout
-                                       
.selectPositionsInSelectRectangle(tabbedPane, monitorTopX,
-                                                       monitorTopY, 
monitorWidth, monitorHeight, e
-                                                                       
.isControlDown());
-                       showSelectRectangle = false;
-
-                       monitorActualX = e.getX();
-                       monitorActualY = e.getY();
-
-                       changeCoordinatesAndProperties();
-
-                       designArea.resizeDesignArea(e.getX(), e.getY(), 
lastCorDesignAreaWidth,
-                                       lastCorDesignAreaHeight);
-
-                       actualizeCursor(e.getX(), e.getY());
-               }
-               monitorTopX = 0;
-               monitorTopY = 0;
-               monitorWidth = 0;
-               monitorHeight = 0;
-               monitorStartX = 0;
-               monitorActualX = 0;
-               monitorStartY = 0;
-               monitorActualY = 0;
-
-               elvysTopX = 0;
-               elvysTopY = 0;
-               elvysWidth = 0;
-               elvysHeight = 0;
-               elvysStartX = 0;
-               elvysActualX = 0;
-               elvysStartY = 0;
-               elvysActualY = 0;
-
-               actualizeCursor(e.getX(), e.getY());
-
-               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
-                               e.getX(), e.getY());
-       }
-
-       /**
-        * Continues designing of the position - if LayoutDesigner is in design 
mode and user drags left mouse button in the design area
-        * Resizes design area - if LayoutDesigner isn't in design mode
-        * @param e mouse event
-        */
-       private void continueDesignPosition(MouseEvent e) {
-
-               if (e.isPopupTrigger()) {
-                       return;
-               }
-
-               // is in design mode
-               if (isInDesignMode) {
-
-
-                       monitorActualX = e.getX();
-                       monitorActualY = e.getY();
-
-                       if (isSnapToGridEnabled) {
-                               Grid grid = new Grid(monitorActualX, 
monitorActualY);
-                               grid.snapToGridMonitorCoordinates(designArea);
-                               monitorActualX = grid.getX();
-                               monitorActualY = grid.getY();
-                               grid = new Grid(designArea);
-                               grid.snapElvysFromMonitorToGrid(monitorActualX, 
monitorActualY, designArea);
-                               elvysActualX = grid.getX();
-                               elvysActualY = grid.getY();
-
-                       } else {
-                               elvysActualX = getElvysX(monitorActualX);
-                               elvysActualY = getElvysY(monitorActualY);
-                       }
-
-                       Positions positions = layout.getLayoutPositions();
-
-                       int monitorOldTopX = monitorTopX;
-                       int monitorOldTopY = monitorTopY;
-                       int monitorOldWidth = monitorWidth;
-                       int monitorOldHeight = monitorHeight;
-
-                       int kiosekOldTopX = elvysTopX;
-                       int kiosekOldTopY = elvysTopY;
-                       int kiosekOldWidth = elvysWidth;
-                       int kiosekOldHeight = elvysHeight;
-
-                       changeCoordinatesAndProperties();
-
-                       Position newPosition = new Position(tabbedPane);
-                       newPosition.setId(id);
-                       newPosition.setMonitor(new 
AbsoluteCoordinates(monitorTopX,
-                                       monitorTopY, monitorWidth, 
monitorHeight));
-                       newPosition.setElvys(new AbsoluteCoordinates(elvysTopX,
-                                       elvysTopY, elvysWidth, elvysHeight));
-
-                       if (!newPosition.isElvysOverlap(positions)) {
-                               oldPosition.setMonitor(new 
AbsoluteCoordinates(monitorOldTopX,
-                                               monitorOldTopY, 
monitorOldWidth, monitorOldHeight));
-                               oldPosition.setElvys(new 
AbsoluteCoordinates(kiosekOldTopX,
-                                               kiosekOldTopY, kiosekOldWidth, 
kiosekOldHeight));
-                       }
-
-                       layout.addPosition(layout.getLayoutPositions(), 
newPosition,
-                                       oldPosition, designArea, 
Layout.AddType.DESIGN, false);
-
-               }
-
-               // resizes design area
-               else {
-                       monitorActualX = e.getX();
-                       monitorActualY = e.getY();
-
-                       changeCoordinatesAndProperties();
-                       designArea.resizeDesignArea(e.getX(), e.getY(), 
lastCorDesignAreaWidth,
-                                       lastCorDesignAreaHeight);
-               }
-               actualizeCursor(e.getX(), e.getY());
-
-               
tabbedPane.getStatusBar().actualizeStatusBarMouseCoordinates(layout,
-                               e.getX(), e.getY());
-       }
-
-       
-       /**
-        * Gets new width and height of the design area - in bounds of the 
tabbed pane
-        * @param lastCorWidth last correct design area width
-        * @param lastCorHeight last correct design area height
-        * @param width new design area width - possible out of tabbed pane 
bounds
-        * @param height new design area height - possible out of tabbed pane 
bounds
-        * @param maxWidth max possible width of design area
-        * @param maxHeight max possible height of design area
-        */
-       private void getNewSizesInBounds(int lastCorWidth, int lastCorHeight, 
int width,
-                       int height, int maxWidth, int maxHeight) {
-
-               int stepX = 1;
-               int stepY = 1;
-
-               if (lastCorWidth > width)
-                       stepX = -1;
-
-               if (lastCorHeight > height)
-                       stepY = -1;
-
-               for (int x = lastCorWidth; x != width; x += stepX) {
-                       for (int y = lastCorHeight; y != height; y += stepY) {
-
-                               if (x == maxWidth) {
-                                       lastCorDesignAreaWidth = maxWidth;
-                                       lastCorDesignAreaHeight = maxWidth * 
lastCorHeight / lastCorWidth;
-                               }
-
-                               if (y == maxHeight) {
-                                       lastCorDesignAreaWidth = maxHeight * 
lastCorWidth / lastCorHeight;
-                                       lastCorDesignAreaHeight = maxHeight;
-                               }
-
-                       }
-
-               }
-       }
-
-       /**
-        * Resizes design area - keeps resolution, new width and height can be 
in wrong rate and can be detected outside tabbed pane bounds 
-        * @param width new width of the design area
-        * @param height new height of the design area
-        * @param lastCorWidth last correct design area width
-        * @param lastCorHeight last correct design area height 
-        */
-       public void resizeDesignArea(int width, int height, int lastCorWidth, 
int lastCorHeight) {
-
-               if (isResizable) {
-                       ScreenResolution oldScreenSizes = 
layout.getScreenResolution();
-
-                       int minDesignAreaWidth = 10;
-                       int minDesignAreaHeight = minDesignAreaWidth
-                                       * oldScreenSizes.getElvysHeight()
-                                       / oldScreenSizes.getElvysWidth();
-
-                       int heightInRate = width * 
oldScreenSizes.getElvysHeight()
-                                       / oldScreenSizes.getElvysWidth();
-                       int widthInRate = height * 
oldScreenSizes.getElvysWidth()
-                                       / oldScreenSizes.getElvysHeight();
-
-                       int areaWidth = width * heightInRate;
-                       int areaHeight = widthInRate * height;
-
-                        
-                       // choses new width and height in correct rate with 
greater area
-                       if (areaWidth > areaHeight) {
-                               height = heightInRate;
-                       } else {
-                               width = widthInRate;
-                       }
-
-                       if (width <= minDesignAreaWidth || height <= 
minDesignAreaHeight) {
-                               width = minDesignAreaWidth;
-                               height = minDesignAreaHeight;
-                       }
-
-                       int maxWidth = tabbedPane.getWidth() - 
TABBED_PANE_X_BORDER;
-                       int maxHeight = tabbedPane.getHeight() - 
TABBED_PANE_Y_BORDER;
-
-
-
-                       if (width >= maxWidth || height >= maxHeight) {
-
-                               getNewSizesInBounds(lastCorDesignAreaWidth, 
lastCorDesignAreaHeight, width, height, maxWidth, maxHeight);
-                               width = lastCorDesignAreaWidth;
-                               height = lastCorDesignAreaHeight;
-
-                       }
-
-                       if (width > maxWidth || height > maxHeight) {
-                               width = oldScreenSizes.getMonitorWidth();
-                               height = oldScreenSizes.getMonitorHeight();
-                       }
-
-                       lastCorDesignAreaWidth = width;
-                       lastCorDesignAreaHeight = height;
-
-                       ScreenResolution newScreenSizes = new 
ScreenResolution();
-                       newScreenSizes.setMonitorHeight(height);
-                       newScreenSizes.setMonitorWidth(width);
-                       
newScreenSizes.setElvysWidth(oldScreenSizes.getElvysWidth());
-                       
newScreenSizes.setElvysHeight(oldScreenSizes.getElvysHeight());
-
-                       layout.setScreenResolution(newScreenSizes);
-                       designArea.setSize(newScreenSizes.getMonitorWidth(), 
newScreenSizes
-                                       .getMonitorHeight());
-
-                       Positions positions = layout.getLayoutPositions();
-                       positions.changeMonitorResolution(designArea, 
oldScreenSizes,
-                                       newScreenSizes);
-
-               }
-       }
-
-       /**
-        * Decides, if it is allowed to resize design area according to actual
-        * coordinates of mouse
-        * 
-        * @param x x coordinate of the actual position of mouse
-        * @param y y coordinate of the actual position of mouse
-        * @return true, if you can resize, false, if you can't
-        */
-
-       private boolean isInResizableArea(int x, int y) {
-
-               ScreenResolution screenSizes = layout.getScreenResolution();
-               boolean isAroundRightBorder = x >= screenSizes.getMonitorWidth()
-                               - RESIZABLE_AREA_SIZE;
-               boolean isAroundBottomBorder = y >= 
screenSizes.getMonitorHeight()
-                               - RESIZABLE_AREA_SIZE;
-               if (isAroundRightBorder && isAroundBottomBorder) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
-       /**
-        * Changes parameters of the designed position according to moves of 
the mouse
-        */
-       private void changeCoordinatesAndProperties() {
-
-               monitorTopX = Math.min(monitorStartX, monitorActualX);
-               monitorTopY = Math.min(monitorStartY, monitorActualY);
-               monitorWidth = Math.max(monitorStartX, monitorActualX) - 
monitorTopX;
-               monitorHeight = Math.max(monitorStartY, monitorActualY) - 
monitorTopY;
-
-               int WIDTH = layout.getScreenResolution().getMonitorWidth();
-               int HEIGHT = layout.getScreenResolution().getMonitorHeight();
-
-               Position position = new Position(tabbedPane);
-               Position.IsSnappedToGrid snapped = position.isSnappedToGrid();
-               snapped.setHeight(designArea.isSnapToGridEnabled());
-               snapped.setWidth(designArea.isSnapToGridEnabled());
-               snapped.setTopX(designArea.isSnapToGridEnabled());
-               snapped.setTopY(designArea.isSnapToGridEnabled());
-               position.setSnappedToGrid(snapped);
-               AbsoluteCoordinates absolute = position
-                               
.changeCoordinatesToNotBeOutOfDesignArea(monitorTopX,
-                                               monitorTopY, monitorWidth, 
monitorHeight, WIDTH,
-                                               HEIGHT, Layout.AddType.DESIGN, 
false, designArea);
-               monitorTopX = absolute.getTopX();
-               monitorTopY = absolute.getTopY();
-               monitorWidth = absolute.getWidth();
-               monitorHeight = absolute.getHeight();
-
-               elvysTopX = Math.min(elvysStartX, elvysActualX);
-               elvysTopY = Math.min(elvysStartY, elvysActualY);
-               elvysWidth = Math.max(elvysStartX, elvysActualX) - elvysTopX;
-               elvysHeight = Math.max(elvysStartY, elvysActualY) - elvysTopY;
-
-               int kiosekWIDTH = layout.getScreenResolution().getElvysWidth();
-               int kiosekHEIGHT = 
layout.getScreenResolution().getElvysHeight();
-
-               position = new Position(tabbedPane);
-               absolute = 
position.changeCoordinatesToNotBeOutOfDesignArea(elvysTopX,
-                               elvysTopY, elvysWidth, elvysHeight, kiosekWIDTH,
-                               kiosekHEIGHT, Layout.AddType.DESIGN, true, 
designArea);
-               elvysTopX = absolute.getTopX();
-               elvysTopY = absolute.getTopY();
-               elvysWidth = absolute.getWidth();
-               elvysHeight = absolute.getHeight();
-
-       }
-
-       /**
-        * Paints all positions in the actual design area
-        * 
-        * @param g graphics
-        */
-       public void paintComponent(Graphics g) {
-
-               super.paintComponent(g);
-
-               // paints grid
-               if (isShowGridEnabled()) {
-
-                       Grid grid = new Grid(designArea);
-                       grid.paintGrid(g, designArea);
-               }
-
-               // paints positions selection rectangle
-               if (showSelectRectangle && !isResizable) {
-                       g.setColor(Color.lightGray);
-                       g.drawRect(monitorTopX, monitorTopY, monitorWidth, 
monitorHeight);
-               }
-
-               // paints positions
-               if (isNotMoving) {
-
-                       designArea.removeAll();
-
-                       Vector<Position> positions = layout.getLayoutPositions()
-                                       .getPositions();
-
-                       objects = new MovingObjects();
-                       for (int i = 0; i < positions.size(); ++i) {
-                               Position actualPosition = positions.get(i);
-                               objects.add(actualPosition.paint(designArea));
-                       }
-               }
-
-       }
-
-       // getters & setters
-
-       /**
-        * Sets whatever some position in design area is moving
-        * @param isNotMoving
-        *            the isNotMoving to set
-        */
-       public void setIsNotMoving(boolean isNotMoving) {
-               this.isNotMoving = isNotMoving;
-       }
-
-       /**
-        * Gets whatever some position in design area is moving
-        * @return the isNotMoving
-        */
-       public boolean isNotMoving() {
-               return isNotMoving;
-       }
-
-       /**
-        * Sets whatever LayoutDesigner is in design mode 
-        * @param isInDesignMode
-        *            the isInDesignMode to set
-        */
-       public void setInDesignMode(boolean isInDesignMode) {
-               this.isInDesignMode = isInDesignMode;
-       }
-
-       /**
-        * Gets whatever LayoutDesigner is in design mode
-        * @return the isInDesignMode
-        */
-       public boolean isInDesignMode() {
-               return isInDesignMode;
-       }
-
-       /**
-        * Sets whatever some position is designed
-        * @param isNotDesigning
-        *            the isNotDesigning to set
-        */
-       public void setNotDesigning(boolean isNotDesigning) {
-               this.isNotDesigning = isNotDesigning;
-       }
-
-       /**
-        * Gets whatever some position is designed
-        * @return the isNotDesigning
-        */
-       public boolean isNotDesigning() {
-               return isNotDesigning;
-       }
-
-       /**
-        * Sets main tabbed pane
-        * @param tabbedPane main tabbed pane to set
-        */
-       public void setTabbedPane(TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-       /**
-        * Sets whatever layout for this design are is saved
-        * @param isSaved isSaved to set
-        */
-       public void setSaved(boolean isSaved) {
-               this.isSaved = isSaved;
-       }
-
-       /** Gets whatever layout for this design area is saved
-        * 
-        * @return the isSaved
-        */
-       public boolean isSaved() {
-               return this.isSaved;
-       }
-
-       /**
-        * Gets whatever layout for this design area has ever been saved
-        * @return the hasNeverBeenSaved
-        */
-       public boolean hasNeverBeenSaved() {
-               return this.hasNeverBeenSaved;
-       }
-
-       /**
-        * Sets whatever layout for this design area has ever been saved
-        * @param hasNeverBeenSaved to set
-        */
-       public void setHasNeverBeenSave(boolean hasNeverBeenSaved) {
-               this.hasNeverBeenSaved = hasNeverBeenSaved;
-       }
-
-       /**
-        * Gets layout for this design area
-        * @return the layout
-        */
-       public Layout getMyLayout() {
-               return layout;
-       }
-
-       /**
-        * Sets layout for this design area
-        * @param layout
-        *            the layout to set
-        */
-       public void setMyLayout(Layout layout) {
-               this.layout = layout;
-               this.isShowGridEnabled = layout.isShowGridEnabled();
-               this.isSnapToGridEnabled = layout.isSnappedToGrid();
-       }
-
-       /**
-        * Gets main tabbed pane
-        * @return the tabbedPane
-        */
-       public TabbedPane getTabbedPane() {
-               return tabbedPane;
-       }
-
-       /**
-        * Sets whatever there are position to paste in clipboard
-        * @param arePositionToPaste the arePositionToPaste to set
-        */
-       public void setPositionToPaste(boolean arePositionToPaste) {
-               this.arePositionToPaste = arePositionToPaste;
-       }
-
-       /**
-        * Gets whatever there are position to paste in clipboard
-        * @return the arePositionToPaste
-        */
-       public boolean arePositionToPaste() {
-               return arePositionToPaste;
-       }
-
-       /**
-        * Sets forward and backward action memory
-        * @param actionMemory
-        *            the actionMemory to set
-        */
-       public void setActionMemory(ActionsMemory actionMemory) {
-               this.actionMemory = actionMemory;
-       }
-
-       
-       /**
-        * Gets forward and backward action memory
-        * @return the actionMemory
-        */
-       public ActionsMemory getActionMemory() {
-               return actionMemory;
-       }
-
-       /**
-        * Sets whatever is enabled to show grid for this design area
-        * @param isShowGridEnabled
-        *            the isShowGridEnabled to set
-        */
-       public void setShowGridEnabled(boolean isShowGridEnabled) {
-               this.isShowGridEnabled = isShowGridEnabled;
-               this.layout.setShowGridEnabled(isShowGridEnabled);
-       }
-
-       /**
-        * Gets whatever is enabled to show grid for this design area
-        * @return the isShowGridEnabled
-        */
-       public boolean isShowGridEnabled() {
-               return isShowGridEnabled;
-       }
-
-       /**
-        * Sets whatever snap to grid is enabled for this design area 
-        * @param isSnapToGridEnabled
-        *            the isSnapToGridEnabled to set
-        */
-       public void setSnapToGridEnabled(boolean isSnapToGridEnabled) {
-               this.isSnapToGridEnabled = isSnapToGridEnabled;
-               this.layout.setSnappedToGrid(isSnapToGridEnabled);
-
-       }
-
-       /**
-        * Gets whatever snap to grid is enabled for this design area
-        * @return the isSnapToGridEnabled
-        */
-       public boolean isSnapToGridEnabled() {
-               return isSnapToGridEnabled;
-       }
-
-       /**
-        * Copies positions to clipboard
-        * @param positionsToPaste
-        *            the positionsToPaste to set
-        */
-       public void setPositionsToPaste(Positions positionsToPaste) {
-               this.positionsToPaste = positionsToPaste;
-       }
-
-       /**
-        * Gets copied positions
-        * @return the positionsToPaste
-        */
-       public Positions getPositionsToPaste() {
-               return positionsToPaste;
-       }
-       
-       /**
-        * Gets the popup menu
-        * @return the popupMenu
-        */
-       public PopupMenu getPopupMenu() {
-               return popupMenu;
-       }
-
-       /**
-        * Sets the popup menu
-        * @param popupMenu
-        *            the popupMenu to set
-        */
-       public void setPopupMenu(PopupMenu popupMenu) {
-               this.popupMenu = popupMenu;
-       }
-
-       /**
-        * Gets the properties
-        * @return the properties
-        */
-       public Properties getProperties() {
-               return tabbedPane.getProperties();
-       }
-
-       /**
-        * Sets the objects corresponding to positions in this design area
-        * @param objects
-        *            the objects to set
-        */
-       public void setObjects(MovingObjects objects) {
-               this.objects = objects;
-       }
-
-       /**
-        * Gets the objects corresponding to positions in this design area
-        * @return the objects
-        */
-       public MovingObjects getObjects() {
-               return objects;
-       }
-
-}
\ No newline at end of file

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DocumentTypes.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/DocumentTypes.java     
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/DocumentTypes.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,289 +0,0 @@
-/**
- * DocumentTypes.java
- * @author Eva Viktorinova
- */
-package applet;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Properties;
-import java.util.Vector;
-import javax.swing.BoxLayout;
-import javax.swing.JCheckBox;
-import javax.swing.JPanel;
-
-/**
- * @class DocumentTypes Represents part of the properties manager - manages
- *        permitted document typesOfDocuments for actual selected positions
- * 
- */
-@SuppressWarnings("serial")
-public class DocumentTypes extends JPanel {
-
-       private JCheckBox allTypesPermitedButton;                       /** 
button which decides whatever all types of documents are permitted */
-       private Vector<JCheckBox> typePermittedButtons;         /** buttons 
which decides whatever this type of document is permitted */
-       private PropertiesManager propertiesManager;            /** properties 
manager */
-       private Vector<String> typesOfDocuments;                        /** 
list of all types of document */
-
-       /**
-        * Constructor of the class DocumentTypes
-        * @param propertiesManager properties manager
-        * @param documentTypesPanel panel where document types is shown
-        * @param properties properties
-        */
-       public DocumentTypes(PropertiesManager propertiesManager,
-                       JPanel documentTypesPanel, Properties properties) {
-               
-               this.propertiesManager = propertiesManager;
-               this.typesOfDocuments = 
propertiesManager.getAllTypesOfDocuments();
-               
-               this.setFocusable(false);
-               
-               documentTypesPanel.setLayout(new BoxLayout(documentTypesPanel, 
BoxLayout.Y_AXIS));
-               
-               // initializes and adds all types permitted button
-               allTypesPermitedButton = new JCheckBox(properties
-                               .getProperty("documentTypes.all"));
-               allTypesPermitedButton.setSelected(true);
-               allTypesPermitedButton.setFocusable(false);
-               allTypesPermitedButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               permitAllTypesOfDocuments();
-                       }
-               });
-
-               documentTypesPanel.add(allTypesPermitedButton);
-
-               // initializes and add type permitted buttons
-               typePermittedButtons = new Vector<JCheckBox>();
-               for (int i = 0; i < typesOfDocuments.size(); ++i) {
-                       JCheckBox typePermittedButton = new 
JCheckBox(typesOfDocuments.get(i));
-                       typePermittedButton.setFocusable(false);
-                       typePermittedButton.setEnabled(false);
-                       typePermittedButton.addActionListener(new 
ActionListener() {
-                               public void actionPerformed(ActionEvent evt) {
-                                       permitDocumentTypes();
-                               }
-                       });
-                       typePermittedButtons.add(typePermittedButton);
-                       documentTypesPanel.add(typePermittedButton);
-               }
-               actualize();
-       }
-
-       /** 
-        * Enables type permitted buttons 
-        * @param enabled enabled to set
-        */
-       private void setEnabledForTypePermittedButtons(boolean enabled) {
-               for (int i = 0; i < typePermittedButtons.size(); ++i) {
-                       typePermittedButtons.get(i).setEnabled(enabled);
-               }
-       }
-
-       /**
-        * Selects and deselects type permitted buttons
-        * @param selected selected to set
-        */
-       private void setSelectedForButtons(boolean selected) {
-               for (int i = 0; i < typePermittedButtons.size(); ++i) {
-                       typePermittedButtons.get(i).setSelected(selected);
-               }
-       }
-
-       /**
-        * Permits all type of documents for actually selected positions if all 
types permitted button is selected
-        */
-       private void permitAllTypesOfDocuments() {
-               if (allTypesPermitedButton.isSelected()) {
-                       setEnabledForTypePermittedButtons(false);
-                       setSelectedForButtons(false);
-                       permitDocumentTypes();
-               } else {
-                       setEnabledForTypePermittedButtons(true);
-                       permitDocumentTypes();
-               }
-
-       }
-
-       /**
-        * Permits document type for actually selected positions if 
corresponding type button is selected
-        */
-       public void permitDocumentTypes() {
-
-               TabbedPane tabbedPane = propertiesManager.getLayoutTabbedPane();
-               DesignArea designArea = (DesignArea) 
tabbedPane.getSelectedComponent();
-               Layout layout = designArea.getMyLayout();
-
-               Positions positions = layout
-                               .getSelectedPositions();
-               if (positions.getPositions().size() == 0) {
-               } else if (positions.getPositions().size() == 1) {
-                       Position oldPosition = positions.getPositions().get(0);
-                       Position newPosition = oldPosition.clone();
-                       PermittedDocumentTypes permitted = new 
PermittedDocumentTypes(
-                                       typesOfDocuments);
-                       if (!allTypesPermitedButton.isSelected()) {
-                               permitted.setPermittedAll(false);
-                               permitted.setPermittedDocumentTypes(new 
Vector<String>());
-                               for (int i = 0; i < typesOfDocuments.size(); 
++i) {
-                                       if 
(typePermittedButtons.get(i).isSelected()) {
-                                               
permitted.addPermittedDocumentType(typesOfDocuments
-                                                               .get(i));
-                                       }
-                               }
-                       }
-
-                       newPosition.setPermittedDocumentTypes(permitted);
-                       
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
-                                       oldPosition, designArea, 
Layout.AddType.DESIGN, false);
-                       
-                       if(positions.isAtLeastOneDocumentTypePermitted()) {
-                               
designArea.getMyLayout().addActionToActionsMemory(
-                                       designArea);
-
-                       }
-                       designArea.repaint();
-
-               } else {
-                       for (int i = 0; i < positions.getPositions().size(); 
++i) {
-                               Position oldPosition = 
positions.getPositions().get(i);
-                               Position newPosition = oldPosition.clone();
-                               PermittedDocumentTypes permitted = new 
PermittedDocumentTypes(
-                                               typesOfDocuments);
-                               if (!allTypesPermitedButton.isSelected()) {
-                                       permitted.setPermittedAll(false);
-                                       permitted.setPermittedDocumentTypes(new 
Vector<String>());
-                                       for (int j = 0; j < 
typesOfDocuments.size(); ++j) {
-                                               if 
(typePermittedButtons.get(j).isSelected()) {
-                                                       
permitted.addPermittedDocumentType(typesOfDocuments
-                                                                       
.get(j));
-                                               }
-                                       }
-                               }
-
-                               
newPosition.setPermittedDocumentTypes(permitted);
-                               
designArea.getMyLayout().addPosition(layout.getLayoutPositions(), newPosition,
-                                               oldPosition, designArea, 
Layout.AddType.DESIGN, false);
-
-                               designArea.repaint();
-                       }
-                       if (positions.isAtLeastOneDocumentTypePermitted()) {
-                               
designArea.getActionMemory().addActionToActionsMemory(designArea);
-                       }
-               }
-       }
-
-       /**
-        * Selects and deselects all types permitted button
-        * @param selected selected to set
-        */
-       public void setAllTypesPermittedButtonSelected(boolean selected) {
-               allTypesPermitedButton.setSelected(selected);
-               setEnabledForTypePermittedButtons(!selected);
-       }
-
-       /**
-        * Enables  all types permitted button
-        * @param enabled enabled to set
-        */
-       public void setAllTypesPermittedButtonEnabled(boolean enabled) {
-               allTypesPermitedButton.setEnabled(enabled);
-       }
-
-       /**
-        * Actualize permitted document types according to this position
-        * @param position position
-        */
-       private void actualize(Position position) {
-               if (position.getPermittedDocumentTypes().isPermittedAll()) {
-                       allTypesPermitedButton.setEnabled(true);
-                       allTypesPermitedButton.setSelected(true);
-                       setEnabledForTypePermittedButtons(false);
-                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
-                               typePermittedButtons.get(i).setSelected(false);
-                       }
-               } else {
-                       PermittedDocumentTypes permitted = position
-                                       .getPermittedDocumentTypes();
-                       allTypesPermitedButton.setSelected(false);
-                       setEnabledForTypePermittedButtons(true);
-                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
-                               typePermittedButtons
-                                               .get(i)
-                                               .setSelected(
-                                                               permitted
-                                                                               
.isPermittedDocumentTypeAllowed(typesOfDocuments
-                                                                               
                .get(i)));
-                               System.out.println(typesOfDocuments.get(i) + " 
" + permitted
-                                               
.isPermittedDocumentTypeAllowed(typesOfDocuments
-                                                               .get(i)));
-
-                       }
-
-               }
-
-               
-       }
-       
-       /**
-        * Actualizes document types panel in properties manager according to 
selected positions
-        * If more positions is selected it allows selecting of permitted types 
if they have same permitted types
-        */
-       public void actualize() {
-
-               TabbedPane tabbedPane = propertiesManager.getLayoutTabbedPane();
-
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               if (designArea == null) {
-                       allTypesPermitedButton.setEnabled(false);
-                       allTypesPermitedButton.setSelected(false);
-                       setEnabledForTypePermittedButtons(false);
-                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
-                               typePermittedButtons.get(i).setSelected(false);
-                       }
-                       return;
-               }
-
-               Positions selectedPositions = 
designArea.getMyLayout().getSelectedPositions();
-               if (selectedPositions.isTooSmall(tabbedPane)) {
-                       return;
-               }
-
-               Layout layout = designArea.getMyLayout();
-               Positions positions = layout
-                               .getSelectedPositions();
-
-               if (positions.size() == 0) {
-                       allTypesPermitedButton.setEnabled(false);
-                       allTypesPermitedButton.setSelected(false);
-                       setEnabledForTypePermittedButtons(false);
-                       for (int i = 0; i < typesOfDocuments.size(); ++i) {
-                               typePermittedButtons.get(i).setSelected(false);
-                       }
-               } else if (positions.getPositions().size() == 1) {
-                       Position position = positions.getPositions().get(0);
-                       actualize(position);
-                       
-               } else {
-
-                       if 
(!positions.hasSamePermittedDocumentTypes(typesOfDocuments)) {
-
-                               
-                               allTypesPermitedButton.setSelected(false);
-                               allTypesPermitedButton.setEnabled(false);
-                               for (int i = 0; i < typesOfDocuments.size(); 
++i) {
-                                       
typePermittedButtons.get(i).setSelected(false);
-                               }
-                               setEnabledForTypePermittedButtons(false);
-                       } else {
-                               
-                               Position position = 
positions.getPositions().get(0);
-                               actualize(position);
-                       }
-               }
-
-       }
-
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Grid.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Grid.java      2010-02-18 
22:32:39 UTC (rev 1789)
+++ trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Grid.java 
2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 /**
  * Grid.java
@@ -7,6 +7,8 @@
 import java.awt.Color;
 import java.awt.Graphics;
 
+import com.elvys.applet.components.DesignArea;
+
 /**
  * Grid allows designing, moving and resizing document positions
  *        according to chosen grid
@@ -170,6 +172,109 @@
        }
        
        /**
+        * Snaps to grid coordinates on monitor
+        * @param designArea actual design area
+        */
+       public void snapToGridMonitorCoordinates1(DesignArea designArea) {
+
+
+               int xMod = x % MONITOR_GRID_X_SIZE;
+               int yMod = y % MONITOR_GRID_Y_SIZE;
+
+               int gridX = x + xMod;
+               int gridY = y + yMod;
+
+               x = gridX;
+               y = gridY;
+
+       }
+       
+       /**
+        * Snaps x coordinate on monitor to left
+        * @param x x monitor coordinate
+        * @return x monitor coordinate snapped to left
+        */
+       public int snapLeftMonitor(int x) {
+               int xMod = x % MONITOR_GRID_X_SIZE;
+               return x - xMod;        
+       }
+       
+       /**
+        * Snaps x coordinate on monitor to right
+        * @param x x monitor coordinate
+        * @return x monitor coordinate snapped to right
+        */
+       public int snapRightMonitor(int x) {
+               int xMod = x % MONITOR_GRID_X_SIZE;
+               return x + MONITOR_GRID_X_SIZE - xMod;
+       }
+       
+       /**
+        * Snaps y coordinate on monitor to up
+        * @param y y monitor coordinate
+        * @return y monitor coordinate snapped to up
+        */
+       public int snapUpMonitor(int y) {
+               int yMod = y % MONITOR_GRID_Y_SIZE;
+               return y - yMod;
+       }
+       
+       /**
+        * Snaps y coordinate on monitor to down
+        * @param y y monitor coordinate
+        * @return y monitor coordinate snapped to down
+        */
+       public int snapDownMonitor(int y) {
+               int yMod = y % MONITOR_GRID_Y_SIZE;
+               return y + MONITOR_GRID_Y_SIZE - yMod;
+       }
+       
+       /**
+        * Snaps x coordinate on elvys to left
+        * @param x x elvys coordinate
+        * @param designArea the actual design area
+        * @return x elvys coordinate snapped to left
+        */
+       public int snapLeftElvys(int x, DesignArea designArea) {
+               int xMod = x % getKioskGridXsize(designArea.getMyLayout());;
+               return x - xMod;        
+       }
+       
+       /**
+        * Snaps x coordinate on elvys to right
+        * @param x x elvys coordinate
+        * @param designArea the actual design area
+        * @return x elvys coordinate snapped to right
+        */
+       public int snapRightElvys(int x, DesignArea designArea) {
+               int xMod = x % getKioskGridXsize(designArea.getMyLayout());
+               return x + xMod;
+       }
+       
+       /**
+        * Snaps y coordinate on elvys to up
+        * @param y y elvys coordinate
+        * @param designArea the actual design area
+        * @return y elvys coordinate snapped to up
+        */
+       public int snapUpElvys(int y, DesignArea designArea) {
+               int yMod = y % getKioskGridYsize(designArea.getMyLayout());
+               return y - yMod;
+       }
+       
+       /**
+        * Snaps y coordinate on elvys to down
+        * @param y y elvys coordinate
+        * @param designArea the actual design area
+        * @return y elvys coordinate snapped to down
+        */
+       public int snapDownElvys(int y, DesignArea designArea) {
+               int yMod = y % getKioskGridYsize(designArea.getMyLayout());
+               return y + yMod;
+       }
+       
+       
+       /**
         * Gets size of grid on x axis on kiosk from size of grid on x axis on 
monitor 
         * @param layout layout of the actual design area
         * @return size of grid on x axis on kiosk

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Icons.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Icons.java     2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Icons.java    
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,272 +0,0 @@
-package applet;
-
-import java.awt.Image;
-import java.awt.Toolkit;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class Icons {
-
-       private final static String PATH = "/webServer2/applets/";              
                                /** path to directory with icons */
-       private final static String BACKWARD_ENABLED = "icn_back_ac.png";       
                        /** name of the file with icon for backward enabled 
button */
-       private final static String BACKWARD_DISABLED = "icn_back_ps.png";      
                        /** name of the file with icon for backward disabled 
button */ 
-       private final static String FORWARD_ENABLED = "icn_next_ac.png";        
                        /** name of the file with icon for forward enabled 
button */
-       private final static String FORWARD_DISABLED = "icn_next_ps.png";       
                        /** name of the file with icon for forward disable 
button */    
-       private final static String SAME_TOP_ENABLED = "icn_topalign_ac.png";   
                /** name of the file with icon for same top enabled button */   
-       private final static String SAME_TOP_DISABLED = "icn_topalign_ps.png";  
                /** name of the file with icon for same top disabled button */
-       private final static String SAME_BOTTOM_ENABLED = 
"icn_bottomalign_ac.png";             /** name of the file with icon for same 
bottom enabled button */
-       private final static String SAME_BOTTOM_DISABLED = 
"icn_bottomalign_ps.png";    /** name of the file with icon for same bottom 
disabled button */
-       private final static String SAME_LEFT_ENABLED = "icn_leftalign_ac.png"; 
                /** name of the file with icon for same left enabled button */  
                
-       private final static String SAME_LEFT_DISABLED = 
"icn_leftalign_ps.png";                /** name of the file with icon for same 
left disabled button */
-       private final static String SAME_RIGHT_ENABLED = 
"icn_rightalign_ac.png";               /** name of the file with icon for same 
right enabled button */
-       private final static String SAME_RIGHT_DISABLED = 
"icn_rightalign_ps.png";              /** name of the file with icon for same 
right disabled button */
-       private final static String CENTER_HOR_ENABLED = 
"icn_middlealign_ac.png";              /** name of the file with icon for 
center vertical enabled button */
-       private final static String CENTER_HOR_DISABLED = 
"icn_middlealign_ps.png";             /** name of the file with icon for center 
vertical disabled button */
-       private final static String CENTER_VER_ENABLED = 
"icn_centeralign_ac.png";              /** name of the file with icon for 
center horizontal enabled button */
-       private final static String CENTER_VER_DISABLED = 
"icn_centeralign_ps.png";             /** name of the file with icon for center 
horizontal disabled button */
-       private final static String DESIGN_ENABLED = "icn_drawnew_ac.png";      
                        /** name of the file with icon for design enabled 
button */ 
-       private final static String DESIGN_DISABLED = "icn_drawnew_ps.png";     
                        /** name of the file with icon for design disabled 
button */
-       private final static String SELECT_ENABLED = "icn_selearrow_ac.png";    
                /** name of the file with icon for select enabled button */
-       private final static String SELECT_DISABLED = "icn_selearrow_ps.png";   
                /** name of the file with icon for select disabled button */
-
-       private Image backwardEnabledImage;                     /** icon for 
backward enabled button */
-       private Image backwardDisabledImage;            /** icon for backward 
disabled button */
-       private Image forwardEnabledImage;                      /** icon for 
forward enabled button */
-       private Image forwardDisabledImage;                     /** icon for 
forward disabled button */
-       private Image sameTopEnabledImage;                      /** icon for 
same top enabled button */
-       private Image sameTopDisabledImage;                     /** icon for 
same top disabled button */
-       private Image sameBottomEnabledImage;           /** icon for same 
bottom enabled button */
-       private Image sameBottomDisabledImage;          /** icon for same 
bottom disabled button */
-       private Image sameLeftEnabledImage;                     /** icon for 
same left enabled button */
-       private Image sameLeftDisabledImage;            /** icon for same left 
disabled button */
-       private Image sameRightEnabledImage;            /** icon for same right 
enabled button */
-       private Image sameRightDisabledImage;           /** icon for same right 
disabled button */
-       private Image centerHorEnabledImage;            /** icon for center 
horizontal enabled button */
-       private Image centerHorDisabledImage;           /** icon for center 
horizontal disabled button */
-       private Image centerVerEnabledImage;            /** icon for center 
vertical enabled button */
-       private Image centerVerDisabledImage;           /** icon for center 
vertical disabled button */
-       private Image designEnabledImage;                       /** icon for 
design enabled button */
-       private Image designDisabledImage;                      /** icon for 
design disabled button */
-       private Image selectEnabledImage;                       /** icon for 
select enabled button */
-       private Image selectDisabledImage;                      /** icon for 
select disabled button */
-
-       /**
-        * Constructor of the class Icon
-        * @param urlString urlString to set
-        */
-       public Icons(String urlString) {
-               this.forwardEnabledImage = getIcon(urlString + PATH + 
FORWARD_ENABLED);
-               this.forwardDisabledImage = getIcon(urlString + PATH + 
FORWARD_DISABLED);
-               this.backwardEnabledImage = getIcon(urlString + PATH + 
BACKWARD_ENABLED);
-               this.backwardDisabledImage = getIcon(urlString + PATH + 
BACKWARD_DISABLED);
-               this.sameTopEnabledImage = getIcon(urlString + PATH + 
SAME_TOP_ENABLED);
-               this.sameTopDisabledImage = getIcon(urlString + PATH + 
SAME_TOP_DISABLED);
-               this.sameBottomEnabledImage = getIcon(urlString + PATH + 
SAME_BOTTOM_ENABLED);
-               this.sameBottomDisabledImage = getIcon(urlString + PATH + 
SAME_BOTTOM_DISABLED);
-               this.sameRightEnabledImage = getIcon(urlString + PATH + 
SAME_RIGHT_ENABLED);
-               this.sameRightDisabledImage = getIcon(urlString + PATH + 
SAME_RIGHT_DISABLED);
-               this.sameLeftEnabledImage = getIcon(urlString + PATH + 
SAME_LEFT_ENABLED);
-               this.sameLeftDisabledImage = getIcon(urlString + PATH + 
SAME_LEFT_DISABLED);
-               this.centerHorEnabledImage = getIcon(urlString + PATH + 
CENTER_HOR_ENABLED);
-               this.centerHorDisabledImage = getIcon(urlString + PATH + 
CENTER_HOR_DISABLED);
-               this.centerVerEnabledImage = getIcon(urlString + PATH + 
CENTER_VER_ENABLED);
-               this.centerVerDisabledImage = getIcon(urlString + PATH + 
CENTER_VER_DISABLED);
-               this.designEnabledImage = getIcon(urlString + PATH + 
DESIGN_ENABLED);
-               this.designDisabledImage = getIcon(urlString + PATH + 
DESIGN_DISABLED);
-               this.selectEnabledImage = getIcon(urlString + PATH + 
SELECT_ENABLED);
-               this.selectDisabledImage = getIcon(urlString + PATH + 
SELECT_DISABLED);
-       }
-       
-       /**
-        * Gets icon from given url
-        * @param iconUrlString url where icon is saved
-        * @return icon
-        */
-       private Image getIcon(String iconUrlString) {
-               try {
-                       
-                       URL url = new URL(iconUrlString);
-
-                       java.awt.Toolkit.getDefaultToolkit();
-                       Image image = 
Toolkit.getDefaultToolkit().createImage(url);
-                       return image;
-               } catch (MalformedURLException e) {
-               }
-               return null;
-       }
-
-
-       // getter & setters
-       
-
-       /**
-        * Getter for the field backwardEnabledImage
-        * @return the backwardEnabledImage
-        */
-       public Image getBackwardEnabledImage() {
-               return backwardEnabledImage;
-       }
-
-       /**
-        * Getter for the field sameTopEnabledImage
-        * @return the sameTopEnabledImage
-        */
-       public Image getSameTopEnabledImage() {
-               return sameTopEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameTopDisabledImage
-        * @return the sameTopDisabledImage
-        */
-       public Image getSameTopDisabledImage() {
-               return sameTopDisabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameBottomEnabledImage
-        * @return the sameBottomEnabledImage
-        */
-       public Image getSameBottomEnabledImage() {
-               return sameBottomEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameBottomDisabledImage
-        * @return the sameBottomDisabledImage
-        */
-       public Image getSameBottomDisabledImage() {
-               return sameBottomDisabledImage;
-       }
-
-       /**
-        * Getter for the field sameLeftEnabledImage
-        * @return the sameLeftEnabledImage
-        */
-       public Image getSameLeftEnabledImage() {
-               return sameLeftEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameLeftDisabledImage
-        * @return the sameLeftDisabledImage
-        */
-       public Image getSameLeftDisabledImage() {
-               return sameLeftDisabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameRightEnabledImage
-        * @return the sameRightEnabledImage
-        */
-       public Image getSameRightEnabledImage() {
-               return sameRightEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field sameRightDisabledImage
-        * @return the sameRightDisabledImage
-        */
-       public Image getSameRightDisabledImage() {
-               return sameRightDisabledImage;
-       }
-
-       /**
-        * Getter for the field centerHorEnabledImage
-        * @return the centerHorEnabledImage
-        */
-       public Image getCenterHorEnabledImage() {
-               return centerHorEnabledImage;
-       }
-
-       /**
-        * Getter for the field centerHorDisabledImage
-        * @return the centerHorDisabledImage
-        */
-       public Image getCenterHorDisabledImage() {
-               return centerHorDisabledImage;
-       }
-
-       /**
-        * Getter for the field centerVerEnabledImage
-        * @return the centerVerEnabledImage
-        */
-       public Image getCenterVerEnabledImage() {
-               return centerVerEnabledImage;
-       }
-
-       /**
-        * Getter for the field centerVerDisabledImage
-        * @return the centerVerDisabledImage
-        */
-       public Image getCenterVerDisabledImage() {
-               return centerVerDisabledImage;
-       }
-
-
-       /**
-        * Getter for the field backwardDisabledImage
-        * @return the backwardDisabledImage
-        */
-       public Image getBackwardDisabledImage() {
-               return backwardDisabledImage;
-       }
-
-
-       /**
-        * Getter for the field forwardEnabledImage
-        * @return the forwardEnabledImage
-        */
-       public Image getForwardEnabledImage() {
-               return forwardEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field forwardDisabledImage
-        * @return the forwardDisabledImage
-        */
-       public Image getForwardDisabledImage() {
-               return forwardDisabledImage;
-       }
-
-       /**
-        * Getter for the field designEnabledImage
-        * @return the designEnabledImage
-        */
-       public Image getDesignEnabledImage() {
-               return designEnabledImage;
-       }
-
-       /**
-        * Getter for the field designDisabledImage
-        * @return the designDisabledImage
-        */
-       public Image getDesignDisabledImage() {
-               return designDisabledImage;
-       }
-
-       /**
-        * Getter for the field selectEnabledImage
-        * @return the selectEnabledImage
-        */
-       public Image getSelectEnabledImage() {
-               return selectEnabledImage;
-       }
-
-
-       /**
-        * Getter for the field selectDisabledImage
-        * @return the selectDisabledImage
-        */
-       public Image getSelectDisabledImage() {
-               return selectDisabledImage;
-       }
-
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Layout.java    2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Layout.java   
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,10 +1,14 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Properties;
 import java.util.Vector;
 
 import javax.swing.JFrame;
 
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.dialog.WarningDialog;
+
 /**
  * Represents actual document layout
  * 
@@ -74,7 +78,7 @@
        /**
         * Clones this layout
         */
-       protected Layout clone() {
+       public Layout clone() {
                Layout clone = new Layout();
                clone.name = name;
                clone.isNew = isNew;
@@ -134,7 +138,7 @@
                        addActionToActionsMemory(designArea);
                }
 
-               designArea.repaint();
+               designArea.paintAllPositions();
        }
 
        /**
@@ -197,7 +201,8 @@
                        boolean isWidthSnapped = false;
                        boolean isHeightSnapped = false;
 
-                       if (isFirst) {
+                       if(designArea.isSnapToGridEnabled()) {
+                               if (isFirst) {
 
                                Position.IsSnappedToGrid snap = 
newPosition.isSnappedToGrid();
                                if (deltaTopX < 0) {
@@ -259,7 +264,7 @@
 
                                }
                                newPosition.setSnappedToGrid(snap);
-
+                               }
                        }
 
                        kiosk = new AbsoluteCoordinates(newKioskTopX, 
newKioskTopY,
@@ -557,7 +562,7 @@
 
                        tabbedPane.getPropertiesManager().actualizeAll();
                        
addActionToActionsMemory(tabbedPane.getActualDesignArea());
-                       tabbedPane.getActualDesignArea().repaint();
+                       tabbedPane.getActualDesignArea().paintAllPositions();
                        
tabbedPane.getToolBar().setEnabledForCenterAndAlignButtons(true);
                }
        }
@@ -628,7 +633,7 @@
 
                }
 
-               designArea.repaint();
+               designArea.paintAllPositions();
        }
 
        /**
@@ -682,7 +687,7 @@
 
                deselectAllPositions(designArea);
 
-               designArea.repaint();
+               designArea.paintAllPositions();
        }
 
        /**
@@ -914,7 +919,7 @@
 
                        setLayoutPositions(positions);
                        designArea.setMyLayout(layout);
-                       designArea.repaint();
+                       designArea.paintAllPositions();
                        
designArea.getActionMemory().addActionToActionsMemory(designArea);
                }
 
@@ -1005,7 +1010,7 @@
                        layout.setLayoutPositions(positions);
                        designArea.setMyLayout(layout);
 
-                       designArea.repaint();
+                       designArea.paintAllPositions();
                        
designArea.getActionMemory().addActionToActionsMemory(designArea);
                }
 

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/LayoutDesigner.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java    
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/LayoutDesigner.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,362 +0,0 @@
-package applet;
-
-import java.applet.Applet;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Properties;
-import java.util.Vector;
-import javax.swing.*;
-import javax.swing.border.LineBorder;
-import javax.swing.JDialog;
-import javax.swing.JApplet;
-import java.lang.reflect.*;
-
-/**
- * LayoutDesigner is main applet class. Initializes individual components and
- * displays applet.
- */
-public class LayoutDesigner extends JApplet {
-
-       private static final long serialVersionUID = 5212730162755861066L;
-
-       // fields
-       private JMenuBar menuBar;
-       /** menu bar */
-       private JTabbedPane propertiesManager;
-       /** properties manager tabbed pane */
-       private JPanel statusBar;
-       /** status bar */
-       private TabbedPane tabbedPane;
-       /** main tabbed pane */
-       private JToolBar toolBar;
-       /** tool bar */
-       private Layout layoutToOpen = null;
-       /**
-        * layout read from server - if editing layout is empty - if creating 
new
-        * layout
-        */
-       private Applet instance;
-       /** this applet */
-       private Vector<String> allPossibleDocumentTypes;
-       /** all possible document types */
-       private ComponentSizes componentSizes;
-       /** size of components */
-       private Properties properties;
-       /** properties */
-       private JRootPane rootPane;
-       /** rootPane of this applet */
-
-       // constants
-       private final static String PROPERTIES_FILE_NAME = 
"LayoutDesigner.properties";
-       /** name of file with properties */
-       private final static String PROPERTIES_FILE_PATH = 
"/webServer2/applets/";
-       /** file path to properties file */
-       private final static int APPLET_WIDTH = 950;
-       /** width of applet */
-       private final static int APPLET_HEIGHT = 650;
-       /** height of applet */
-       private final static int BAR_HEIGHT = 35;
-       /** height of all bars */
-       private final static int PROPERTIES_MANAGER_WIDTH = 200;
-       /** width of properties manager */
-       private final static String NOT_LOADED_PROPERTIES = "Server 
communication error: It isn't possible to read properties file";
-
-       public static LayoutDesigner getInstance() {
-               return new LayoutDesigner();
-       }
-       
-       /**
-        * Initializes applet
-        */
-       public void init() {
-
-               try {
-
-                       java.awt.EventQueue.invokeAndWait(new Runnable() {
-                               public void run() {
-
-                                       initComponents();
-
-                                       // Init context of layout- 
communication with server,
-                                       // parameters,
-                                       // etc.
-                                       try {
-                                               
ServerSideContext.newInstance(instance, tabbedPane);
-                                       } catch (Exception e) {
-                                               new WarningDialog(new JFrame(), 
properties
-                                                               
.getProperty("warning.appletNotLoaded"),
-                                                               
properties.getProperty("warning.warning"));
-                                               throw new RuntimeException(e);
-                                       }
-
-                                       URL url = null;
-                                       try {
-                                               String urlString = 
ServerSideContext.getInstance()
-                                                               .getHost()
-                                                               + 
PROPERTIES_FILE_PATH + PROPERTIES_FILE_NAME;
-                                               url = new URL(urlString);
-                                       } catch (MalformedURLException e1) {
-                                       }
-
-                                       // read properties file
-                                       properties = new Properties();
-                                       try {
-                                               
properties.load(url.openStream());
-                                       } catch (IOException e) {
-                                               new WarningDialog(new JFrame(), 
NOT_LOADED_PROPERTIES,
-                                                               
properties.getProperty("warning.warning"));
-                                               e.printStackTrace();
-                                       }
-
-                                       tabbedPane.setProperties(properties);
-                                       
tabbedPane.setComponentSizes(componentSizes);
-
-                                       try {
-                                               
ServerSideContext.getInstance().getProperties(instance,
-                                                               tabbedPane);
-                                       } catch (Exception e) {
-                                               e.printStackTrace();
-                                       }
-                                       SupportedResolutions 
supportedAspectRatios;
-
-                                       // gets permitted types of document 
from server
-                                       allPossibleDocumentTypes = 
ServerSideContext.getInstance()
-                                                       
.getPermittedDocumentTypes();
-
-                                       // gets supported aspect ratios for 
this company
-                                       supportedAspectRatios = 
ServerSideContext.getInstance()
-                                                       
.getSupportedResolutions();
-
-                                       // gets layout
-                                       layoutToOpen = 
ServerSideContext.getInstance().getLayout();
-
-                                       // initializes components
-                                       
tabbedPane.setAllTypesOfDocuments(allPossibleDocumentTypes);
-
-                                       boolean isLocked = 
ServerSideContext.getInstance()
-                                                       .isLocked();
-                                       MenuBar myMenuBar = new 
MenuBar(menuBar, properties,
-                                                       rootPane);
-
-                                       ToolBar myToolBar = new 
ToolBar(toolBar, ServerSideContext
-                                                       
.getInstance().getHost(), propertiesManager,
-                                                       tabbedPane);
-                                       StatusBar myStatusBar = new 
StatusBar(statusBar);
-
-                                       // sets components fields
-                                       
tabbedPane.setSupportedResolutions(supportedAspectRatios);
-                                       myMenuBar.setTabbedPane(tabbedPane);
-                                       myToolBar.setTabbedPane(tabbedPane);
-
-                                       myStatusBar.setTabbedPane(tabbedPane);
-                                       tabbedPane.setToolBar(myToolBar);
-                                       tabbedPane.setStatusBar(myStatusBar);
-                                       tabbedPane.setMenuBar(myMenuBar);
-
-                                       if (isLocked) {
-                                               new WarningDialog(new JFrame(), 
properties
-                                                               
.getProperty("warning.isLocked")
-                                                               + 
ServerSideContext.getInstance()
-                                                                               
.getLockedUser(), properties
-                                                               
.getProperty("warning.warning"));
-                                               
closeLayoutDesignerBrowserWindow();
-                                       } else {
-                                               // opens new layout, if it is 
loaded from server
-                                               if (layoutToOpen != null) {
-                                                       DesignArea 
editedLayoutDesignArea;
-                                                       editedLayoutDesignArea 
= new DesignArea(tabbedPane,
-                                                                       
layoutToOpen);
-
-                                                       
tabbedPane.addNewTab(layoutToOpen.getName(),
-                                                                       
editedLayoutDesignArea);
-
-                                                       
editedLayoutDesignArea.setTabbedPane(tabbedPane);
-
-                                                       tabbedPane.repaint();
-                                               } else {
-                                                       openNewLayout();
-                                               }
-
-                                       }
-
-                                       PropertiesManager myPropertiesManager = 
new PropertiesManager(
-                                                       propertiesManager, 
allPossibleDocumentTypes,
-                                                       tabbedPane, properties, 
componentSizes);
-                                       
tabbedPane.setPropertiesManager(myPropertiesManager);
-                                       tabbedPane.repaint();
-
-                               }
-                       });
-               } catch (Exception ex) {
-                       tabbedPane.repaint();
-                       ex.printStackTrace();
-               }
-
-       }
-
-       /**
-        * Initializes applet's main components
-        */
-       private void initComponents() {
-
-               instance = this;
-
-               // initializes sizes of components
-               componentSizes = new ComponentSizes();
-               componentSizes.setApplet(new Dimension(APPLET_WIDTH, 
APPLET_HEIGHT));
-               int propertiesManagerHeight = APPLET_HEIGHT - 3 * BAR_HEIGHT;
-               componentSizes.setPropertiesManager(new Dimension(
-                               PROPERTIES_MANAGER_WIDTH, 
propertiesManagerHeight));
-               componentSizes.setStatusBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
-               componentSizes.setToolBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
-               componentSizes.setMenuBar(new Dimension(APPLET_WIDTH, 
BAR_HEIGHT));
-               int tabbedPaneWidth = APPLET_WIDTH - PROPERTIES_MANAGER_WIDTH;
-               componentSizes.setTabbedPane(new Dimension(tabbedPaneWidth,
-                               propertiesManagerHeight));
-
-               // sets border around whole applet
-               this.getRootPane().setBorder(new LineBorder(Color.black));
-
-               // sets sizes of whole applet
-               this.setPreferredSize(componentSizes.getApplet());
-
-               // creates content pane
-               JPanel contentPane = new JPanel();
-               contentPane.setLayout(new BorderLayout());
-               contentPane.setPreferredSize(componentSizes.getApplet());
-
-               // creates components
-               menuBar = new JMenuBar();
-               menuBar.setPreferredSize(componentSizes.getMenuBar());
-               setJMenuBar(menuBar);
-
-               toolBar = new JToolBar();
-               toolBar.setPreferredSize(componentSizes.getToolBar());
-               contentPane.add(toolBar, BorderLayout.PAGE_START);
-
-               tabbedPane = new TabbedPane(properties, 
allPossibleDocumentTypes);
-               tabbedPane.setPreferredSize(componentSizes.getTabbedPane());
-               contentPane.add(tabbedPane, BorderLayout.CENTER);
-
-               propertiesManager = new JTabbedPane();
-               propertiesManager.setPreferredSize(componentSizes
-                               .getPropertiesManager());
-               contentPane.add(propertiesManager, BorderLayout.LINE_END);
-
-               statusBar = new JPanel();
-               statusBar.setMaximumSize(componentSizes.getStatusBar());
-               statusBar.setMinimumSize(componentSizes.getStatusBar());
-               statusBar.setPreferredSize(componentSizes.getStatusBar());
-               contentPane.add(statusBar, BorderLayout.PAGE_END);
-
-               // sets appplet's content pane
-
-               this.setContentPane(contentPane);
-
-               rootPane = this.getRootPane();
-
-       }
-
-       /**
-        * Closes browser window with LayoutDesigner
-        */
-       public void closeLayoutDesignerBrowserWindow() {
-
-               String jscmd = "window.close()"; 
-               try {
-                       Method getw = null, eval = null;
-                       Object jswin = null;
-                       Class c = 
Class.forName("netscape.javascript.JSObject"); 
-                       Method ms[] = c.getMethods();
-                       for (int i = 0; i < ms.length; i++) {
-                               if (ms[i].getName().compareTo("getWindow") == 
0) {
-                                       getw = ms[i];
-                               }
-                               else if (ms[i].getName().compareTo("eval") == 
0) {
-                                       eval = ms[i];
-                               }
-                       }
-                       
-                       Object a[] = new Object[1]; 
-                       a[0] = this; 
-                       jswin = getw.invoke(c, a);
-                       a[0] = jscmd; 
-                       eval.invoke(jswin, a); 
-                       
-               } catch (Exception e) {
-
-               }
-
-       }
-
-       /**
-        * Opens new empty layout
-        */
-       public void openNewLayout() {
-
-               ResolutionChoiceDialog resolutionChoiceDialog = new 
ResolutionChoiceDialog(
-                               new JDialog(), properties,
-                               tabbedPane.getSupportedResolutions(), rootPane);
-               ScreenResolution screenSizes = resolutionChoiceDialog
-                               .showResolutionChoiceDialog();
-
-               if (screenSizes == null) {
-                       closeLayoutDesignerBrowserWindow();
-                       return;
-               }
-               String newDesignAreaName = 
tabbedPane.getProperties().getProperty(
-                               "newDesignArea.label");
-
-               Layout newDesignAreaLayout = new Layout();
-               newDesignAreaLayout.setLayoutAspectRatio((double) screenSizes
-                               .getElvysWidth()
-                               / (double) screenSizes.getElvysHeight());
-
-               newDesignAreaLayout.setId(0);
-               newDesignAreaLayout.setIsNew(true);
-               newDesignAreaLayout.setName(newDesignAreaName);
-               newDesignAreaLayout.setRevision(0);
-               newDesignAreaLayout.setScreenResolution(screenSizes);
-               newDesignAreaLayout.setLayoutPositions(new Positions(
-                               newDesignAreaLayout));
-
-               DesignArea designArea = new DesignArea(tabbedPane, 
newDesignAreaLayout);
-               tabbedPane.addNewTab(newDesignAreaName, designArea);
-
-       }
-
-       /**
-        * When applet is started, it locks edited layout, nobodyelse is able to
-        * edit this layout
-        */
-       public void start() {
-               Layout layout = ServerSideContext.getInstance().getLayout();
-               if (layout != null) {
-                       try {
-                               ServerSideContext.getInstance().lockLayout();
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-               }
-       }
-
-       /**
-        * When applet end, edited layout is unlocked
-        */
-       public void destroy() {
-
-               Layout layout = ServerSideContext.getInstance().getLayout();
-               if (layout != null) {
-                       try {
-                               ServerSideContext.getInstance().unlockLayout();
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-               }
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Marshaller.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Marshaller.java        
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Marshaller.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,138 +0,0 @@
-package applet;
-
-import java.io.*;
-import javax.xml.stream.*;
-
-/**
- * Marshaller.java
- * @author EvaV
- */
-
-/**
- * Marshaller converts layout to xml string
- */
-public class Marshaller {
-       // fields
-       private Layout layout;                  /** layout */
-       
-       // methods
-       /**
-        * Gets string representation of xml file generated by the given layout
-        * 
-        * @param layout the given layout
-        * @return string representation of xml file generated by the given 
layout
-        * @throws Exception
-        */
-       public String marshallLayoutToString(Layout layout) throws Exception {
-               this.layout = layout;
-
-               // initializes writer
-               StringWriter strOut = new StringWriter();
-               XMLOutputFactory factory = XMLOutputFactory.newInstance();
-               XMLStreamWriter writer = factory.createXMLStreamWriter(strOut);
-               writer.setPrefix("xsi", "cz/elvys/jaxbgen/layout");
-
-               
-               
-               // writes head of xml file
-               writeHead(writer);
-
-               // writes individual position in layout
-               for (int i = 0; i < layout.getLayoutPositions().size(); ++i) {
-                       writeDocument(layout.getLayoutPositions().get(i), 
writer);
-               }
-
-               // writes end of xml file
-               writeEnd(writer);
-
-               // closes writer
-               writer.flush();
-               writer.close();
-               strOut.close();
-
-               System.out.println(strOut.toString());
-               return strOut.toString();
-       }
-
-       /**
-        * Writes the head of xml file
-        * @param writer xml writer
-        * @throws XMLStreamException
-        */
-       private void writeHead(XMLStreamWriter writer) throws 
XMLStreamException {
-
-
-               
-               writer.writeStartDocument("UTF-8", "1.0");
-
-               
writer.writeStartElement("a","layout","http://www.w3.org/2001/XMLSchema";); // 
<layout>
-               writer.writeAttribute("xmlns:a", "cz/elvys/jaxbgen/layout");
-               //writer.writeAttribute("elvysVersion", "0.3");
-               
-               if (!layout.isNew()) {
-                       writer.writeAttribute("id", 
Integer.toString(layout.getId()));
-               }
-
-               writer.writeAttribute("revision", Integer.toString(layout
-                               .getRevision()));
-
-               String layoutName = "layout";
-               if (!layout.getName().isEmpty()) {
-                       layoutName = layout.getName();
-               }
-               writer.writeAttribute("name", layoutName);
-
-               writer.writeStartElement("aspect-ratio"); // <aspect-ratio>
-               double width = layout.getScreenResolution().getElvysWidth();
-               double height = layout.getScreenResolution().getElvysHeight();
-               double ratio = (double) width / (double) height;
-               writer.writeAttribute("aspect-ratio", Double.toString(ratio));
-               writer.writeEndElement(); // </aspect-ratio>
-
-       }
-
-       /**
-        * Writes individual position in layout to xml writer
-        * 
-        * @param position position
-        * @param writer xml writer
-        * @throws XMLStreamException
-        */
-       private void writeDocument(Position position, XMLStreamWriter writer)
-                       throws XMLStreamException {
-               writer.writeStartElement("doc"); // <pdf_doc>
-               writer.writeAttribute("id", Integer.toString(position.getId()));
-               writer.writeStartElement("rect"); // <rect>
-
-               RelativeCoordinates relative = 
position.getRelativeFromElvys(layout.getScreenResolution());
-
-               writer.writeAttribute("x", Double.toString(relative.getTopX()));
-               writer.writeAttribute("y", Double.toString(relative.getTopY()));
-               writer.writeAttribute("w", 
Double.toString(relative.getWidth()));
-               writer.writeAttribute("h", 
Double.toString(relative.getHeight()));
-               writer.writeEndElement(); // </rect>
-
-               for (int i = 0; i < position.getPermittedDocumentTypes()
-                               .getPermittedDocumentTypes().size(); ++i) {
-                       writer.writeStartElement("doc_type");
-                       
writer.writeCharacters(position.getPermittedDocumentTypes()
-                                       .getPermittedDocumentTypes().get(i));
-                       writer.writeEndElement();
-               }
-
-               writer.writeEndElement(); // </pdf_doc>
-
-       }
-
-       /**
-        * Writes end of xml file
-        * 
-        * @param writer xml writer
-        * @throws XMLStreamException
-        */
-       private void writeEnd(XMLStreamWriter writer) throws Exception {
-               writer.writeEndElement(); // </layout>
-               writer.writeEndDocument();
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MenuBar.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/MenuBar.java   2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MenuBar.java  
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,368 +0,0 @@
-package applet;
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.Properties;
-import javax.swing.*;
-
-/**
- * MenuBar.java
- * @author Eva Viktorinova
- * 
- */
-
-/**
- * @class MenuBar
- * Menu bar represent menu in LayoutDesigner application
- */
-@SuppressWarnings("serial")
-public class MenuBar extends JMenuBar {
-       // fields
-       private JMenuBar menuBar;                                               
        /** parent menu bar where menu is displayed */
-       private TabbedPane tabbedPane;                                          
/** tabbed pane */
-       private Properties properties;                                          
/** properties */
-       private JRootPane rootPane;                                             
        /** root pane of the LayoutDesigner */
-       private JMenuItem menuItemNew;                                          
/** menu item New layout */ 
-       private JMenuItem menuItemSaveOnServer;                         /** 
menu item Save */
-       private JMenuItem menuItemClose;                                        
/** menu item Close */
-       private JMenuItem menuItemCloseAll;                                     
/** menu item Close all */
-       private JMenuItem menuItemChangeResolution;                     /** 
menu item Change resolution */
-       private JCheckBoxMenuItem menuItemSnapToGrid;           /** menu item 
Snap to grid */
-       private JCheckBoxMenuItem menuItemShowGrid;                     /** 
menu item Show grid */
-
-       // constructors
-       /**
-        * Constructor of the class MenuBar
-        * @param menuBar parent menu bar where menu bar is displayed
-        * @param properties properties to set
-        * @param rootPane root pane to set
-        * @param isOpenedNewLayout flag whatever LayoutDesigner is opened to 
create new layout or to edit already designed layout
-        */
-       public MenuBar(final JMenuBar menuBar, Properties properties,
-                       JRootPane rootPane) {
-
-               this.menuBar = menuBar;
-               this.properties = properties;
-               this.rootPane = rootPane;
-
-               // sets bottom border
-               menuBar.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0,
-                               Color.LIGHT_GRAY));
-
-               JMenu menuFile = new JMenu(properties.getProperty("menu.file"));
-               JMenu menuEdit = new JMenu(properties.getProperty("menu.edit"));
-               JMenu menuView = new JMenu(properties.getProperty("menu.view"));
-
-               menuBar.add(menuFile);
-               menuBar.add(menuEdit);
-               menuBar.add(menuView);
-
-               // creates menu items
-               menuItemNew = new JMenuItem(properties.getProperty("menu.new"));
-               menuItemSaveOnServer = new JMenuItem(properties
-                               .getProperty("menu.saveOnServer"));
-               menuItemClose = new 
JMenuItem(properties.getProperty("menu.close"));
-               menuItemCloseAll = new JMenuItem(properties
-                               .getProperty("menu.closeAll"));
-               menuItemChangeResolution = new JMenuItem(properties
-                               .getProperty("menu.changeResolution"));
-               menuItemShowGrid = new JCheckBoxMenuItem(properties
-                               .getProperty("menu.showGrid"));
-               menuItemSnapToGrid = new JCheckBoxMenuItem(properties
-                               .getProperty("menu.snapToGrid"));
-
-               // sets selection state for menu item check box
-               menuItemShowGrid.setSelected(false);
-               menuItemSnapToGrid.setSelected(false);
-
-               // sets menu items accelerators
-               menuItemNew.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,
-                               ActionEvent.CTRL_MASK));
-               menuItemSaveOnServer.setAccelerator(KeyStroke.getKeyStroke(
-                               KeyEvent.VK_S, ActionEvent.CTRL_MASK));
-
-               // adds menu items action listeners
-               menuItemNew.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               //openNewLayout();
-                       }
-               });
-
-               menuItemSaveOnServer.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               saveActualLayoutOnServer();
-                       }
-               });
-
-               menuItemClose.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               closeActualTab();
-                       }
-               });
-
-               menuItemCloseAll.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               closeAllTabs();
-                       }
-               });
-
-               menuItemChangeResolution.addActionListener(new ActionListener() 
{
-                       public void actionPerformed(ActionEvent evt) {
-                               changeActualDesignAreaResolution();
-                       }
-
-               });
-
-               menuItemShowGrid.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               enableShowGrid(evt);
-                       }
-               });
-
-               menuItemSnapToGrid.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               enableSnapToGrid(evt);
-                       }
-               });
-
-               menuFile.add(menuItemSaveOnServer);
-               menuFile.add(menuItemClose);
-
-               menuEdit.add(menuItemChangeResolution);
-
-               menuView.add(menuItemShowGrid);
-               menuView.add(menuItemSnapToGrid);
-
-               // sets default cursor for menus
-               setDefaultCursor(menuFile);
-               setDefaultCursor(menuEdit);
-               setDefaultCursor(menuView);
-
-       }
-
-       /**
-        * Sets default cursor for menuBar
-        * 
-        * @param menu the menuBar menu
-        */
-       private void setDefaultCursor(final JMenu menu) {
-
-               menu.addMouseMotionListener(new MouseAdapter() {
-                       public void mouseMoved(MouseEvent e) {
-
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                               if (designArea != null) {
-                                       designArea.actualizeCursor(-1, -1);
-                               }
-                               menuBar.requestFocusInWindow();
-                               menu.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
-                       }
-               });
-               menu.addMouseListener(new MouseAdapter() {
-                       public void mouseClicked(MouseEvent e) {
-
-                               menuBar.requestFocusInWindow();
-                               menu.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
-                       }
-               });
-       }
-
-       /**
-        * Enables or disables snap to grid for the actual layout
-        * 
-        * @param evt action event
-        */
-       private void enableSnapToGrid(ActionEvent evt) {
-
-               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
-               if (actualDesignArea == null) {
-                       return;
-               }
-
-               JCheckBoxMenuItem menuItemSnapToGrid = (JCheckBoxMenuItem) evt
-                               .getSource();
-               if (menuItemSnapToGrid.isSelected()) {
-                       actualDesignArea.setSnapToGridEnabled(true);
-                       actualDesignArea.getMyLayout().setSnappedToGrid(true);
-                       
actualDesignArea.getActionMemory().addActionToActionsMemory(tabbedPane.getActualDesignArea());
-               } else {
-                       actualDesignArea.setSnapToGridEnabled(false);
-                       actualDesignArea.getMyLayout().setSnappedToGrid(false);
-               }
-               
-       }
-
-       /**
-        * Enables or disables showing of grid for the actual layout
-        * 
-        * @param evt action event
-        */
-       private void enableShowGrid(ActionEvent evt) {
-
-               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
-               JCheckBoxMenuItem menuItemShowGrid = (JCheckBoxMenuItem) evt
-                               .getSource();
-               if (menuItemShowGrid.isSelected()) {
-                       actualDesignArea.setShowGridEnabled(true);
-                       actualDesignArea.repaint();
-               } else {
-                       actualDesignArea.setShowGridEnabled(false);
-                       actualDesignArea.repaint();
-               }
-               
actualDesignArea.getActionMemory().addActionToActionsMemory(tabbedPane.getActualDesignArea());
-       }
-
-       /**
-        * Changes resolution of the actual design area
-        */
-       private void changeActualDesignAreaResolution() {
-
-               // shows new resolution choice dialog and sets new resolution
-               ResolutionChoiceDialog resolutionChoiceDialog = new 
ResolutionChoiceDialog(
-                               new JDialog(), properties, 
tabbedPane.getSupportedResolutions(), rootPane);
-               ScreenResolution newResolution = resolutionChoiceDialog
-                               .showResolutionChoiceDialog();
-
-               if (newResolution == null) {
-                       return;
-               }
-
-               DesignArea actualDesignArea = tabbedPane.getActualDesignArea();
-               if (actualDesignArea == null) {
-                       return;
-               }
-               Layout layout = actualDesignArea.getMyLayout();
-
-               ScreenResolution oldResolution = layout.getScreenResolution();
-               layout.setScreenResolution(newResolution);
-               layout.setLayoutAspectRatio((double) 
newResolution.getElvysWidth()
-                               / (double) newResolution.getElvysHeight());
-
-               Positions positions = layout.getLayoutPositions();
-               positions.changeElvysResolution(actualDesignArea, oldResolution,
-                               newResolution);
-
-               actualDesignArea.setSize(actualDesignArea.getWidth(), 
actualDesignArea
-                               .getHeight());
-               actualDesignArea.repaint();
-
-       }
-
-
-
-       /**
-        * Saves actual layout on server
-        */
-       private void saveActualLayoutOnServer() {
-
-               if (tabbedPane == null || tabbedPane.getActualDesignArea() == 
null) {
-                       return;
-               }
-
-               String layoutName = properties
-               .getProperty("dialog.defaultName");
-               Layout layout = tabbedPane.getActualDesignArea().getMyLayout();
-               
-               if(!layout.isNew()) {
-                       layoutName = layout.getName();
-               }
-
-               SaveAsDialog saveAsDialog = new SaveAsDialog(new JDialog(), 
properties,
-                               rootPane, layoutName);
-               String newLayoutName = saveAsDialog.showSaveAsDialog();
-               if (newLayoutName == null) {
-                       return;
-               }
-
-               SaveLayoutOnServer saveLayoutOnServer = new SaveLayoutOnServer(
-                               tabbedPane);
-               String oldLayoutName = tabbedPane.getActualDesignArea()
-                               .getMyLayout().getName();
-               saveLayoutOnServer.saveLayout(oldLayoutName, newLayoutName);
-       }
-
-       /**
-        * Closes actual tab
-        */
-       private void closeActualTab() {
-
-               CloseLayout closeDesignArea = new CloseLayout(tabbedPane, 
properties);
-               
closeDesignArea.closeActualLayout(tabbedPane.getActualDesignArea(),
-                               rootPane);
-               Layout layout = ServerSideContext.getInstance().getLayout();
-               if (layout != null) {
-                       try {
-                               ServerSideContext.getInstance().unlockLayout();
-                       } catch (Exception e) {
-                               e.printStackTrace();
-                       }
-               }
-
-       }
-
-       /**
-        * Closes all tabs
-        */
-       private void closeAllTabs() {
-
-               CloseLayout closeDesignArea = new CloseLayout(tabbedPane, 
properties);
-               closeDesignArea.closeAllLayouts(rootPane);
-
-       }
-
-       /**
-        * Actualizes menu items
-        */
-       public void actualize() {
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               if (designArea == null) {
-
-                       menuItemSaveOnServer.setEnabled(false);
-                       menuItemClose.setEnabled(false);
-                       menuItemCloseAll.setEnabled(false);
-                       menuItemChangeResolution.setEnabled(false);
-                       
-                       menuItemShowGrid.setSelected(false);
-                       menuItemShowGrid.setEnabled(false);
-
-                       menuItemSnapToGrid.setSelected(false);
-                       menuItemSnapToGrid.setEnabled(false);
-
-               }
-
-               else {
-
-                       menuItemSaveOnServer.setEnabled(true);
-                       menuItemClose.setEnabled(true);
-                       menuItemCloseAll.setEnabled(true);
-                       menuItemChangeResolution.setEnabled(true);
-                       
-                       
menuItemShowGrid.setSelected(designArea.getMyLayout().isShowGridEnabled());
-                       menuItemShowGrid.setEnabled(true);
-
-                       
menuItemSnapToGrid.setSelected(designArea.getMyLayout().isSnappedToGrid());
-                       menuItemSnapToGrid.setEnabled(true);
-                       
-                       designArea.repaint();
-               }
-
-       }
-
-       // getters & setters
-       /**
-        * Setter of the field tabbedPane
-        * @param tabbedPane
-        *            the tabbedPane to set
-        */
-       public void setTabbedPane(TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/MovingObject.java      
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,904 +0,0 @@
-package applet;
-
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Font;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Insets;
-import java.awt.RenderingHints;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Properties;
-import java.util.Vector;
-
-import javax.swing.BorderFactory;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-import javax.swing.border.Border;
-
-/**
- * Corresponds with position in design area. It allows position to move and 
resize
- * @author EvaV
- */
-
-@SuppressWarnings("serial")
-public class MovingObject extends JPanel implements Cloneable {
-
-       
-       /**
-        *  Type of action with position
-        */
-       enum ActionType {
-               MOVE, RESIZE_TOP_LEFT_CORNER, RESIZE_TOP_RIGHT_CORNER, 
RESIZE_BOTTOM_LEFT_CORNER, RESIZE_BOTTOM_RIGHT_CORNER, RESIZE_TOP_BORDER, 
RESIZE_BOTTOM_BORDER, RESIZE_LEFT_BORDER, RESIZE_RIGHT_BORDER
-       };
-
-       // fields
-       private int id;                                 /** id of actually 
moved or resized position */
-       private int monitorTopX;                /** topX coordinate of actually 
moved or resized position */    
-       private int monitorTopY;                /** topY coordinate of actually 
moved or resized position */
-       private int monitorWidth;               /** width of actually moved or 
resized position */ 
-       private int monitorHeight;              /** height of actually moved or 
resized position */
-
-       private int monitorDx;
-       private int monitorDy;
-       private int monitorX1;
-       private int monitorX2;
-       private int monitorY1;
-       private int monitorY2;
-       
-       private ActionType action;              /** actual action */
-       private DesignArea designArea;  /** design area where this position is 
designed */
-       private PopupMenu popupMenu;    /** popup menu */
-
-       private Position position;              /** corresponding position */
-       private MovingObject instance;  /** instance of this MovingObject */
-       private Positions oldPositions; /** position before action */
-
-       // constants
-       private final static Color BORDER_LABEL_COLOR = Color.black;            
        /** color of label and border of position */
-       private final static int OBJECT_MOVE_AREA_SIZE = 3;             /** 
size of area according to which type of action is decided */                
-       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
-        */
-       private class Label extends JLabel {
-
-               /**
-                * Constructor of the class Label
-                * @param labelName text to be displayed in this label
-                */
-               private Label(String labelName) {
-                       super(labelName);
-               }
-
-               /**
-                * Paints this label. It antialiases text. 
-                */
-               public void paint(Graphics g) {
-                       if (g instanceof Graphics2D) {
-                               Graphics2D g2d = (Graphics2D) g;
-
-                               // for antialiasing text
-                               
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
-                                               
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
-                               g = g2d;
-                       }
-                       super.paint(g);
-               }
-       }
-
-       // methods
-
-       /**
-        * Makes deep copy
-        */
-       public MovingObject clone() {
-               MovingObject clone = new MovingObject();
-               clone.id = this.id;
-               clone.monitorTopX = this.monitorTopX;
-               clone.monitorTopY = this.monitorTopY;
-               clone.monitorWidth = this.monitorWidth;
-               clone.monitorHeight = this.monitorHeight;
-               return clone;
-       }
-
-       /**
-        * Sets border for position corresponding to this object. Selected 
positions
-        * have thicker border than notselected positions.
-        */
-       public void setBorder() {
-               Border border;
-
-               if (position.isSelected()) {
-                       border = 
BorderFactory.createLineBorder(BORDER_LABEL_COLOR,
-                                       SELECTED_POSITION_BORDER_SIZE);
-               } else {
-                       border = BorderFactory
-                                       .createLineBorder(BORDER_LABEL_COLOR, 
POSITION_BORDER_SIZE);
-               }
-               setBorder(border);
-       }
-
-       /**
-        * Gets only three beginning letter from document type to be displayed 
in position label
-        * @param wholeString whole document type
-        * @return
-        */
-       private String getThreeBeginningLetters(String wholeString) {
-               String threeLetters = "";
-               int three = 3;
-               threeLetters = wholeString.substring(0, three);
-               return threeLetters;
-       }
-
-       /**
-        * Writes ID of this position and permitted document types for this 
position
-        */
-       public void writeDocumentIDandPermittedTypesOfDocuments() {
-
-               Vector<String> permittedTypesOfDocuments = position
-                               
.getPermittedDocumentTypes().getPermittedDocumentTypes();
-
-               setLayout(null);
-
-               String id = Integer.toString(position.getId());
-
-               Insets insets = getInsets();
-
-               String labelName = "";
-
-               if (position.getPermittedDocumentTypes().isPermittedAll()) {
-                       labelName = this.getThreeBeginningLetters(designArea
-                                       
.getProperties().getProperty("documentTypes.all"));
-               }
-
-               else {
-
-                       for (int i = 0; i < permittedTypesOfDocuments.size(); 
++i) {
-                               if (i != 0) {
-                                       labelName += " "
-                                                       + this
-                                                                       
.getThreeBeginningLetters(permittedTypesOfDocuments
-                                                                               
        .get(i));
-                               } else {
-                                       labelName += this
-                                                       
.getThreeBeginningLetters(permittedTypesOfDocuments
-                                                                       
.get(i));
-                               }
-                       }
-
-               }
-               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,
-                               monitorWidth - 2, monitorHeight - 2);
-
-       }
-
-       /**
-        * Decides the type of the action according to the location of mouse in
-        * object
-        * 
-        * @param x
-        *            x coordinate of mouse location
-        * @param y
-        *            y coordinate of mouse location
-        * @return type of the action
-        */
-       public ActionType decideTypeOfAction(int x, int y) {
-               int left = OBJECT_MOVE_AREA_SIZE;
-               int right = monitorWidth - OBJECT_MOVE_AREA_SIZE;
-               int top = OBJECT_MOVE_AREA_SIZE;
-               int bottom = monitorHeight - OBJECT_MOVE_AREA_SIZE;
-
-               if (x < left && y < top)
-                       return ActionType.RESIZE_TOP_LEFT_CORNER;
-               else if (x > right && y < top)
-                       return ActionType.RESIZE_TOP_RIGHT_CORNER;
-               else if (x < left && y > bottom)
-                       return ActionType.RESIZE_BOTTOM_LEFT_CORNER;
-               else if (x > right && y > bottom)
-                       return ActionType.RESIZE_BOTTOM_RIGHT_CORNER;
-               else if (y < top)
-                       return ActionType.RESIZE_TOP_BORDER;
-               else if (y > bottom)
-                       return ActionType.RESIZE_BOTTOM_BORDER;
-               else if (x < left)
-                       return ActionType.RESIZE_LEFT_BORDER;
-               else if (x > right)
-                       return ActionType.RESIZE_RIGHT_BORDER;
-               else
-                       return ActionType.MOVE;
-       }
-
-       /**
-        * Resizes actually selected position
-        * @return whatever position was correctly resized
-        */
-       private boolean resize() {
-
-               if (designArea.isSnapToGridEnabled()) {
-                       Grid grid = new Grid(monitorX2, monitorY2);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorX2 = grid.getX();
-                       monitorY2 = grid.getY();
-                       grid = new Grid(monitorX1, monitorY1);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorX1 = grid.getX();
-                       monitorY1 = grid.getY();
-                       grid = new Grid(monitorDx, monitorDy);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorDx = grid.getX();
-                       monitorDy = grid.getY();
-               }
-
-               int x2MinusDx = monitorX2 - monitorDx;
-               int y2MinusDy = monitorY2 - monitorDy;
-               int x2MinusX1 = monitorX2 - monitorX1;
-               int y2MinusY1 = monitorY2 - monitorY1;
-
-               if (action == ActionType.RESIZE_TOP_LEFT_CORNER) {
-                       monitorTopX = monitorTopX + x2MinusDx;
-                       monitorWidth = monitorWidth - x2MinusDx;
-                       monitorTopY = monitorTopY + y2MinusDy;
-                       monitorHeight = monitorHeight - y2MinusDy;
-               } else if (action == ActionType.RESIZE_TOP_RIGHT_CORNER) {
-                       monitorWidth = monitorWidth + x2MinusX1;
-                       monitorTopY = monitorTopY + y2MinusDy;
-                       monitorHeight = monitorHeight - y2MinusDy;
-               } else if (action == ActionType.RESIZE_BOTTOM_LEFT_CORNER) {
-                       monitorTopX = monitorTopX + x2MinusDx;
-                       monitorWidth = monitorWidth - x2MinusDx;
-                       monitorHeight = monitorHeight + y2MinusY1;
-
-               } else if (action == ActionType.RESIZE_BOTTOM_RIGHT_CORNER) {
-                       monitorWidth = monitorWidth + x2MinusX1;
-                       monitorHeight = monitorHeight + y2MinusY1;
-               }
-
-               else if (action == ActionType.RESIZE_TOP_BORDER) {
-                       monitorTopY = monitorTopY + y2MinusDy;
-                       monitorHeight = monitorHeight - y2MinusDy;
-
-               } else if (action == ActionType.RESIZE_BOTTOM_BORDER) {
-
-                       monitorHeight = monitorHeight + y2MinusY1;
-
-               } else if (action == ActionType.RESIZE_LEFT_BORDER) {
-
-                       monitorTopX = monitorTopX + x2MinusDx;
-                       monitorWidth = monitorWidth - x2MinusDx;
-
-               } else if (action == ActionType.RESIZE_RIGHT_BORDER) {
-
-                       monitorWidth = monitorWidth + x2MinusX1;
-
-               }
-
-               if (designArea.isSnapToGridEnabled()) {
-                       Grid grid = new Grid(monitorTopX, monitorTopY);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorTopX = grid.getX();
-                       monitorTopY = grid.getY();
-
-                       grid = new Grid(monitorWidth, monitorHeight);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorWidth = grid.getX();
-                       monitorHeight = grid.getY();
-
-               }
-
-               Position position = new Position(designArea.getTabbedPane());
-
-               if (monitorWidth < position.getMinMonitorSize(designArea)
-                               || monitorHeight < 
position.getMinMonitorSize(designArea)) {
-
-                       monitorWidth = Math.max(monitorWidth, position
-                                       .getMinMonitorSize(designArea));
-                       monitorHeight = Math.max(monitorHeight, position
-                                       .getMinMonitorSize(designArea));
-                       return false;
-               }
-
-
-               return true;
-       }
-
-       /**
-        * Moves actually selected position
-        */
-       private void move() {
-               monitorTopX = monitorTopX + monitorX2 - monitorDx;
-               monitorTopY = monitorTopY + monitorY2 - monitorDy;
-
-               if (designArea.isSnapToGridEnabled()) {
-                       Grid grid = new Grid(monitorTopX, monitorTopY);
-                       grid.snapToGridMonitorCoordinates(designArea);
-                       monitorTopX = grid.getX();
-                       monitorTopY = grid.getY();
-
-               }
-
-       }
-
-       /**
-        * If more position is selected, it moves them
-        */
-       private void moveMore() {
-
-               if (action != ActionType.MOVE) {
-                       return;
-               }
-
-               Layout.AddType addType;
-               if (action == ActionType.MOVE) {
-                       addType = Layout.AddType.MOVE;
-               } else {
-                       addType = Layout.AddType.RESIZE;
-               }
-
-               int WIDTH = designArea.getMyLayout().getScreenResolution()
-                               .getMonitorWidth();
-               int HEIGHT = designArea.getMyLayout().getScreenResolution()
-                               .getMonitorHeight();
-
-               
-               
-               Positions positions = 
designArea.getMyLayout().getLayoutPositions();
-               Positions newPositions = positions.clone();
-
-               int monitorDeltaX = monitorX2 - monitorDx;
-               int monitorDeltaY = monitorY2 - monitorDy;
-               
-               System.out.println(monitorDeltaX + " : " + monitorDeltaY);
-
-               monitorDeltaX = positions.changeDeltaXtoNotBeOutOfMonitor(
-                               monitorDeltaX, designArea);
-               monitorDeltaY = positions.changeDeltaYtoNotBeOutOfMonitor(
-                               monitorDeltaY, designArea);
-               
-               
-               System.out.println(monitorDeltaX + " : " + monitorDeltaY);
-               
-               
-               for (int i = 0; i < positions.size(); ++i) {
-
-                       
-                       Position position = positions.get(i);
-                       AbsoluteCoordinates monitor = 
position.getMonitor().clone();
-                       Position newPosition = position.clone();
-
-                       int oldTopX = position.getMonitor().getTopX();
-                       int newTopX = oldTopX + monitorDeltaX;
-                       int oldTopY = position.getMonitor().getTopY();
-                       int newTopY = oldTopY + monitorDeltaY;
-                       int newWidth = position.getMonitor().getWidth();
-                       int newHeight = position.getMonitor().getHeight();
-
-                       if (position.isSelected()) {
-
-                               if (designArea.isSnapToGridEnabled()) {
-                                       Grid grid = new Grid(newTopX, newTopY);
-                                       
grid.snapToGridMonitorCoordinates(designArea);
-                                       newTopX = grid.getX();
-                                       newTopY = grid.getY();
-
-                                       grid = new Grid(newWidth, newHeight);
-                                       
grid.snapToGridMonitorCoordinates(designArea);
-                                       newWidth = grid.getX();
-                                       newHeight = grid.getY();
-                               }
-       
-                               
-                               monitor = new AbsoluteCoordinates(newTopX, 
newTopY, newWidth, newHeight);
-                               AbsoluteCoordinates monitor1 = newPosition
-                               
.changeCoordinatesToNotBeOutOfDesignArea(newTopX,
-                                               newTopY, newWidth, newHeight, 
WIDTH,
-                                               HEIGHT, addType, false, 
designArea);
-                               
-                               newPosition.setMonitor(monitor1);
-                               newPosition.setElvysFromMonitor(monitor1, 
designArea.isSnapToGridEnabled(), action);
-
-                               MovingObject object = 
designArea.getObjects().get(i);
-
-                               object.monitorTopX = monitor1.getTopX();
-                               object.monitorTopY = monitor1.getTopY();
-                               object.monitorWidth = monitor1.getWidth();
-                               object.monitorHeight = monitor1.getHeight();
-
-                               object.setLocation(monitor1.getTopX(), 
monitor1.getTopY());
-                               object.setSize(monitor1.getWidth(), 
monitor1.getHeight());
-                               object.setPosition(newPosition);
-
-                               
-                       }
-
-                       newPositions.addPosition(newPosition);
-                       
-               }
-
-               designArea.getMyLayout().setLayoutPositions(newPositions);
-               designArea.getTabbedPane().getPropertiesManager()
-                               .actualizePropertiesTable();
-               designArea.repaint();
-
-       }
-
-       /**
-        * Moves or resizes actually selected positions
-        */
-       private void reposition() {
-
-               boolean wasRepositioned = true;
-               if (action == ActionType.MOVE) {
-                       move();
-               }
-
-               else {
-                       wasRepositioned = resize();
-               }
-
-               if (wasRepositioned) {
-
-                       Position newDocument = new 
Position(position.getTabbedPane());
-                       newDocument.setId(id);
-                       Position.IsSnappedToGrid snapped = 
newDocument.isSnappedToGrid();
-                       snapped.setHeight(designArea.isSnapToGridEnabled());
-                       snapped.setWidth(designArea.isSnapToGridEnabled());
-                       snapped.setTopX(designArea.isSnapToGridEnabled());
-                       snapped.setTopY(designArea.isSnapToGridEnabled());
-                       newDocument.setSnappedToGrid(snapped);
-                       AbsoluteCoordinates designAreaAbsoluteCoordinates = new 
AbsoluteCoordinates(
-                                       monitorTopX, monitorTopY, monitorWidth, 
monitorHeight);
-                       newDocument.setMonitor(designAreaAbsoluteCoordinates);
-
-                       Layout.AddType addType;
-                       if (action == ActionType.MOVE) {
-                               addType = Layout.AddType.MOVE;
-                       } else {
-                               addType = Layout.AddType.RESIZE;
-                       }
-
-                       int WIDTH = 
designArea.getMyLayout().getScreenResolution()
-                                       .getMonitorWidth();
-                       int HEIGHT = 
designArea.getMyLayout().getScreenResolution()
-                                       .getMonitorHeight();
-
-                       AbsoluteCoordinates monitor = newDocument
-                                       
.changeCoordinatesToNotBeOutOfDesignArea(monitorTopX,
-                                                       monitorTopY, 
monitorWidth, monitorHeight, WIDTH,
-                                                       HEIGHT, addType, false, 
designArea);
-       
-
-                       monitorTopX = monitor.getTopX();
-                       monitorTopY = monitor.getTopY();
-                       monitorWidth = monitor.getWidth();
-                       monitorHeight = monitor.getHeight();
-
-               
-                       setLocation(monitorTopX, monitorTopY);
-                       setSize(monitorWidth, monitorHeight);
-
-                       monitorX1 = monitorX2;
-                       monitorY1 = monitorY2;
-               }
-
-               else {
-
-                       if (position.isSelected()) {
-                               designArea.setIsNotMoving(true);
-                               designArea.setNotDesigning(true);
-
-                               Layout layout = designArea.getMyLayout();
-                               Position newDocument = new 
Position(designArea.getTabbedPane());
-                               newDocument.setPosition(position);
-
-                               AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
-                                               monitorTopX, monitorTopY, 
monitorWidth, monitorHeight);
-                               
newDocument.setMonitor(designAreaAbsoluteCoordinates);
-               
-
-                               Layout.AddType addType;
-                               if (action == ActionType.MOVE) {
-                                       addType = Layout.AddType.MOVE;
-                               } else {
-                                       addType = Layout.AddType.RESIZE;
-                               }
-
-                               layout.addPosition(layout.getLayoutPositions(), 
newDocument, position, designArea, addType,
-                                               false);
-
-                               //position = newDocument;
-
-                       }
-               }
-
-       }
-
-       /**
-        * Sets cursors according to the location of mouse
-        * 
-        * @param x x coordinate of mouse location
-        * @param y y coordinate of mouse location
-        */
-       private void setCursor(int x, int y) {
-               switch (decideTypeOfAction(x, y)) {
-               case MOVE:
-                       designArea.setCursor(new Cursor(Cursor.MOVE_CURSOR));
-                       break;
-               case RESIZE_TOP_LEFT_CORNER:
-                       designArea.setCursor(new 
Cursor(Cursor.NW_RESIZE_CURSOR));
-                       break;
-               case RESIZE_TOP_RIGHT_CORNER:
-                       designArea.setCursor(new 
Cursor(Cursor.NE_RESIZE_CURSOR));
-                       break;
-               case RESIZE_BOTTOM_LEFT_CORNER:
-                       designArea.setCursor(new 
Cursor(Cursor.SW_RESIZE_CURSOR));
-                       break;
-               case RESIZE_BOTTOM_RIGHT_CORNER:
-                       designArea.setCursor(new 
Cursor(Cursor.SE_RESIZE_CURSOR));
-                       break;
-               case RESIZE_TOP_BORDER:
-                       designArea.setCursor(new 
Cursor(Cursor.N_RESIZE_CURSOR));
-                       break;
-               case RESIZE_BOTTOM_BORDER:
-                       designArea.setCursor(new 
Cursor(Cursor.S_RESIZE_CURSOR));
-                       break;
-               case RESIZE_LEFT_BORDER:
-                       designArea.setCursor(new 
Cursor(Cursor.W_RESIZE_CURSOR));
-                       break;
-               case RESIZE_RIGHT_BORDER:
-                       designArea.setCursor(new 
Cursor(Cursor.E_RESIZE_CURSOR));
-                       break;
-               }
-       }
-
-       // constructors
-
-       /**
-        * Empty constructor of class MovingObject
-        */
-       public MovingObject() {
-       }
-
-       /**
-        * Constructor of the class Moving object
-        * @param _designArea design area where corresponding position is 
designed
-        * @param _id id of corresponding position 
-        * @param elvys elvys coordinates of corresponding position
-        * @param monitor monitor coordinates of corresponding position 
-        * @param _screenResolution screen resolution 
-        * @param _allTypes all permitted types of documents
-        * @param properties properties
-        */
-       public MovingObject(DesignArea _designArea, int _id,
-                       AbsoluteCoordinates elvys, AbsoluteCoordinates monitor,
-                       ScreenResolution _screenResolution, Vector<String> 
_allTypes, Properties properties) {
-               super();
-
-               this.instance = this;
-               this.designArea = _designArea;
-
-               this.monitorTopX = monitor.getTopX();
-               this.monitorTopY = monitor.getTopY();
-               this.monitorWidth = monitor.getWidth();
-               this.monitorHeight = monitor.getHeight();
-
-               this.id = _id;
-
-               // adds popup menu with copy, paste and delete options
-               popupMenu = designArea.getPopupMenu();
-               MouseListener popupListener = popupMenu.new 
PopupListener(popupMenu);
-               addMouseListener(popupListener);
-
-
-
-               addMouseListener(new MouseAdapter() {
-                       @Override
-                       public void mouseEntered(MouseEvent e) {
-
-                               // for selected position sets cursor
-                               if (position.isSelected()) {
-                                       setCursor(e.getX(), e.getY());
-
-                               }
-                               int topX = position.getElvys().getTopX()
-                                               + 
designArea.getElvysX(e.getX());
-                               int topY = position.getElvys().getTopY()
-                                               + 
designArea.getElvysY(e.getY());
-
-                               designArea.getTabbedPane().getStatusBar()
-                                               
.actualizeStatusBarMouseCoordinates(
-                                                               
designArea.getMyLayout(), topX, topY);
-
-                               
designArea.getTabbedPane().getPropertiesManager()
-                                               .actualizePropertiesTable();
-
-                               designArea.requestFocus(true);
-
-                       }
-
-               });
-
-               addMouseMotionListener(new MouseAdapter() {
-                       @Override
-                       public void mouseMoved(MouseEvent e) {
-
-
-                               int topX = position.getElvys().getTopX()
-                                               + 
designArea.getElvysX(e.getX());
-                               int topY = position.getElvys().getTopY()
-                                               + 
designArea.getElvysY(e.getY());
-
-                               designArea.getTabbedPane().getStatusBar()
-                                               
.actualizeStatusBarMouseCoordinates(
-                                                               
designArea.getMyLayout(), topX, topY);
-
-                               
designArea.getTabbedPane().getPropertiesManager()
-                                               .actualizePropertiesTable();
-
-                               designArea.requestFocusInWindow();
-                       }
-
-               });
-
-               addMouseListener(new MouseAdapter() {
-                       @Override
-                       public void mouseExited(MouseEvent e) {
-
-                               if (designArea.isInDesignMode()) {
-                                       designArea.setCursor(new 
Cursor(Cursor.CROSSHAIR_CURSOR));
-                               } else {
-                                       designArea.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
-                               }
-                       }
-               });
-
-               addMouseListener(new MouseAdapter() {
-                       @Override
-                       public void mousePressed(MouseEvent e) {
-
-                               // for selected position sets cursor
-                               if (position.isSelected()) {
-                                       setCursor(e.getX(), e.getY());
-
-                               }
-
-                               designArea.requestFocus(true);
-                               designArea.setIsNotMoving(true);
-                               designArea.repaint();
-
-                               Layout layout = designArea.getMyLayout();
-
-                               Layout.AddType addType;
-                               if (action == ActionType.MOVE) {
-                                       addType = Layout.AddType.MOVE;
-                               } else {
-                                       addType = Layout.AddType.RESIZE;
-                               }
-
-                               layout.addPosition(layout.getLayoutPositions(), 
position, position, designArea, addType, false);
-
-                               position.selectPosition(e.isControlDown(), 
designArea);
-
-                               
designArea.getTabbedPane().getPropertiesManager()
-                                               .actualizeAll();
-                               designArea.requestFocusInWindow();
-
-                               designArea.removeAll();
-
-                               Vector<Position> positions = 
layout.getLayoutPositions()
-                                               .getPositions();
-
-                               designArea.setObjects(new MovingObjects());
-                               for (int i = 0; i < positions.size(); ++i) {
-                                       Position actualPosition = 
positions.get(i);
-
-                                       if (actualPosition.getId() == id) {
-                                               designArea.getObjects().add(
-                                                               
actualPosition.paint(designArea, instance));
-                                       } else {
-                                               designArea.getObjects().add(
-                                                               
actualPosition.paint(designArea));
-                                       }
-                               }
-
-                               designArea.setIsNotMoving(false);
-
-                               monitorX1 = e.getX();
-                               monitorY1 = e.getY();
-
-                               action = decideTypeOfAction(monitorX1, 
monitorY1);
-
-                               if (designArea.isSnapToGridEnabled()
-                                               && action != ActionType.MOVE) {
-                                       Grid grid = new Grid(monitorX1, 
monitorY1);
-                                       
grid.snapToGridMonitorCoordinates(designArea);
-                                       monitorX1 = grid.getX();
-                                       monitorY1 = grid.getY();
-                               }
-
-                               monitorDx = monitorX1;
-                               monitorDy = monitorY1;
-
-                               oldPositions = 
designArea.getMyLayout().getLayoutPositions()
-                                               .clone();
-
-                       }
-
-               });
-
-               addMouseListener(new MouseAdapter() {
-                       @Override
-                       public void mouseReleased(MouseEvent e) {
-
-                               designArea.setIsNotMoving(true);
-                               designArea.setNotDesigning(true);
-
-                               if (position.isSelected()) {
-                                       if 
(designArea.getMyLayout().getSelectedPositions().size() == 1) {
-                                               designArea.setIsNotMoving(true);
-                                               
designArea.setNotDesigning(true);
-
-                                               Layout layout = 
designArea.getMyLayout();
-                                               Position newPosition = new 
Position(designArea
-                                                               
.getTabbedPane());
-                                               
newPosition.setPosition(position);
-
-                                               AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
-                                                               monitorTopX, 
monitorTopY, monitorWidth,
-                                                               monitorHeight);
-                                               Position.IsSnappedToGrid 
snapped = newPosition.isSnappedToGrid();
-                                               
snapped.setHeight(designArea.isSnapToGridEnabled());
-                                               
snapped.setWidth(designArea.isSnapToGridEnabled());
-                                               
snapped.setTopX(designArea.isSnapToGridEnabled());
-                                               
snapped.setTopY(designArea.isSnapToGridEnabled());
-                                               
newPosition.setSnappedToGrid(snapped);
-                                               
newPosition.setMonitor(designAreaAbsoluteCoordinates);
-                                               newPosition.setElvysFromMonitor(
-                                                               
designAreaAbsoluteCoordinates, designArea
-                                                                               
.isSnapToGridEnabled(), action);
-
-                                               Layout.AddType addType;
-                                               if (action == ActionType.MOVE) {
-                                                       addType = 
Layout.AddType.MOVE;
-                                               } else {
-                                                       addType = 
Layout.AddType.RESIZE;
-                                               }
-
-                                               
layout.addPosition(layout.getLayoutPositions(), newPosition, position, 
designArea,
-                                                               addType, true);
-
-                                               
designArea.getMyLayout().addActionToActionsMemory(
-                                                               designArea);
-                                               
designArea.getTabbedPane().getPropertiesManager()
-                                                               .actualizeAll();
-                                               position = newPosition;
-
-                                       } else {
-                                               if 
(designArea.getMyLayout().getLayoutPositions()
-                                                               .isOverlap()) {
-                                                       
designArea.getMyLayout().setLayoutPositions(
-                                                                       
oldPositions);
-                                                       designArea.repaint();
-                                               } else {
-                                                       
designArea.getMyLayout().addActionToActionsMemory(
-                                                                       
designArea);
-                                               }
-                                       }
-                               }
-                       }
-
-               });
-
-               addMouseMotionListener(new MouseAdapter() {
-                       @Override
-                       public void mouseDragged(MouseEvent e) {
-
-                               designArea.requestFocusInWindow();
-
-                               int topX = position.getElvys().getTopX()
-                                               + 
designArea.getElvysX(e.getX());
-                               int topY = position.getElvys().getTopY()
-                                               + 
designArea.getElvysY(e.getY());
-                               
-                               
-                               designArea.getTabbedPane().getStatusBar()
-                                               
.actualizeStatusBarMouseCoordinates(
-                                                               
designArea.getMyLayout(), topX, topY);
-                               
-
-                               Layout layout = designArea.getMyLayout();
-
-                               if (position.isSelected()) {
-                                       designArea.setIsNotMoving(false);
-
-                                       monitorX2 = e.getX();
-                                       monitorY2 = e.getY();
-
-                                       if (position.isSelected()) {
-
-                                               if 
(layout.getSelectedPositions().size() == 1) {
-                                                       reposition();
-                                                       Position newPosition = 
new Position(designArea
-                                                                       
.getTabbedPane());
-                                                       
newPosition.setPosition(position);
-
-                                                       AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
-                                                                       
monitorTopX, monitorTopY, monitorWidth,
-                                                                       
monitorHeight);
-                                                       newPosition
-                                                                       
.setMonitor(designAreaAbsoluteCoordinates);
-
-                                                       
newPosition.setElvysFromMonitor(
-                                                                       
designAreaAbsoluteCoordinates, designArea
-                                                                               
        .isSnapToGridEnabled(), action);
-
-                                                       Layout.AddType addType;
-                                                       if (action == 
ActionType.MOVE) {
-                                                               addType = 
Layout.AddType.MOVE;
-                                                       } else {
-                                                               addType = 
Layout.AddType.RESIZE;
-                                                       }
-
-                                                       //position = 
newPosition;
-                                                       
layout.addPosition(layout.getLayoutPositions(), newPosition, position,
-                                                                       
designArea, addType, false);
-                                               } else {
-                                                       
designArea.setIsNotMoving(false);
-                                                       moveMore();
-                                               }
-                                       }
-                               }
-                               
designArea.getTabbedPane().getPropertiesManager()
-                               .actualizePropertiesTable();
-                       }
-
-               });
-
-       }
-
-       // getters & setters
-
-       /**
-        * Sets position corresponding to this object
-        * 
-        * @param position
-        *            the position to set
-        */
-       public void setPosition(Position position) {
-               this.position = position;
-       }
-
-       /**
-        * Gets position corresponding to this object
-        * 
-        * @return the position
-        */
-       public Position getPosition() {
-               return position;
-       }
-
-       /**
-        * Gets id of position corresponding to this object
-        * 
-        * @return the id
-        */
-       public int getId() {
-               return id;
-       }
-
-}

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
 (from rev 1790, trunk/layouteditor/LayoutDesigner/src/applet/MovingObject.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
                         (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObject.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -0,0 +1,998 @@
+package com.elvys.applet.structures;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Insets;
+import java.awt.RenderingHints;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Properties;
+import java.util.Vector;
+
+import javax.swing.BorderFactory;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import javax.swing.border.Border;
+
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.PopupMenu;
+
+/**
+ * Corresponds with position in design area. It allows position to move and
+ * resize
+ * 
+ * @author EvaV
+ */
+
+@SuppressWarnings("serial")
+public class MovingObject extends JPanel implements Cloneable {
+
+       /**
+        * Type of action with position
+        */
+       enum ActionType {
+               MOVE, RESIZE_TOP_LEFT_CORNER, RESIZE_TOP_RIGHT_CORNER, 
RESIZE_BOTTOM_LEFT_CORNER, RESIZE_BOTTOM_RIGHT_CORNER, RESIZE_TOP_BORDER, 
RESIZE_BOTTOM_BORDER, RESIZE_LEFT_BORDER, RESIZE_RIGHT_BORDER
+       };
+
+       // fields
+       private int id;
+       /** id of actually moved or resized position */
+       private int monitorTopX;
+       /** topX coordinate of actually moved or resized position */
+       private int monitorTopY;
+       /** topY coordinate of actually moved or resized position */
+       private int monitorWidth;
+       /** width of actually moved or resized position */
+       private int monitorHeight;
+       /** height of actually moved or resized position */
+
+       private int monitorDx;
+       private int monitorDy;
+       private int monitorX1;
+       private int monitorX2;
+       private int monitorY1;
+       private int monitorY2;
+
+       private boolean isTopX;
+       private boolean isTopY;
+       private boolean isWidth;
+       private boolean isHeight;
+
+       private ActionType action;
+       /** actual action */
+       private DesignArea designArea;
+       /** design area where this position is designed */
+       private PopupMenu popupMenu;
+       /** popup menu */
+
+       private Position position;
+       /** corresponding position */
+       private MovingObject instance;
+       /** instance of this MovingObject */
+       private Positions oldPositions;
+       /** position before action */
+
+       // constants
+       private final static Color BORDER_LABEL_COLOR = Color.black;
+       /** color of label and border of position */
+       private final static int OBJECT_MOVE_AREA_SIZE = 3;
+       /** size of area according to which type of action is decided */
+       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
+        */
+       private class Label extends JLabel {
+
+               /**
+                * Constructor of the class Label
+                * 
+                * @param labelName
+                *            text to be displayed in this label
+                */
+               private Label(String labelName) {
+                       super(labelName);
+               }
+
+               /**
+                * Paints this label. It antialiases text.
+                */
+               public void paint(Graphics g) {
+                       if (g instanceof Graphics2D) {
+                               Graphics2D g2d = (Graphics2D) g;
+
+                               // for antialiasing text
+                               
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
+                                               
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+                               g = g2d;
+                       }
+                       super.paint(g);
+               }
+       }
+
+       // methods
+
+       /**
+        * Makes deep copy
+        */
+       public MovingObject clone() {
+               MovingObject clone = new MovingObject();
+               clone.id = this.id;
+               clone.monitorTopX = this.monitorTopX;
+               clone.monitorTopY = this.monitorTopY;
+               clone.monitorWidth = this.monitorWidth;
+               clone.monitorHeight = this.monitorHeight;
+               return clone;
+       }
+
+       /**
+        * Sets border for position corresponding to this object. Selected 
positions
+        * have thicker border than notselected positions.
+        */
+       public void setBorder() {
+               Border border;
+
+               if (position.isSelected()) {
+                       border = 
BorderFactory.createLineBorder(BORDER_LABEL_COLOR,
+                                       SELECTED_POSITION_BORDER_SIZE);
+               } else {
+                       border = 
BorderFactory.createLineBorder(BORDER_LABEL_COLOR,
+                                       POSITION_BORDER_SIZE);
+               }
+               setBorder(border);
+       }
+
+       /**
+        * Gets only three beginning letter from document type to be displayed 
in
+        * position label
+        * 
+        * @param wholeString
+        *            whole document type
+        * @return
+        */
+       private String getThreeBeginningLetters(String wholeString) {
+               String threeLetters = "";
+               int three = 3;
+               threeLetters = wholeString.substring(0, three);
+               return threeLetters;
+       }
+
+       /**
+        * Writes ID of this position and permitted document types for this 
position
+        */
+       public void writeDocumentIDandPermittedTypesOfDocuments() {
+
+               Vector<String> permittedTypesOfDocuments = position
+                               
.getPermittedDocumentTypes().getPermittedDocumentTypes();
+
+               setLayout(null);
+
+               String id = Integer.toString(position.getId());
+
+               Insets insets = getInsets();
+
+               String labelName = "";
+
+               if (position.getPermittedDocumentTypes().isPermittedAll()) {
+                       labelName = this.getThreeBeginningLetters(designArea
+                                       
.getProperties().getProperty("documentTypes.all"));
+               }
+
+               else {
+
+                       for (int i = 0; i < permittedTypesOfDocuments.size(); 
++i) {
+                               if (i != 0) {
+                                       labelName += " "
+                                                       + 
this.getThreeBeginningLetters(designArea
+                                                                       
.getProperties().getProperty(
+                                                                               
        permittedTypesOfDocuments.get(i)));
+                               } else {
+                                       labelName += 
this.getThreeBeginningLetters(designArea
+                                                       
.getProperties().getProperty(
+                                                                       
permittedTypesOfDocuments.get(i)));
+                               }
+                       }
+
+               }
+               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,
+                               monitorWidth - 2, monitorHeight - 2);
+
+       }
+
+       /**
+        * Decides the type of the action according to the location of mouse in
+        * object
+        * 
+        * @param x
+        *            x coordinate of mouse location
+        * @param y
+        *            y coordinate of mouse location
+        * @return type of the action
+        */
+       public ActionType decideTypeOfAction(int x, int y) {
+               int left = OBJECT_MOVE_AREA_SIZE;
+               int right = monitorWidth - OBJECT_MOVE_AREA_SIZE;
+               int top = OBJECT_MOVE_AREA_SIZE;
+               int bottom = monitorHeight - OBJECT_MOVE_AREA_SIZE;
+
+               if (x < left && y < top)
+                       return ActionType.RESIZE_TOP_LEFT_CORNER;
+               else if (x > right && y < top)
+                       return ActionType.RESIZE_TOP_RIGHT_CORNER;
+               else if (x < left && y > bottom)
+                       return ActionType.RESIZE_BOTTOM_LEFT_CORNER;
+               else if (x > right && y > bottom)
+                       return ActionType.RESIZE_BOTTOM_RIGHT_CORNER;
+               else if (y < top)
+                       return ActionType.RESIZE_TOP_BORDER;
+               else if (y > bottom)
+                       return ActionType.RESIZE_BOTTOM_BORDER;
+               else if (x < left)
+                       return ActionType.RESIZE_LEFT_BORDER;
+               else if (x > right)
+                       return ActionType.RESIZE_RIGHT_BORDER;
+               else
+                       return ActionType.MOVE;
+       }
+
+       /**
+        * Resizes actually selected position
+        * 
+        * @return whatever position was correctly resized
+        */
+       private boolean resize() {
+
+               int oldWidth = monitorWidth;
+               int oldHeight = monitorHeight;
+
+               if (designArea.isSnapToGridEnabled()) {
+                       Grid grid = new Grid(monitorX2, monitorY2);
+                       grid.snapToGridMonitorCoordinates(designArea);
+                       monitorX2 = grid.getX();
+                       monitorY2 = grid.getY();
+                       grid = new Grid(monitorX1, monitorY1);
+                       grid.snapToGridMonitorCoordinates(designArea);
+                       monitorX1 = grid.getX();
+                       monitorY1 = grid.getY();
+                       grid = new Grid(monitorDx, monitorDy);
+                       grid.snapToGridMonitorCoordinates(designArea);
+                       monitorDx = grid.getX();
+                       monitorDy = grid.getY();
+               }
+
+               int x2MinusDx = monitorX2 - monitorDx;
+               int y2MinusDy = monitorY2 - monitorDy;
+               int x2MinusX1 = monitorX2 - monitorX1;
+               int y2MinusY1 = monitorY2 - monitorY1;
+
+               if (action == ActionType.RESIZE_TOP_LEFT_CORNER) {
+                       monitorTopX = monitorTopX + x2MinusDx;
+                       monitorWidth = monitorWidth - x2MinusDx;
+                       monitorTopY = monitorTopY + y2MinusDy;
+                       monitorHeight = monitorHeight - y2MinusDy;
+               } else if (action == ActionType.RESIZE_TOP_RIGHT_CORNER) {
+                       monitorWidth = monitorWidth + x2MinusX1;
+                       monitorTopY = monitorTopY + y2MinusDy;
+                       monitorHeight = monitorHeight - y2MinusDy;
+               } else if (action == ActionType.RESIZE_BOTTOM_LEFT_CORNER) {
+                       monitorTopX = monitorTopX + x2MinusDx;
+                       monitorWidth = monitorWidth - x2MinusDx;
+                       monitorHeight = monitorHeight + y2MinusY1;
+
+               } else if (action == ActionType.RESIZE_BOTTOM_RIGHT_CORNER) {
+                       monitorWidth = monitorWidth + x2MinusX1;
+                       monitorHeight = monitorHeight + y2MinusY1;
+               }
+
+               else if (action == ActionType.RESIZE_TOP_BORDER) {
+                       monitorTopY = monitorTopY + y2MinusDy;
+                       monitorHeight = monitorHeight - y2MinusDy;
+
+               } else if (action == ActionType.RESIZE_BOTTOM_BORDER) {
+
+                       monitorHeight = monitorHeight + y2MinusY1;
+
+               } else if (action == ActionType.RESIZE_LEFT_BORDER) {
+
+                       monitorTopX = monitorTopX + x2MinusDx;
+                       monitorWidth = monitorWidth - x2MinusDx;
+
+               } else if (action == ActionType.RESIZE_RIGHT_BORDER) {
+
+                       monitorWidth = monitorWidth + x2MinusX1;
+
+               }
+
+               if (designArea.isSnapToGridEnabled()) {
+                       Grid grid = new Grid(0, 0);
+
+                       if (!isWidth) {
+                               if (oldWidth < monitorWidth) {
+
+                                       monitorWidth = 
grid.snapRightMonitor(monitorWidth + monitorTopX) - monitorTopX;
+                                       isWidth = true;
+                               } else if (oldWidth > monitorWidth) {
+                                       monitorWidth = 
grid.snapLeftMonitor(monitorWidth + monitorTopX) - monitorTopX;
+                                       isWidth = true;
+                               }
+                       }
+               
+
+                       if (!isHeight) {
+                               if (oldHeight < monitorHeight) {
+                                       monitorHeight = 
grid.snapDownMonitor(monitorTopY + monitorHeight) - monitorTopY;
+                                       isHeight = true;
+                               } else if (oldHeight > monitorHeight) {
+                                       monitorHeight = 
grid.snapUpMonitor(monitorTopY + monitorHeight) - monitorTopY;
+                                       isHeight = true;
+                               }
+                       }
+
+               }
+
+               Position position = new Position(designArea.getTabbedPane());
+
+               if (monitorWidth < position.getMinMonitorSize(designArea)
+                               || monitorHeight < 
position.getMinMonitorSize(designArea)) {
+
+                       monitorWidth = Math.max(monitorWidth, position
+                                       .getMinMonitorSize(designArea));
+                       monitorHeight = Math.max(monitorHeight, position
+                                       .getMinMonitorSize(designArea));
+                       return false;
+               }
+
+               return true;
+       }
+
+       /**
+        * Moves actually selected position
+        */
+       private void move() {
+               Grid grid = new Grid(0, 0);
+               int oldTopX = monitorTopX;
+               int oldTopY = monitorTopY;
+               
+               int dx = monitorX2 - monitorDx;
+               int dy = monitorY2 - monitorDy;
+               
+               if(designArea.isSnapToGridEnabled()) {
+                       if(isTopX) {
+                               dx = grid.snapLeftMonitor(dx);          
+                       }
+                       
+                       if(isTopY) {
+                               dy = grid.snapUpMonitor(dy);
+                       }
+               }
+               monitorTopX = monitorTopX + dx;
+               monitorTopY = monitorTopY + dy;
+
+               if (designArea.isSnapToGridEnabled()) {
+                       //Grid grid = new Grid(monitorTopX, monitorTopY);
+                       //grid.snapToGridMonitorCoordinates(designArea);
+                       //monitorTopX = grid.getX();
+                       //monitorTopY = grid.getY();
+                       
+                       
+                       if(!isTopX) {
+                               if(oldTopX < monitorTopX) {
+                                       monitorTopX = 
grid.snapRightMonitor(monitorTopX);
+                                       isTopX = true;
+                               }
+                               else if(oldTopX > monitorTopX) {
+                                       monitorTopX = 
grid.snapLeftMonitor(monitorTopX);
+                                       isTopX = true;
+                               }
+                       }
+                       
+                       if(!isTopY) {
+                               if(oldTopX < monitorTopY) {
+                                       monitorTopY = 
grid.snapDownMonitor(monitorTopY);
+                                       isTopY = true;
+                               }
+                               else if(oldTopY > monitorTopY) {
+                                       monitorTopY = 
grid.snapUpMonitor(monitorTopY);
+                                       isTopY = true;
+                               }
+                               
+                       }
+
+               }
+
+       }
+
+       /**
+        * If more position is selected, it moves them
+        */
+       private void moveMore() {
+
+               if (action != ActionType.MOVE) {
+                       return;
+               }
+
+               Layout.AddType addType;
+               if (action == ActionType.MOVE) {
+                       addType = Layout.AddType.MOVE;
+               } else {
+                       addType = Layout.AddType.RESIZE;
+               }
+
+               int WIDTH = designArea.getMyLayout().getScreenResolution()
+                               .getMonitorWidth();
+               int HEIGHT = designArea.getMyLayout().getScreenResolution()
+                               .getMonitorHeight();
+
+               Positions positions = 
designArea.getMyLayout().getLayoutPositions();
+               Positions newPositions = positions.clone();
+
+               int monitorDeltaX = monitorX2 - monitorDx;
+               int monitorDeltaY = monitorY2 - monitorDy;
+
+               System.out.println(monitorDeltaX + " : " + monitorDeltaY);
+
+               monitorDeltaX = positions.changeDeltaXtoNotBeOutOfMonitor(
+                               monitorDeltaX, designArea);
+               monitorDeltaY = positions.changeDeltaYtoNotBeOutOfMonitor(
+                               monitorDeltaY, designArea);
+
+               System.out.println(monitorDeltaX + " : " + monitorDeltaY);
+
+               for (int i = 0; i < positions.size(); ++i) {
+
+                       Position position = positions.get(i);
+                       AbsoluteCoordinates monitor = 
position.getMonitor().clone();
+                       Position newPosition = position.clone();
+
+                       int oldTopX = position.getMonitor().getTopX();
+                       int newTopX = oldTopX + monitorDeltaX;
+                       int oldTopY = position.getMonitor().getTopY();
+                       int newTopY = oldTopY + monitorDeltaY;
+                       int newWidth = position.getMonitor().getWidth();
+                       int newHeight = position.getMonitor().getHeight();
+
+                       if (position.isSelected()) {
+
+                               if (designArea.isSnapToGridEnabled()) {
+                                       Grid grid = new Grid(newTopX, newTopY);
+                                       
grid.snapToGridMonitorCoordinates(designArea);
+                                       newTopX = grid.getX();
+                                       newTopY = grid.getY();
+
+                                       // grid = new Grid(newWidth, newHeight);
+                                       // 
grid.snapToGridMonitorCoordinates(designArea);
+                                       // newWidth = grid.getX();
+                                       // newHeight = grid.getY();
+                               }
+
+                               monitor = new AbsoluteCoordinates(newTopX, 
newTopY, newWidth,
+                                               newHeight);
+                               AbsoluteCoordinates monitor1 = newPosition
+                                               
.changeCoordinatesToNotBeOutOfDesignArea(newTopX,
+                                                               newTopY, 
newWidth, newHeight, WIDTH, HEIGHT,
+                                                               addType, false, 
designArea);
+
+                               newPosition.setMonitor(monitor1);
+                               newPosition.setElvysFromMonitor(monitor1, 
designArea
+                                               .isSnapToGridEnabled(), action);
+
+                               MovingObject object = 
designArea.getObjects().get(i);
+
+                               object.monitorTopX = monitor1.getTopX();
+                               object.monitorTopY = monitor1.getTopY();
+                               object.monitorWidth = monitor1.getWidth();
+                               object.monitorHeight = monitor1.getHeight();
+
+                               object.setLocation(monitor1.getTopX(), 
monitor1.getTopY());
+                               object.setSize(monitor1.getWidth(), 
monitor1.getHeight());
+                               object.setPosition(newPosition);
+
+                       }
+
+                       newPositions.addPosition(newPosition);
+
+               }
+
+               designArea.getMyLayout().setLayoutPositions(newPositions);
+               designArea.getTabbedPane().getPropertiesManager()
+                               .actualizePropertiesTable();
+               designArea.paintAllPositions();
+
+       }
+
+       /**
+        * Moves or resizes actually selected positions
+        */
+       private void reposition() {
+
+               boolean wasRepositioned = true;
+               if (action == ActionType.MOVE) {
+                       move();
+               }
+
+               else {
+                       wasRepositioned = resize();
+               }
+
+               if (wasRepositioned) {
+
+                       Position newDocument = new 
Position(position.getTabbedPane());
+                       newDocument.setId(id);
+                       Position.IsSnappedToGrid snapped = 
newDocument.isSnappedToGrid();
+                       snapped.setHeight(designArea.isSnapToGridEnabled());
+                       snapped.setWidth(designArea.isSnapToGridEnabled());
+                       snapped.setTopX(designArea.isSnapToGridEnabled());
+                       snapped.setTopY(designArea.isSnapToGridEnabled());
+                       newDocument.setSnappedToGrid(snapped);
+                       AbsoluteCoordinates designAreaAbsoluteCoordinates = new 
AbsoluteCoordinates(
+                                       monitorTopX, monitorTopY, monitorWidth, 
monitorHeight);
+                       newDocument.setMonitor(designAreaAbsoluteCoordinates);
+
+                       Layout.AddType addType;
+                       if (action == ActionType.MOVE) {
+                               addType = Layout.AddType.MOVE;
+                       } else {
+                               addType = Layout.AddType.RESIZE;
+                       }
+
+                       int WIDTH = 
designArea.getMyLayout().getScreenResolution()
+                                       .getMonitorWidth();
+                       int HEIGHT = 
designArea.getMyLayout().getScreenResolution()
+                                       .getMonitorHeight();
+
+                       AbsoluteCoordinates monitor = newDocument
+                                       
.changeCoordinatesToNotBeOutOfDesignArea(monitorTopX,
+                                                       monitorTopY, 
monitorWidth, monitorHeight, WIDTH,
+                                                       HEIGHT, addType, false, 
designArea);
+
+                       monitorTopX = monitor.getTopX();
+                       monitorTopY = monitor.getTopY();
+                       monitorWidth = monitor.getWidth();
+                       monitorHeight = monitor.getHeight();
+
+                       setLocation(monitorTopX, monitorTopY);
+                       setSize(monitorWidth, monitorHeight);
+
+                       monitorX1 = monitorX2;
+                       monitorY1 = monitorY2;
+               }
+
+               else {
+
+                       if (position.isSelected()) {
+                               designArea.setIsNotMoving(true);
+                               designArea.setNotDesigning(true);
+
+                               Layout layout = designArea.getMyLayout();
+                               Position newDocument = new 
Position(designArea.getTabbedPane());
+                               newDocument.setPosition(position);
+
+                               AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
+                                               monitorTopX, monitorTopY, 
monitorWidth, monitorHeight);
+                               
newDocument.setMonitor(designAreaAbsoluteCoordinates);
+
+                               Layout.AddType addType;
+                               if (action == ActionType.MOVE) {
+                                       addType = Layout.AddType.MOVE;
+                               } else {
+                                       addType = Layout.AddType.RESIZE;
+                               }
+
+                               layout.addPosition(layout.getLayoutPositions(), 
newDocument,
+                                               position, designArea, addType, 
false);
+
+                               // position = newDocument;
+
+                       }
+               }
+
+       }
+
+       /**
+        * Sets cursors according to the location of mouse
+        * 
+        * @param x
+        *            x coordinate of mouse location
+        * @param y
+        *            y coordinate of mouse location
+        */
+       private void setCursor(int x, int y) {
+               switch (decideTypeOfAction(x, y)) {
+               case MOVE:
+                       designArea.setCursor(new Cursor(Cursor.MOVE_CURSOR));
+                       break;
+               case RESIZE_TOP_LEFT_CORNER:
+                       designArea.setCursor(new 
Cursor(Cursor.NW_RESIZE_CURSOR));
+                       break;
+               case RESIZE_TOP_RIGHT_CORNER:
+                       designArea.setCursor(new 
Cursor(Cursor.NE_RESIZE_CURSOR));
+                       break;
+               case RESIZE_BOTTOM_LEFT_CORNER:
+                       designArea.setCursor(new 
Cursor(Cursor.SW_RESIZE_CURSOR));
+                       break;
+               case RESIZE_BOTTOM_RIGHT_CORNER:
+                       designArea.setCursor(new 
Cursor(Cursor.SE_RESIZE_CURSOR));
+                       break;
+               case RESIZE_TOP_BORDER:
+                       designArea.setCursor(new 
Cursor(Cursor.N_RESIZE_CURSOR));
+                       break;
+               case RESIZE_BOTTOM_BORDER:
+                       designArea.setCursor(new 
Cursor(Cursor.S_RESIZE_CURSOR));
+                       break;
+               case RESIZE_LEFT_BORDER:
+                       designArea.setCursor(new 
Cursor(Cursor.W_RESIZE_CURSOR));
+                       break;
+               case RESIZE_RIGHT_BORDER:
+                       designArea.setCursor(new 
Cursor(Cursor.E_RESIZE_CURSOR));
+                       break;
+               }
+       }
+
+       // constructors
+
+       /**
+        * Empty constructor of class MovingObject
+        */
+       public MovingObject() {
+       }
+
+       /**
+        * Constructor of the class Moving object
+        * 
+        * @param _designArea
+        *            design area where corresponding position is designed
+        * @param _id
+        *            id of corresponding position
+        * @param elvys
+        *            elvys coordinates of corresponding position
+        * @param monitor
+        *            monitor coordinates of corresponding position
+        * @param _screenResolution
+        *            screen resolution
+        * @param _allTypes
+        *            all permitted types of documents
+        * @param properties
+        *            properties
+        */
+       public MovingObject(DesignArea _designArea, int _id,
+                       AbsoluteCoordinates elvys, AbsoluteCoordinates monitor,
+                       ScreenResolution _screenResolution, Vector<String> 
_allTypes,
+                       Properties properties) {
+               super();
+
+               this.instance = this;
+               this.designArea = _designArea;
+
+               this.monitorTopX = monitor.getTopX();
+               this.monitorTopY = monitor.getTopY();
+               this.monitorWidth = monitor.getWidth();
+               this.monitorHeight = monitor.getHeight();
+
+               this.id = _id;
+
+               // adds popup menu with copy, paste and delete options
+               popupMenu = designArea.getPopupMenu();
+               MouseListener popupListener = popupMenu.new 
PopupListener(popupMenu);
+               addMouseListener(popupListener);
+
+               addMouseListener(new MouseAdapter() {
+                       @Override
+                       public void mouseEntered(MouseEvent e) {
+
+                               // for selected position sets cursor
+                               if (position.isSelected()) {
+                                       setCursor(e.getX(), e.getY());
+
+                               }
+                               int topX = position.getElvys().getTopX()
+                                               + 
designArea.getElvysX(e.getX());
+                               int topY = position.getElvys().getTopY()
+                                               + 
designArea.getElvysY(e.getY());
+
+                               designArea.getTabbedPane().getStatusBar()
+                                               
.actualizeStatusBarMouseCoordinates(
+                                                               
designArea.getMyLayout(), topX, topY);
+
+                               
designArea.getTabbedPane().getPropertiesManager()
+                                               .actualizePropertiesTable();
+
+                               designArea.requestFocus(true);
+
+                       }
+
+               });
+
+               addMouseMotionListener(new MouseAdapter() {
+                       @Override
+                       public void mouseMoved(MouseEvent e) {
+
+                               int topX = position.getElvys().getTopX()
+                                               + 
designArea.getElvysX(e.getX());
+                               int topY = position.getElvys().getTopY()
+                                               + 
designArea.getElvysY(e.getY());
+
+                               designArea.getTabbedPane().getStatusBar()
+                                               
.actualizeStatusBarMouseCoordinates(
+                                                               
designArea.getMyLayout(), topX, topY);
+
+                               
designArea.getTabbedPane().getPropertiesManager()
+                                               .actualizePropertiesTable();
+
+                               designArea.requestFocusInWindow();
+                       }
+
+               });
+
+               addMouseListener(new MouseAdapter() {
+                       @Override
+                       public void mouseExited(MouseEvent e) {
+
+                               if (designArea.isInDesignMode()) {
+                                       designArea.setCursor(new 
Cursor(Cursor.CROSSHAIR_CURSOR));
+                               } else {
+                                       designArea.setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
+                               }
+                       }
+               });
+
+               addMouseListener(new MouseAdapter() {
+                       @Override
+                       public void mousePressed(MouseEvent e) {
+
+                               // for selected position sets cursor
+                               if (position.isSelected()) {
+                                       setCursor(e.getX(), e.getY());
+
+                               }
+
+                               isTopX = false;
+                               isTopY = false;
+                               isWidth = false;
+                               isHeight = false;
+
+                               designArea.requestFocus(true);
+                               designArea.setIsNotMoving(true);
+
+                               Layout layout = designArea.getMyLayout();
+
+                               Layout.AddType addType;
+                               if (action == ActionType.MOVE) {
+                                       addType = Layout.AddType.MOVE;
+                               } else {
+                                       addType = Layout.AddType.RESIZE;
+                               }
+
+                               layout.addPosition(layout.getLayoutPositions(), 
position,
+                                               position, designArea, addType, 
false);
+
+                               position.selectPosition(e.isControlDown(), 
designArea);
+
+                               
designArea.getTabbedPane().getPropertiesManager()
+                                               .actualizeAll();
+                               designArea.requestFocusInWindow();
+
+                               designArea.removeAll();
+
+                               Vector<Position> positions = 
layout.getLayoutPositions()
+                                               .getPositions();
+
+                               designArea.setObjects(new MovingObjects());
+                               for (int i = 0; i < positions.size(); ++i) {
+                                       Position actualPosition = 
positions.get(i);
+
+                                       if (actualPosition.getId() == id) {
+                                               designArea.getObjects().add(
+                                                               
actualPosition.paint(designArea, instance));
+                                       } else {
+                                               designArea.getObjects().add(
+                                                               
actualPosition.paint(designArea));
+                                       }
+                               }
+
+                               designArea.setIsNotMoving(false);
+
+                               monitorX1 = e.getX();
+                               monitorY1 = e.getY();
+
+                               action = decideTypeOfAction(monitorX1, 
monitorY1);
+
+                               // if (designArea.isSnapToGridEnabled()
+                               // && action != ActionType.MOVE) {
+                               // snapToGridTopCoordinates();
+                               // Grid grid = new Grid(monitorX1, monitorY1);
+                               // 
grid.snapToGridMonitorCoordinates(designArea);
+                               // monitorX1 = grid.getX();
+                               // monitorY1 = grid.getY();
+                               // }
+
+                               monitorDx = monitorX1;
+                               monitorDy = monitorY1;
+
+                               oldPositions = 
designArea.getMyLayout().getLayoutPositions()
+                                               .clone();
+
+                       }
+
+               });
+
+               addMouseListener(new MouseAdapter() {
+                       @Override
+                       public void mouseReleased(MouseEvent e) {
+
+                               designArea.setIsNotMoving(true);
+                               designArea.setNotDesigning(true);
+
+                               if (position.isSelected()) {
+                                       if 
(designArea.getMyLayout().getSelectedPositions().size() == 1) {
+                                               designArea.setIsNotMoving(true);
+                                               
designArea.setNotDesigning(true);
+
+                                               Layout layout = 
designArea.getMyLayout();
+                                               Position newPosition = new 
Position(designArea
+                                                               
.getTabbedPane());
+                                               
newPosition.setPosition(position);
+
+                                               AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
+                                                               monitorTopX, 
monitorTopY, monitorWidth,
+                                                               monitorHeight);
+                                               Position.IsSnappedToGrid 
snapped = newPosition
+                                                               
.isSnappedToGrid();
+                                               
snapped.setHeight(designArea.isSnapToGridEnabled());
+                                               
snapped.setWidth(designArea.isSnapToGridEnabled());
+                                               
snapped.setTopX(designArea.isSnapToGridEnabled());
+                                               
snapped.setTopY(designArea.isSnapToGridEnabled());
+                                               
newPosition.setSnappedToGrid(snapped);
+                                               
newPosition.setMonitor(designAreaAbsoluteCoordinates);
+                                               newPosition.setElvysFromMonitor(
+                                                               
designAreaAbsoluteCoordinates, designArea
+                                                                               
.isSnapToGridEnabled(), action);
+
+                                               Layout.AddType addType;
+                                               if (action == ActionType.MOVE) {
+                                                       addType = 
Layout.AddType.MOVE;
+                                               } else {
+                                                       addType = 
Layout.AddType.RESIZE;
+                                               }
+
+                                               
layout.addPosition(layout.getLayoutPositions(),
+                                                               newPosition, 
position, designArea, addType,
+                                                               true);
+
+                                               
designArea.getMyLayout().addActionToActionsMemory(
+                                                               designArea);
+                                               
designArea.getTabbedPane().getPropertiesManager()
+                                                               .actualizeAll();
+                                               position = newPosition;
+
+                                       } else {
+                                               if 
(designArea.getMyLayout().getLayoutPositions()
+                                                               .isOverlap()) {
+                                                       
designArea.getMyLayout().setLayoutPositions(
+                                                                       
oldPositions);
+                                                       
designArea.paintAllPositions();
+                                               } else {
+                                                       
designArea.getMyLayout().addActionToActionsMemory(
+                                                                       
designArea);
+                                               }
+                                       }
+                               }
+                       }
+
+               });
+
+               addMouseMotionListener(new MouseAdapter() {
+                       @Override
+                       public void mouseDragged(MouseEvent e) {
+
+                               designArea.requestFocusInWindow();
+
+                               int topX = position.getElvys().getTopX()
+                                               + 
designArea.getElvysX(e.getX());
+                               int topY = position.getElvys().getTopY()
+                                               + 
designArea.getElvysY(e.getY());
+
+                               designArea.getTabbedPane().getStatusBar()
+                                               
.actualizeStatusBarMouseCoordinates(
+                                                               
designArea.getMyLayout(), topX, topY);
+
+                               Layout layout = designArea.getMyLayout();
+
+                               if (position.isSelected()) {
+                                       designArea.setIsNotMoving(false);
+
+                                       monitorX2 = e.getX();
+                                       monitorY2 = e.getY();
+
+                                       if (position.isSelected()) {
+
+                                               if 
(layout.getSelectedPositions().size() == 1) {
+                                                       reposition();
+                                                       Position newPosition = 
new Position(designArea
+                                                                       
.getTabbedPane());
+                                                       
newPosition.setPosition(position);
+
+                                                       AbsoluteCoordinates 
designAreaAbsoluteCoordinates = new AbsoluteCoordinates(
+                                                                       
monitorTopX, monitorTopY, monitorWidth,
+                                                                       
monitorHeight);
+                                                       newPosition
+                                                                       
.setMonitor(designAreaAbsoluteCoordinates);
+
+                                                       
newPosition.setElvysFromMonitor(
+                                                                       
designAreaAbsoluteCoordinates, designArea
+                                                                               
        .isSnapToGridEnabled(), action);
+
+                                                       Layout.AddType addType;
+                                                       if (action == 
ActionType.MOVE) {
+                                                               addType = 
Layout.AddType.MOVE;
+                                                       } else {
+                                                               addType = 
Layout.AddType.RESIZE;
+                                                       }
+
+                                                       // position = 
newPosition;
+                                                       
layout.addPosition(layout.getLayoutPositions(),
+                                                                       
newPosition, position, designArea, addType,
+                                                                       false);
+                                               } else {
+                                                       
designArea.setIsNotMoving(false);
+                                                       moveMore();
+                                               }
+                                       }
+                               }
+                               
designArea.getTabbedPane().getPropertiesManager()
+                                               .actualizePropertiesTable();
+                       }
+
+               });
+
+       }
+
+       // getters & setters
+
+       /**
+        * Sets position corresponding to this object
+        * 
+        * @param position
+        *            the position to set
+        */
+       public void setPosition(Position position) {
+               this.position = position;
+       }
+
+       /**
+        * Gets position corresponding to this object
+        * 
+        * @return the position
+        */
+       public Position getPosition() {
+               return position;
+       }
+
+       /**
+        * Gets id of position corresponding to this object
+        * 
+        * @return the id
+        */
+       public int getId() {
+               return id;
+       }
+
+}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/MovingObjects.java     
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/MovingObjects.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Vector;
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PermittedDocumentTypes.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/PermittedDocumentTypes.java    
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PermittedDocumentTypes.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Vector;
 

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PopupMenu.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/PopupMenu.java 2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PopupMenu.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,262 +0,0 @@
-package applet;
-/**
- * PopupMenu.java
- * @author Eva Viktorinova
- */
-import java.awt.Graphics;
-import java.awt.event.*;
-import java.util.Properties;
-import javax.swing.*;
-
-/**
- * @class PopupMenu
- * Popup menu enables to copy, paste and delete actually selected positions
- */
-@SuppressWarnings("serial")
-public class PopupMenu extends JPopupMenu {
-       private Properties properties;                  /** properties */       
-       private PopupMenu popupMenu;                    /** this popup menu */
-       private DesignArea designArea;                  /** design area which 
corresponds to this menu */
-       private int topX;                                               /** x 
coordinate of place where copied positions are pasted */ 
-       private int topY;                                               /** y 
coordinate of place where copied positions are pasted */
-       private JMenuItem menuItemPaste;                /** menu item for 
pasting of positions */
-       private JMenuItem menuItemCopy;                 /** menu item for 
copying of positions */
-       private JMenuItem menuItemDelete;               /** menu item for 
deleting of positions */
-
-       /**
-        * @class PopupListener 
-        * Listens for changes in popup menu
-        */
-       public class PopupListener extends MouseAdapter {
-               PopupListener(PopupMenu _popupMenu) {
-                       popupMenu = _popupMenu;
-               }
-               
-               public void mousePressed(MouseEvent e) {
-                       designArea.repaint();
-                       maybeShowPopup(e);
-               }
-
-               public void mouseReleased(MouseEvent e) {
-                       designArea.repaint();
-                       maybeShowPopup(e);
-               }
-
-               private void maybeShowPopup(MouseEvent e) {
-                       if (e.isPopupTrigger()) {
-                               popupMenu.show(e.getComponent(), e.getX(), 
e.getY());
-                               popupMenu.topX = e.getX();
-                               popupMenu.topY = e.getY();
-                       }
-               }
-       }
-
-       /**
-        * Constructor of the class PopupMenu. Initializes menu items and sets 
actions for menu items 
-        * @param designArea design area from which this popup menu was 
triggered
-        * @param properties properties
-        */
-       public PopupMenu(DesignArea _designArea, Properties properties) {
-
-               this.setFocusable(false);
-               this.designArea = _designArea;
-               this.properties = properties;
-               designArea.repaint();
-               
-               // initializes paste menu item
-               menuItemPaste = new 
JMenuItem(properties.getProperty("popupMenu.paste"));
-               
menuItemPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
-                               ActionEvent.CTRL_MASK));
-               menuItemPaste.setFocusable(false);
-
-               menuItemPaste.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               paste(designArea, topX, topY);
-                               menuItemPaste.setEnabled(false);
-                       }
-               });
-
-               this.add(menuItemPaste);
-
-               // initializes copy menu item
-               menuItemCopy = new 
JMenuItem(properties.getProperty("popupMenu.copy"));
-               
menuItemCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
-                               ActionEvent.CTRL_MASK));
-               menuItemCopy.setFocusable(false);
-
-               menuItemCopy.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               copy(designArea);
-                               menuItemPaste.setEnabled(true);
-                       }
-               });
-               this.add(menuItemCopy);
-
-               // initializes delete menu item
-               menuItemDelete = new JMenuItem(properties
-                               .getProperty("popupMenu.delete"));
-               
menuItemDelete.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE,0));
-               menuItemDelete.setFocusable(false);
-               
-               menuItemDelete.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               delete(designArea);
-                       }
-               });
-               this.add(menuItemDelete);
-
-       }
-
-       /**
-        * Actualizes popup menu items according to the actual state 
-        * @param designArea design area from which this popup menu was 
triggered
-        */
-       public void actualize(DesignArea designArea) {
-               if(designArea == null) {
-                       menuItemCopy.setEnabled(false);
-                       menuItemDelete.setEnabled(false);
-                       menuItemPaste.setEnabled(false);
-               }
-               else {
-                       
menuItemPaste.setEnabled(designArea.arePositionToPaste());
-                       boolean isAnyPositionSelected  = 
(designArea.getMyLayout().getSelectedPositions().getPositions().size() >= 1);
-                       menuItemCopy.setEnabled(isAnyPositionSelected);
-                       menuItemDelete.setEnabled(isAnyPositionSelected);
-               }
-               
-       }
-       
-       
-       /**
-        * Copies actually selected positions
-        * @param designArea design area where positions are copied
-        */
-       public void copy(DesignArea designArea) {
-
-               Layout layout = designArea.getMyLayout();
-               Positions selectedPositions = layout
-                               .getSelectedPositions();
-
-               designArea.setPositionsToPaste(selectedPositions.clone());
-               designArea.setPositionToPaste(true);
-               
designArea.getTabbedPane().getPropertiesManager().actualizePropertiesTable();
-               designArea.setIsNotMoving(true);
-               designArea.repaint();
-               designArea.requestFocusInWindow();
-
-       }
-
-       /**
-        * Deletes actually selected positions 
-        * @param designArea design area where positions are deleted
-        */
-       public void delete(DesignArea designArea) {
-
-               Layout layout = designArea.getMyLayout();
-
-               Positions selectedPositions = layout
-                               .getSelectedPositions();
-
-               for (int i = 0; i < selectedPositions.getPositions().size(); 
++i) {
-                       
layout.removePosition(selectedPositions.getPositions().get(i)
-                                       .getId(), designArea);
-               }
-               designArea.setIsNotMoving(true);
-               designArea.setMyLayout(layout);
-               designArea.repaint();
-               designArea.requestFocusInWindow();
-
-       }
-       
-       /**
-        * Pastes copied positions
-        * @param designArea design area where positions are pasted
-        * @param x x coordinate of place where copied positions are pasted
-        * @param y y coordinate of place where copied positions are pasted
-        */
-
-       public void paste(DesignArea designArea, int x, int y) {
-
-               
-               if (designArea.arePositionToPaste()) {
-
-                       Layout oldLayout = designArea.getMyLayout();
-                       Layout newLayout = oldLayout.clone();
-                       
-                       Positions pastePositions = 
designArea.getPositionsToPaste();
-
-                       int oldX = pastePositions.getMonitorTopX();
-                       int oldY = pastePositions.getMonitorTopY();
-                       
-               
-
-                       int deltaX = x - oldX;
-                       int deltaY = y - oldY;
-
-                       Positions pastedPositions = new Positions();
-                       for (int i = 0; i < 
pastePositions.getPositions().size(); ++i) {
-
-                               Position position = 
pastePositions.getPositions().get(i)
-                                               .clone();
-                               AbsoluteCoordinates monitor = 
position.getMonitor();
-                               monitor.setTopX(monitor.getTopX() + deltaX);
-                               monitor.setTopY(monitor.getTopY() + deltaY);
-                               position.setMonitor(monitor);
-                               position.setElvysFromMonitor(monitor);
-
-                               if(designArea.isSnapToGridEnabled()) {
-                                       position = position.snapToGrid();
-                               }
-                               
-                               
-
-                               Positions allPositions = newLayout
-                                               .getLayoutPositions();
-
-
-                               int pasteDocumentID = 
allPositions.getPositions().size() + 1;
-                               position.setId(pasteDocumentID);
-                               position.setSelected(true);
-                               
newLayout.addPosition(newLayout.getLayoutPositions(), position, position, 
designArea,
-                                                               
Layout.AddType.PASTE, true);
-                               pastedPositions.addPosition(position);
-
-                               
-                               
-                       }
-
-                       
-                       int kiosekWidth = 
oldLayout.getScreenResolution().getElvysWidth();
-                       int kiosekHeight = 
oldLayout.getScreenResolution().getElvysHeight();
-                       
-                       if(newLayout.getLayoutPositions().isOutOf(kiosekWidth, 
kiosekHeight, designArea)) {
-                               new WarningDialog(new JFrame(), 
properties.getProperty("warning.pasteNotAllowed"), 
properties.getProperty("warning.warning"));
-                       }
-                       else {
-                               designArea.setMyLayout(newLayout);
-                               newLayout.selectPositions(pastedPositions);
-                               
designArea.getActionMemory().addActionToActionsMemory(designArea);
-                       }
-                       
-                       
-                       
-                       designArea.requestFocusInWindow();
-
-               }
-       }
-
-
-       /**
-        * Repaints design area if popup menu was triggered
-        * @param g graphics
-        */
-       public void paintComponent(Graphics g) {
-               super.paintComponent(g);
-               if(designArea != null) {
-                       designArea.repaint();
-               }
-       }
-       
-
-
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Position.java  2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Position.java 
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.awt.Color;
 import java.util.Comparator;
@@ -6,6 +6,10 @@
 import java.util.Vector;
 import javax.swing.JFrame;
 
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+import com.elvys.applet.dialog.WarningDialog;
+
 /**
  * Represents position of planned documents in layout
  * 
@@ -204,7 +208,7 @@
                layout.setLayoutPositions(newPositions);
 
                
designArea.getTabbedPane().getPropertiesManager().actualizeAll();
-               designArea.repaint();
+               designArea.paintAllPositions();
 
        }
        
@@ -1217,19 +1221,47 @@
                        HEIGHT = grid.getY();
                }
 
+               int left = 0;
+               int down = 0;
+               /*if(isElvys) {
+                       left = designArea.getTabCatPanelWidthElvys();
+                       down = left;
+                       
+                       if (designArea.isSnapToGridEnabled()) {
+
+                               Grid grid = new Grid(left, down);
+                               grid.snapToGridKioskCoordinates1(designArea);
+                               left = grid.getX();
+                               down = grid.getY();
+                       }
+               }
+               else {
+                       left = designArea.getLeftPanelWidthMonitor();
+                       down = designArea.getDownPanelWidthMonitor();
+                       
+                       if (designArea.isSnapToGridEnabled()) {
+
+                               Grid grid = new Grid(left, down);
+                               grid.snapToGridMonitorCoordinates1(designArea);
+                               left = grid.getX();
+                               down = grid.getY();
+                       }
+                       
+               }*/
+               
                if (addType == Layout.AddType.RESIZE
                                || addType == Layout.AddType.DESIGN) {
                        if (topX + width > WIDTH) {
                                width = Math.max(0, WIDTH - topX);
                        }
 
-                       if (topX < 0) {
-                               width = Math.max(0, width + topX);
-                               topX = 0;
+                       if (topX < left) {
+                               width = Math.max(0, width - left + topX);
+                               topX = left;
                        }
 
-                       if (topY + height > HEIGHT) {
-                               height = Math.max(0, HEIGHT - topY);
+                       if (topY + height > HEIGHT - down) {
+                               height = Math.max(0, HEIGHT - topY - down);
                        }
 
                        if (topY < 0) {
@@ -1243,12 +1275,12 @@
                                topX = Math.max(0, WIDTH - width);
                        }
 
-                       if (topX < 0) {
-                               topX = 0;
+                       if (topX < left) {
+                               topX = left;
                        }
 
-                       if (topY + height > HEIGHT) {
-                               topY = Math.max(0, HEIGHT - height);
+                       if (topY + height > HEIGHT - down) {
+                               topY = Math.max(0, HEIGHT - down - height);
                        }
 
                        if (topY < 0) {
@@ -1291,12 +1323,23 @@
                int topY = elvys.getTopY();
                int width = elvys.getWidth();
                int height = elvys.getHeight();
+               
+               int left = 0; //designArea.getTabCatPanelWidthElvys();
+               int down = 0; //left;
+               
+               if (designArea.isSnapToGridEnabled()) {
 
-               if (topX + width > WIDTH || topX < 0) {
+                       Grid grid = new Grid(left, down);
+                       grid.snapToGridKioskCoordinates1(designArea);
+                       left = grid.getX();
+                       down = grid.getY();
+               }
+               
+               if (topX + width > WIDTH || topX < left) {
                        return true;
                }
 
-               if (topY + height > HEIGHT || topY < 0) {
+               if (topY + height > HEIGHT - down || topY < 0) {
                        return true;
                }
 
@@ -1336,11 +1379,22 @@
                int width = monitor.getWidth();
                int height = monitor.getHeight();
 
-               if (topX + width > WIDTH || topX < 0) {
+               int left = 0; //designArea.getLeftPanelWidthMonitor();
+               int down = 0; //designArea.getDownPanelWidthMonitor();
+               
+               if (designArea.isSnapToGridEnabled()) {
+
+                       Grid grid = new Grid(left, down);
+                       grid.snapToGridMonitorCoordinates1(designArea);
+                       left = grid.getX();
+                       down = grid.getY();
+               }
+               
+               if (topX + width > WIDTH || topX < left) {
                        return true;
                }
 
-               if (topY + height > HEIGHT || topY < 0) {
+               if (topY + height > HEIGHT - down || topY < 0) {
                        return true;
                }
 
@@ -1557,7 +1611,7 @@
         * @param isSelected is this position selected to set
         */
        public void setSelected(boolean isSelected) {
-               this.tabbedPane.getActualDesignArea().repaint();
+               this.tabbedPane.getActualDesignArea().paintAllPositions();
                this.isSelected = isSelected;
        }
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Positions.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/Positions.java 2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/Positions.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,8 +1,11 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Collections;
 import java.util.Vector;
 
+import com.elvys.applet.components.DesignArea;
+import com.elvys.applet.components.TabbedPane;
+
 /**
  * Positions stores positions in layout
  * 

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PositionsList.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java     
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PositionsList.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,187 +0,0 @@
-package applet;
-
-/**
- * PositionsList.java
- * @author Eva Viktorinova
- */
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-/**
- * @class PositionList
- * Displays list with positions, enlightens selected positions and allows 
selecting of positions 
- */
-@SuppressWarnings("serial")
-public class PositionsList extends JPanel {
-
-       private TabbedPane tabbedPane;          /** main tabbed pane of the 
LayoutDesigner */
-       private String positionItemName;                /** name of position 
item */    
-       private JPanel positionPanel;           /** panel with positions */
-       private JScrollPane scroller;           /** scroller in panel with 
positions */
-
-       
-       /**
-        * @class PositionListItem
-        * Represent one item in position list
-        */
-       private class PositionListItem extends JLabel {
-               private int positionID;
-               private String positionItemName;
-
-               /**
-                * Constructor of the class PositionListItem
-                * @param positionID id of position
-                * @param positionItemName name of position
-                */
-               public PositionListItem(int positionID, String 
positionItemName) {
-                       super();
-                       this.positionID = positionID;
-                       this.positionItemName = positionItemName;
-                       this.positionItemName += Integer.toString(positionID);
-                       this.setText(this.positionItemName);
-               }
-
-       }
-
-       // constructors
-       /**
-        * Constructor of the class PositionsList
-        * @param positionList position list to set
-        * @param tabbedPane tabbed pane to set
-        */
-       public PositionsList(JPanel positionList, TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-               this.positionItemName = 
tabbedPane.getProperties().getProperty("positionList.position");;
-               
-               this.setFocusable(false);
-               positionList.setBorder(BorderFactory.createEmptyBorder());
-               
-               
-               positionPanel = new JPanel();
-               positionPanel.setLayout(new BoxLayout(positionPanel, 
BoxLayout.PAGE_AXIS));
-               
-               
-               scroller = new JScrollPane(positionPanel, 
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
-                             JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
-               scroller.setPreferredSize(new Dimension(80, 185));
-               positionList.add(scroller);
-       }
-
-       /**
-        * Actualizes position list. It only makes invisible deleted positions 
to make displaying faster
-        */
-       public void actualize() {               
-               
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-               if (designArea == null) {
-                       for (int k = 0; k < positionPanel.getComponentCount(); 
++k) {
-                               PositionListItem item = (PositionListItem) 
positionPanel
-                                               .getComponent(k);
-                               item.setVisible(false);
-                       }
-                       
-                       return;
-               }
-
-               Positions selectedPositions = 
designArea.getMyLayout().getSelectedPositions();
-               
-               if(selectedPositions.isTooSmall(tabbedPane)) {
-                       return;
-               }
-               
-               int i = 0;
-               int j = 0;
-
-               for (i = 0; i < designArea.getMyLayout()
-                               .getLayoutPositions().getPositions().size(); 
++i) {
-                       Position position = designArea.getMyLayout()
-                                       
.getLayoutPositions().getPositions().get(i);
-
-                       if (j >= positionPanel.getComponentCount()) {
-                               addDocumentListItem(position, i);
-                       } else {
-                               PositionListItem item = (PositionListItem) 
positionPanel
-                                               .getComponent(j);
-                               item.setVisible(true);
-                               item.positionID = position.getId();
-                               item.positionItemName = positionItemName + 
position.getId();
-                               if (position.isSelected()) {
-                                       item.setForeground(Color.blue);
-                               } else {
-                                       item.setForeground(Color.black);
-                               }
-
-                               item.setText(positionItemName + 
position.getId());
-                       }
-                       ++j;
-               }
-               
-               for (int k = i; k < positionPanel.getComponentCount(); ++k) {
-                       PositionListItem item = (PositionListItem) positionPanel
-                                       .getComponent(k);
-                       item.setVisible(false);
-               }
-
-       }
-
-       /**
-        * Adds new position to position list
-        * @param position position to add
-        * @param i order of position in position list
-        */
-       private void addDocumentListItem(Position position, int i) {
-
-
-               PositionListItem newDocumentListItem = new 
PositionListItem(position
-                               .getId(), positionItemName);
-
-               
-               newDocumentListItem.setFocusable(false);
-               if(position.isSelected()) {
-                       newDocumentListItem.setForeground(Color.blue);
-               }
-               
-               positionPanel.add(newDocumentListItem);
-               
-       
-               newDocumentListItem.addMouseListener(new MouseAdapter() {
-                       public void mouseClicked(MouseEvent e) {
-                               positionSelected(e);
-                       }
-
-               });
-               
-       }
-       /**
-        * If item is selected in position list corresponding position is 
selected
-        * @param e mouse event
-        */
-       public void positionSelected(MouseEvent e) {
-               PositionListItem item = (PositionListItem)e.getSource();
-               int id = item.positionID;
-               
-               
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-               if (designArea == null) {
-                       return;
-               }
-
-               Layout layout = designArea.getMyLayout();
-               
-               Position position = layout.getLayoutPositions().getPosition(id);
-               
-               position.selectPosition(e.isControlDown(), designArea);
-               designArea.repaint();
-               
-               tabbedPane.getPropertiesManager().actualizeAll();
-               
-               
designArea.getActionMemory().addActionToActionsMemory(designArea);
-       }
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManager.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java 
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManager.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,235 +0,0 @@
-package applet;
-
-/** 
- * PropertiesManager.java
- * @author Eva Viktorinova
- */
-import java.awt.Dimension;
-import java.util.Properties;
-import java.util.Vector;
-import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JSeparator;
-import javax.swing.JTabbedPane;
-import javax.swing.SwingConstants;
-
-/**
- * @class Properties Manager
- * PropertiesManager displays actual values for selected position and actual
- * layout
- * 
- */
-
-@SuppressWarnings("serial")
-public class PropertiesManager extends JPanel {
-       // fields
-
-       private TabbedPane layoutTabbedPane;            /** main tabbed pane */
-       private Vector<String> allTypesOfDocuments;     /** all types of 
permitted documents */
-       private JPanel propertiesManagerPanel;          /** panel where 
properties manager is displayed */
-       private PositionsList positionsList;            /** component with 
position list */
-       private DocumentTypes documentTypes;            /** component with 
document types */
-       private PropertiesTable propertiesTable;        /** component with 
properties table */
-       private boolean isMinimalized;                          /** flag 
whatever tab with properties manager is minimalized */
-       
-       // constants
-       private final static int LIST_HEIGHT = 250;                     /** 
height of the position list component */
-       private final static int DOCUMENT_TYPES_HEIGHT = 150;   /** height of 
the document types componnt */
-       private final static int SPACE = 5;                                     
        /** size of the space among components */
-       
-       
-       // constructors
-       
-       /**
-        * Constructor of the class PropertiesManager - initializes components
-        * @param propertiesManagerTabbedPane properties manager tabbed pane to 
set
-        * @param allTypesOfDocuments all permitted types of documents
-        * @param layoutTabbedPane main tabbed pane of the LayoutDesigner
-        * @param properties properties
-        * @param componentSizes sizes of components in LayoutDesigner
-        */
-       public PropertiesManager(JTabbedPane propertiesManagerTabbedPane, 
Vector<String> allTypesOfDocuments,
-                       TabbedPane layoutTabbedPane, Properties properties, 
ComponentSizes componentSizes) {
-
-               this.allTypesOfDocuments = allTypesOfDocuments;
-               this.propertiesManagerPanel = new JPanel();
-               propertiesManagerTabbedPane.setFocusable(false);
-               
propertiesManagerTabbedPane.addTab(properties.getProperty("propertiesManager.label"),
 propertiesManagerPanel);
-               
propertiesManagerTabbedPane.setTabComponentAt(propertiesManagerTabbedPane.getSelectedIndex(),
-                               new 
PropertiesManagerTabCloseButton(propertiesManagerTabbedPane, 
properties.getProperty("propertiesManager.label"), layoutTabbedPane));
-
-
-               this.layoutTabbedPane = layoutTabbedPane;
-               this.setMinimalized(false);
-               this.setFocusable(false);
-
-               addComponents(properties, componentSizes);
-
-       }
-
-       // methods
-       /**
-        * Adds all components to the properties manager
-        * @param properties properties
-        * @param componentSizes size of components in the LayoutDesigner
-        */
-       public void addComponents(Properties properties, ComponentSizes 
componentSizes) {
-
-               JPanel propertiesTablePanel = new JPanel();
-               
-               Dimension propertiesManagerSizes = 
componentSizes.getPropertiesManager();
-               int width = (int)propertiesManagerSizes.getWidth();
-               
-               
-               // creates separators 
-               JSeparator separator1 = new 
JSeparator(SwingConstants.HORIZONTAL);
-               JSeparator separator2 = new 
JSeparator(SwingConstants.HORIZONTAL);
-
-               // creates panel's labels
-               JLabel propertiesTableLabel = new 
JLabel(properties.getProperty("propertiesTable.label"));
-               JLabel documentTypesLabel = new 
JLabel(properties.getProperty("documentTypes.label"));
-               JLabel positionListLabel = new 
JLabel(properties.getProperty("positionList.label"));
-               
-               
-               propertiesTable = new PropertiesTable(layoutTabbedPane,
-                               propertiesTablePanel);
-
-               JPanel documentTypesPanel = new JPanel();
-               documentTypesPanel.setPreferredSize(new Dimension(width, 
DOCUMENT_TYPES_HEIGHT));
-               documentTypes = new DocumentTypes(this, documentTypesPanel, 
properties);
-               documentTypesPanel.setFocusable(false);
-               
-
-               JPanel documentListPanel = new JPanel();
-               documentListPanel.setPreferredSize(new Dimension(width, 
LIST_HEIGHT));
-
-               positionsList = new PositionsList(documentListPanel, 
layoutTabbedPane);
-               positionsList.setFocusable(false);
-       
-       
-               
-               // sets empty border around components to ensure empty space 
among them
-               
propertiesTableLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
-               
propertiesTablePanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
-
-               
documentTypesLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
-               
documentTypesPanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
-               
-               
positionListLabel.setBorder(BorderFactory.createEmptyBorder(SPACE, 0, 0, 0));
-               
documentListPanel.setBorder(BorderFactory.createEmptyBorder(SPACE, SPACE, 
SPACE, SPACE));
-       
-       
-               
-               // sets layout
-               propertiesManagerPanel.setLayout(new 
BoxLayout(propertiesManagerPanel, BoxLayout.PAGE_AXIS));
-               
-               // adds components 
-               propertiesManagerPanel.add(propertiesTableLabel);
-               propertiesTableLabel.setFocusable(false);
-               propertiesManagerPanel.add(propertiesTablePanel);
-               propertiesManagerPanel.add(separator1);
-               
-               propertiesManagerPanel.add(documentTypesLabel);
-               documentTypesLabel.setFocusable(false);
-               propertiesManagerPanel.add(documentTypesPanel);
-               propertiesManagerPanel.add(separator2);
-               
-               propertiesManagerPanel.add(positionListLabel);
-               positionListLabel.setFocusable(false);
-               propertiesManagerPanel.add(documentListPanel);
-               
-       }
-
-       /**
-        * Actualizes all components in properties manager
-        */
-       public void actualizeAll() {
-               this.positionsList.actualize();
-               this.propertiesTable.actualize();
-               this.documentTypes.actualize();
-       }
-       
-       /**
-        * Actualizes properties table
-        */
-       public void actualizePropertiesTable() {
-               this.propertiesTable.actualize();
-       }
-       
-       /**
-        * Actualizes positions list
-        */
-       public void actualizePositionsList() {
-               this.positionsList.actualize();
-       }
-       
-       /**
-        * Actualizes document types
-        */
-       public void actualizeDocumentTypes() {
-               this.documentTypes.actualize();
-       }
-       
-       /**
-        * Actualizes field in properties table
-        */
-       public void actualizePropertiesTableFields() {
-               this.propertiesTable.actualizeFields();
-       }
-
-       /**
-        * Decides whatever properties table is owner of the focus
-        * @return whatever properties table is owner of the focus
-        */
-       public boolean isPropertiesTableFocusOwner() {
-               return propertiesTable.isFocusOwner();
-       }
-       // getters & setters
-
-
-       /**
-        * Getter for the field layoutTabbedPane
-        * @return the layoutTabbedPane
-        */
-       public TabbedPane getLayoutTabbedPane() {
-               return layoutTabbedPane;
-       }
-
-
-       /**
-        * Getter of the filed allTypesOfDocuments
-        * @return the all type of documents
-        */
-       public Vector<String> getAllTypesOfDocuments() {
-               return allTypesOfDocuments;
-       }
-
-       
-       /**
-        * Getter of the field documentTypes
-        * @return the documentTypes
-        */
-       public DocumentTypes getDocumentTypes() {
-               return documentTypes;
-       }
-
-
-       /**
-        * Setter for the field isMinimalized
-        * @param isMinimalized the isMinimalized to set
-        */
-       public void setMinimalized(boolean isMinimalized) {
-               this.isMinimalized = isMinimalized;
-       }
-
-       /**
-        * Getter for the field isMinimalized
-        * @return the isMinimalized
-        */
-       public boolean isMinimalized() {
-               return isMinimalized;
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManagerTabCloseButton.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManagerTabCloseButton.java
   2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesManagerTabCloseButton.java
      2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,108 +0,0 @@
-package applet;
-
-/**
- * PropertiesManagerTabCloseButton.java
- * @author EvaV
- */
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTabbedPane;
-import javax.swing.plaf.basic.BasicButtonUI;
-
-/**
- * @class PropertisManagerTabCloseButton
- * Implements cross button which enables to close tab of properties manager 
tabbed pane  
- */
-@SuppressWarnings("serial")
-public class PropertiesManagerTabCloseButton extends JPanel {
-       private final JTabbedPane propertiesManagerTabbedPane;  /** properties 
manager tabbed pane */
-       private final TabbedPane layoutsTabbedPane;                     /** 
main tabbed pane */
-       private JLabel tabTitleLabel;                                           
        /** title of the tab with the properties manager */
-       
-       /**
-        * Constructor of the class PropertiesManagerTabCloseButton
-        * @param propertiesManagerTabbedPane properties manager tabbed pane
-        * @param tabTitleText  title of the tab with properties manager
-        * @param layoutsTabbedPane     main tabbed pane
-        */
-       public PropertiesManagerTabCloseButton(JTabbedPane 
propertiesManagerTabbedPane, String tabTitleText, TabbedPane layoutsTabbedPane) 
{
-
-               super(new FlowLayout(FlowLayout.LEFT, 0, 0));
-               
-               this.propertiesManagerTabbedPane = propertiesManagerTabbedPane;
-               this.layoutsTabbedPane = layoutsTabbedPane;
-               setOpaque(false);
-
-               tabTitleLabel = new JLabel(tabTitleText);
-               add(tabTitleLabel);
-               tabTitleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 
0, 2));
-               
-               JButton button = new CrossCloseButton();
-               add(button);
-               setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
-       }
-
-       
-
-       /**
-        * @class CrossCloseButton
-        * CrossCloseButton displays button which enables to close tab with 
propertis manager 
-        */
-       private class CrossCloseButton extends JButton implements 
ActionListener {
-               private final static int CROSS_BUTTON_SIZE = 17;        /** 
size of the cross button */
-               private final static int DELTA = 6;                             
        /** size of the cross */
-               
-               /**
-                * Constructor of the class CrossCloseButton
-                */
-               public CrossCloseButton() {
-                       
-                       setPreferredSize(new Dimension(CROSS_BUTTON_SIZE, 
CROSS_BUTTON_SIZE));
-                       
-                       setUI(new BasicButtonUI());
-                       setContentAreaFilled(false);
-                       setBorder(BorderFactory.createEtchedBorder());
-                       setBorderPainted(false);
-                       setRolloverEnabled(true);
-                       addActionListener(this);
-               }
-
-               /**
-                * Makes properties manager invisible
-                * @param e action event
-                */
-               public void actionPerformed(ActionEvent e) {
-
-                       propertiesManagerTabbedPane.setVisible(false);
-                       
layoutsTabbedPane.getToolBar().getPropertiesManagerButton().setVisible(true);
-
-               }
-
-               /**
-                *  Paints the close cross
-                *  @param g graphics
-                */
-               protected void paintComponent(Graphics g) {
-                       super.paintComponent(g);
-                       Graphics2D g2 = (Graphics2D) g.create();
-                       g2.setStroke(new BasicStroke(2));
-                       g2.setColor(Color.BLACK);
-                       g2.drawLine(DELTA, DELTA, getWidth() - DELTA - 1, 
getHeight()
-                                       - DELTA - 1);
-                       g2.drawLine(getWidth() - DELTA - 1, DELTA, DELTA, 
getHeight()
-                                       - DELTA - 1);
-                       g2.dispose();
-               }
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesTable.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/PropertiesTable.java   
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/PropertiesTable.java
      2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,513 +0,0 @@
-package applet;
-
-import java.awt.Dimension;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import java.awt.event.KeyEvent;
-import java.text.NumberFormat;
-import java.util.Properties;
-import javax.swing.AbstractAction;
-import javax.swing.JFormattedTextField;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.KeyStroke;
-import javax.swing.text.DefaultFormatterFactory;
-import javax.swing.text.NumberFormatter;
-
-@SuppressWarnings("serial")
-public class PropertiesTable extends JPanel implements FocusListener {
-
-       // fields
-       private JLabel idLabel;
-       private JLabel widthLabel;
-       private JLabel heightLabel;
-       private JLabel topXLabel;
-       private JLabel topYLabel;
-       private JFormattedTextField idField;
-       private JFormattedTextField widthField;
-       private JFormattedTextField heightField;
-       private JFormattedTextField topXField;
-       private JFormattedTextField topYField;
-       private TabbedPane tabbedPane;
-
-       // constants
-       private final static int ROW = 5;
-       private final static int COL = 2;
-       private final static int WIDTH = 50;
-       private final static int HEIGHT = 10;
-
-       private int oldTopX;
-       private int oldTopY;
-       private int oldWidth;
-       private int oldHeight;
-       private int newTopX;
-       private int newTopY;
-       private int newWidth;
-       private int newHeight;
-
-       // constructors
-       /**
-        * Constructor of class DocumentPropertiesTable
-        * 
-        * @param tabbedPane
-        * @param propertiesTablePanel
-        */
-       public PropertiesTable(TabbedPane tabbedPane, JPanel 
propertiesTablePanel) {
-               super();
-
-               this.tabbedPane = tabbedPane;
-               Properties properties = tabbedPane.getProperties();
-
-               // initializes properties' label
-               idLabel = new 
JLabel(properties.getProperty("propertiesTable.ID"));
-               widthLabel = new 
JLabel(properties.getProperty("propertiesTable.width"));
-               heightLabel = new JLabel(properties
-                               .getProperty("propertiesTable.height"));
-               topXLabel = new 
JLabel(properties.getProperty("propertiesTable.topX"));
-               topYLabel = new 
JLabel(properties.getProperty("propertiesTable.topY"));
-
-               // initializes properties' text fields
-               idField = new JFormattedTextField();
-               idField.setFocusable(false);
-               idField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-               idField.setEditable(false);
-               widthField = new JFormattedTextField();
-               widthField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-               heightField = new JFormattedTextField();
-               heightField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-               topXField = new JFormattedTextField();
-               topXField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-               topYField = new JFormattedTextField();
-               topYField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-
-               // sets bounds for editable text fields
-               int maxWidth = 0;
-               int maxHeight = 0;
-               int minWidth = 0;
-               int minHeight = 0;
-
-               setFields(idField, 0, 0);
-               setFields(topXField, minWidth, maxWidth);
-               setFields(topYField, minHeight, maxHeight);
-               setFields(widthField, minWidth, maxWidth);
-               setFields(heightField, minHeight, maxHeight);
-
-               // sets propertiesTable layout
-               propertiesTablePanel.setLayout(new GridLayout(ROW, COL, 2, 0));
-               propertiesTablePanel.add(idLabel);
-               propertiesTablePanel.add(idField);
-
-               propertiesTablePanel.add(topXLabel);
-               propertiesTablePanel.add(topXField);
-
-               propertiesTablePanel.add(topYLabel);
-               propertiesTablePanel.add(topYField);
-
-               propertiesTablePanel.add(widthLabel);
-               propertiesTablePanel.add(widthField);
-
-               propertiesTablePanel.add(heightLabel);
-               propertiesTablePanel.add(heightField);
-
-               topXField.addFocusListener(this);
-               topYField.addFocusListener(this);
-               widthField.addFocusListener(this);
-               heightField.addFocusListener(this);
-               actualize();
-       }
-
-       // methods
-       /**
-        * Sets max and min bounds for editable text field and size of all text
-        * field
-        * 
-        * @param textField
-        * @param max
-        */
-       private void setFields(JFormattedTextField textField, int min, int max) 
{
-
-               if (textField.isEditable()) {
-                       int minimum = new Integer(min);
-                       int maximum = new Integer(max);
-
-                       NumberFormat integerFormat = 
NumberFormat.getIntegerInstance();
-                       NumberFormatter intFormatter = new 
NumberFormatter(integerFormat);
-                       intFormatter.setFormat(integerFormat);
-                       intFormatter.setMinimum(minimum);
-                       intFormatter.setMaximum(maximum);
-                       textField.setFormatterFactory(new 
DefaultFormatterFactory(
-                                       intFormatter));
-               }
-               textField.setPreferredSize(new Dimension(WIDTH, HEIGHT));
-
-       }
-
-       /**
-        * Decides if text field in properties table is focus owner
-        * 
-        * @returns if properties table text field is focus owner
-        */
-       public boolean isFocusOwner() {
-               return !tabbedPane.getActualDesignArea().isFocusOwner();
-               // if (idField.isFocusOwner() || widthField.isFocusOwner()
-               // || heightField.isFocusOwner() || topXField.isFocusOwner()
-               // || topYField.isFocusOwner()) {
-               // return true;
-               // }
-               // return false;
-       }
-
-       /**
-        * Actualizes values in properties table according to the actual layout 
and
-        * actual selected positions
-        */
-       public void actualize() {
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               // there is none actual design area
-               if (designArea == null) {
-                       idField.setValue(null);
-                       widthField.setValue(null);
-                       heightField.setValue(null);
-                       topXField.setValue(null);
-                       topYField.setValue(null);
-
-                       topXField.setEditable(false);
-                       topYField.setEditable(false);
-                       widthField.setEditable(false);
-                       heightField.setEditable(false);
-               } else {
-
-                       Positions selectedPositions = designArea.getMyLayout()
-                                       .getSelectedPositions();
-
-                       // selected positions are too small to be displayed
-                       if (selectedPositions.isTooSmall(tabbedPane)) {
-                               return;
-                       }
-
-                       // there aren't any selected positions
-                       if (selectedPositions.isEmpty()) {
-                               idField.setValue(null);
-                               widthField.setValue(null);
-                               heightField.setValue(null);
-                               topXField.setValue(null);
-                               topYField.setValue(null);
-                               topXField.setEditable(false);
-                               topYField.setEditable(false);
-                               widthField.setEditable(false);
-                               heightField.setEditable(false);
-                               return;
-                       }
-
-                       // displays values of properties for selected positions
-                       idField.setValue(new String(selectedPositions.getID()));
-                       topXField.setValue(new 
Integer(selectedPositions.getElvysTopX()));
-                       topYField.setValue(new 
Integer(selectedPositions.getElvysTopY()));
-                       newTopX = selectedPositions.getElvysTopX();
-                       newTopY = selectedPositions.getElvysTopY();
-                       oldTopX = selectedPositions.getElvysTopX();
-                       oldTopY = selectedPositions.getElvysTopY();
-
-                       // if more than one position is selected, width and 
height isn't
-                       // displayed
-                       if (selectedPositions.isNotOnlyOne()) {
-                               widthField.setValue(null);
-                               heightField.setValue(null);
-                               widthField.setEditable(false);
-                               heightField.setEditable(false);
-
-                       } else {
-                               topXField.setEditable(true);
-                               topYField.setEditable(true);
-                               widthField.setEditable(true);
-                               heightField.setEditable(true);
-                               widthField.setValue(new 
Integer(selectedPositions
-                                               .getElvysWidth()));
-                               newWidth = selectedPositions.getElvysWidth();
-                               oldWidth = selectedPositions.getElvysWidth();
-                               heightField.setValue(new 
Integer(selectedPositions
-                                               .getElvysHeight()));
-                               newHeight = selectedPositions.getElvysHeight();
-                               oldHeight = selectedPositions.getElvysHeight();
-                       }
-               }
-       }
-
-       /**
-        * Actualizes bounds for text fields and decides if they are editable
-        */
-       public void actualizeFields() {
-
-               int maxWidth = 0;
-               int maxHeight = 0;
-
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               if (designArea == null
-                               || 
designArea.getMyLayout().getSelectedPositions().isEmpty()) {
-                       topXField.setEditable(false);
-                       topYField.setEditable(false);
-                       widthField.setEditable(false);
-                       heightField.setEditable(false);
-               } else {
-                       if 
(!designArea.getMyLayout().getSelectedPositions().isEmpty()) {
-                               topXField.setEditable(true);
-                               topYField.setEditable(true);
-                               widthField.setEditable(true);
-                               heightField.setEditable(true);
-                       }
-
-                       maxWidth = 
designArea.getMyLayout().getScreenResolution()
-                                       .getElvysWidth();
-                       maxHeight = 
designArea.getMyLayout().getScreenResolution()
-                                       .getElvysHeight();
-
-                       Position pos = new Position();
-                       int minWidth = pos.getMinElvysWidth(designArea);
-                       int minHeight = pos.getMinElvysHeight(designArea);
-
-                       setFields(idField, 0, 0);
-                       setFields(topXField, 0, maxWidth);
-                       setFields(topYField, 0, maxHeight);
-                       setFields(widthField, minWidth, maxWidth);
-                       setFields(heightField, minHeight, maxHeight);
-
-                       // if more than one position is selected, width and 
height isn't
-                       // editable
-                       if 
(designArea.getMyLayout().getSelectedPositions().isNotOnlyOne()) {
-                               widthField.setEditable(false);
-                               heightField.setEditable(false);
-                       }
-
-               }
-
-               // adds change listener to text fields
-               addListener(idField);
-               addListener(topXField);
-               addListener(topYField);
-               addListener(widthField);
-               addListener(heightField);
-
-       }
-
-       /**
-        * Decides type of change - if position should be resized or moved
-        * 
-        * @param oldTopX
-        * @param oldTopY
-        * @param oldWidth
-        * @param oldHeight
-        * @param newTopX
-        * @param newTopY
-        * @param newWidth
-        * @param newHeight
-        * @return
-        */
-       protected Layout.AddType decideTypeOfChange(int oldTopX, int oldTopY,
-                       int oldWidth, int oldHeight, int newTopX, int newTopY,
-                       int newWidth, int newHeight) {
-               if (oldTopX != newTopX || oldTopY != newTopY) {
-                       return Layout.AddType.MOVE;
-               } else {
-                       return Layout.AddType.RESIZE;
-               }
-       }
-
-       /**
-        * Changes properties of selected positions in the actual layout 
according
-        * to the given new values
-        * 
-        * @param oldTopX
-        * @param oldTopY
-        * @param oldWidth
-        * @param oldHeight
-        */
-       protected void changeSelectedPositionsProperties(int oldTopX, int 
oldTopY,
-                       int oldWidth, int oldHeight) {
-
-               // if(!isChange) {
-               // return;
-               // }
-
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               // gets new values of properties
-               int newTopX = Integer.valueOf(topXField.getValue().toString());
-               int newTopY = Integer.valueOf(topYField.getValue().toString());
-               
-               int newWidth = oldWidth;
-               int newHeight = oldHeight;
-               if(widthField.isEditable()) {
-                       newWidth = 
Integer.valueOf(widthField.getValue().toString());
-                       newHeight = 
Integer.valueOf(heightField.getValue().toString());
-               }
-
-               // decides type of change, if selected positions should be 
moved or
-               // resized
-               Layout.AddType type = decideTypeOfChange(oldTopX, oldTopY, 
oldWidth,
-                               oldHeight, newTopX, newTopY, newWidth, 
newHeight);
-
-               
designArea.getMyLayout().moveOrResizePositionsWithPropertiesTable(
-                               designArea, newTopX - oldTopX, newTopY - 
oldTopY,
-                               newWidth - oldWidth, newHeight - oldHeight, 
type);
-
-               // if (designArea.isSnapToGridEnabled()) {
-               // designArea.getThisDesignAreaLayout().getLayoutPositions()
-               // .snapToGrid(designArea);
-               // }
-
-               designArea.repaint();
-
-               // sets new properties values
-
-               Positions positions = 
designArea.getMyLayout().getSelectedPositions();
-
-               if (positions.size() == 1) {
-
-                       topXField.setValue(new 
Integer(positions.getElvysTopX()));
-                       topYField.setValue(new 
Integer(positions.getElvysTopY()));
-                       widthField.setValue(new 
Integer(positions.getElvysWidth()));
-                       heightField.setValue(new 
Integer(positions.getElvysHeight()));
-               }
-       }
-
-       protected void changeSelectedPositionsProperties() {
-
-               // if(!isChange) {
-               // return;
-               // }
-
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               // decides type of change, if selected positions should be 
moved or
-               // resized
-               Layout.AddType type = decideTypeOfChange(oldTopX, oldTopY, 
oldWidth,
-                               oldHeight, newTopX, newTopY, newWidth, 
newHeight);
-
-               
designArea.getMyLayout().moveOrResizePositionsWithPropertiesTable(
-                               designArea, newTopX - oldTopX, newTopY - 
oldTopY,
-                               newWidth - oldWidth, newHeight - oldHeight, 
type);
-
-               // if (designArea.isSnapToGridEnabled()) {
-               // designArea.getThisDesignAreaLayout().getLayoutPositions()
-               // .snapToGrid(designArea);
-               // }
-
-               designArea.repaint();
-
-               // sets new properties values
-               Positions positions = 
designArea.getMyLayout().getSelectedPositions();
-               if (positions.size() == 1) {
-                       topXField.setValue(new 
Integer(positions.getElvysTopX()));
-                       topYField.setValue(new 
Integer(positions.getElvysTopY()));
-                       widthField.setValue(new 
Integer(positions.getElvysWidth()));
-                       heightField.setValue(new 
Integer(positions.getElvysHeight()));
-               }
-       }
-
-       /**
-        * Adds change listener to text field
-        * 
-        * @param textField
-        */
-       protected void addListener(final JFormattedTextField textField) {
-
-               textField.setHorizontalAlignment(JTextField.TRAILING);
-               textField.setFocusLostBehavior(JFormattedTextField.REVERT);
-
-               if (!textField.isEditable()) {
-                       return;
-               }
-
-               textField.getInputMap().put(
-                               KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), 
"check");
-               textField.getActionMap().put("check", new AbstractAction() {
-                       public void actionPerformed(ActionEvent e) {
-                               if (!textField.isEditValid()) {
-                                       
textField.setValue(textField.getValue());
-                                       textField.postActionEvent();
-                               } else
-                                       try {
-                                               oldTopX = 
Integer.valueOf(topXField.getValue()
-                                                               .toString());
-                                               oldTopY = 
Integer.valueOf(topYField.getValue()
-                                                               .toString());
-                                               
-                                               if(widthField.isEditable()) {
-                                                       oldWidth = 
Integer.valueOf(widthField.getValue()
-                                                               .toString());
-                                                       oldHeight = 
Integer.valueOf(heightField.getValue()
-                                                               .toString());
-                                               }
-
-                                               textField.commitEdit();
-                                               textField.postActionEvent();
-
-                                               
changeSelectedPositionsProperties(oldTopX, oldTopY,
-                                                               oldWidth, 
oldHeight);
-
-                                       } catch (java.text.ParseException exc) {
-                                       }
-                       }
-               });
-       }
-
-       @Override
-       public void focusGained(FocusEvent e) {
-
-               changeSelectedPositionsProperties();
-
-       }
-
-       @Override
-       public void focusLost(FocusEvent e) {
-               JFormattedTextField textField = null;
-
-               if (e.getSource().equals(topXField)) {
-                       textField = topXField;
-               }
-
-               if (e.getSource().equals(topYField)) {
-                       textField = topYField;
-               }
-
-               if (e.getSource().equals(widthField)) {
-                       textField = widthField;
-               }
-
-               if (e.getSource().equals(heightField)) {
-                       textField = heightField;
-               }
-
-               if (!textField.isEditValid()) {
-                       textField.setValue(textField.getValue());
-               } else
-                       try {
-                               if(widthField.isEditable()) {
-                                       oldTopX = 
Integer.valueOf(topXField.getValue().toString());
-                                       oldTopY = 
Integer.valueOf(topYField.getValue().toString());     
-                                       oldWidth = 
Integer.valueOf(widthField.getValue().toString());
-                                       oldHeight = 
Integer.valueOf(heightField.getValue().toString());
-                               }
-
-                               textField.commitEdit();
-
-                               if(widthField.isEditable()) {
-                                       newTopX = 
Integer.valueOf(topXField.getValue().toString());
-                                       newTopY = 
Integer.valueOf(topYField.getValue().toString());     
-                                       newWidth = 
Integer.valueOf(widthField.getValue().toString());
-                                       newHeight = 
Integer.valueOf(heightField.getValue().toString());
-                               }
-
-                               // changeSelectedPositionsProperties(oldTopX, 
oldTopY,
-                               // oldWidth, oldHeight);
-
-                       } catch (java.text.ParseException exc) {
-                       }
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ReadLayoutFromServer.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java      
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ReadLayoutFromServer.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,228 +0,0 @@
-package applet;
-
-import java.util.Collections;
-import java.util.Vector;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.xml.parsers.*;
-import org.w3c.dom.*;
-import java.io.*;
-
-/**
- * ReadLayoutFromServer.java
- * @author Eva Viktorinova
- *
- */
-/**
- * @class ReadLayoutFromServer
- * Reads layout from the server
- */
-public class ReadLayoutFromServer {
-       
-       private TabbedPane tabbedPane;                                          
        /** main tabbed pane */
-       private SupportedResolutions supportedAspectRatios;             /** 
supported aspect ratios */
-       private Vector<String> allTypesOfDocuments;                     /** all 
permitted types of documents */
-
-       /**
-        * Constructor of the class ReadLayoutFromServer
-        * @param tabbedPane tabbed pane to set
-        * @param supportedAspectRatios supported ratios to set
-        * @param allTypesOfDocuments all types of documents to set
-        */
-       public ReadLayoutFromServer(TabbedPane tabbedPane,
-                       SupportedResolutions supportedAspectRatios,
-                       Vector<String> allTypesOfDocuments) {
-               this.tabbedPane = tabbedPane;
-               this.supportedAspectRatios = supportedAspectRatios;
-               this.allTypesOfDocuments = allTypesOfDocuments;
-       }
-
-
-       /**
-        * Parses layout from the string which has come from server. Displays 
resolution choice dialog when aspect ratio is read
-        * @param layoutXmlString string with xml from server which represents 
layout
-        * @return layout layout
-        */
-       public Layout readLayout(String layoutXmlString) {
-
-               Layout layout = new Layout();
-
-               //layoutXmlString = "<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?><l:layout id="32" revision="0" name="?ulina" 
xmlns:l="cz/elvys/jaxbgen/layout"> <aspect-ratio aspect-ratio="1.77778"/> <doc 
id="3"> <rect x="0.552083333333333" w="0.286979166666667" h="0.211111111111111" 
y="0.15462962962963"/> <doc_type>text</doc_type> <doc_type>dynamic</doc_type> 
</doc> <doc id="2"> <rect x="0.403645833333333" w="0.130208333333333" 
h="0.537962962962963" y="0.291666666666667"/> <doc_type>document</doc_type> 
<doc_type>url</doc_type> </doc> <doc id="1"> <rect x="0.06875" 
w="0.181770833333333" h="0.537962962962963" y="0.0981481481481482"/> 
<doc_type>document</doc_type> <doc_type>dynamic</doc_type> </doc></l:layout>";
-               System.out.println(layoutXmlString);
-               
-               Positions layoutPositions = new Positions(layout);
-
-               boolean layoutIsNew = true;
-               int layoutRevision = 0;
-               int layoutID = 0;
-               double layoutAspectRatio = 0;
-               String layoutName = "";
-
-               if (tabbedPane == null || tabbedPane.getProperties() == null || 
supportedAspectRatios == null) {
-                       return null;
-               }
-               ScreenResolution screenResolution = new ScreenResolution();
-
-               try {
-                       DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
-                       DocumentBuilder db = dbf.newDocumentBuilder();
-                       InputSource is = new InputSource();
-                       is.setCharacterStream(new 
StringReader(layoutXmlString));
-
-                       Document doc = db.parse(is);
-                       
-                       
-                       Node rootNode = doc.getDocumentElement();
-                       String rootNodeName = rootNode.getNodeName();
-                       if (!rootNodeName.equals("l:layout")) {
-                               throw new 
Exception(tabbedPane.getProperties().getProperty("error.xml"));
-                       }
-
-                       // parses atributes of <layout>
-                       NamedNodeMap layoutNodeAttributes = 
rootNode.getAttributes();
-                       for (int i = 0; i < layoutNodeAttributes.getLength(); 
++i) {
-                               Node attribute = layoutNodeAttributes.item(i);
-
-                               if (attribute.getNodeName().equals("id")) {
-                                       layoutIsNew = false;
-                                       String nodeValue = 
attribute.getNodeValue();
-                                       layoutID = Integer.valueOf(nodeValue);
-                               }
-
-                               if (attribute.getNodeName().equals("revision")) 
{
-                                       String nodeValue = 
attribute.getNodeValue();
-                                       layoutRevision = 
Integer.valueOf(nodeValue);
-                               }
-
-                               if (attribute.getNodeName().equals("name")) {
-                                       String nodeValue = 
attribute.getNodeValue();
-                                       layoutName = nodeValue;
-                               }
-                       }
-
-                       NodeList layoutNodeList = rootNode.getChildNodes();
-                       for (int i = 0; i < layoutNodeList.getLength(); ++i) {
-                               Node layoutNode = layoutNodeList.item(i);
-
-                               if 
(layoutNode.getNodeName().equals("aspect-ratio")) {
-                                       Node aspectRatioNode = 
layoutNode.getAttributes()
-                                                       
.getNamedItem("aspect-ratio");
-                                       layoutAspectRatio = 
Double.valueOf(aspectRatioNode
-                                                       .getNodeValue());
-
-                                       SupportedResolutions resolutions = 
supportedAspectRatios.getResolutionsWithAspectRatio(layoutAspectRatio);
-                                       ResolutionChoiceDialog 
resolutionChoiceDialog = new ResolutionChoiceDialog(
-                                                       new JDialog(), 
tabbedPane.getProperties(),
-                                                       resolutions, 
tabbedPane.getRootPane());
-                                       
-                                       if(resolutions == null) {
-                                               
LayoutDesigner.getInstance().closeLayoutDesignerBrowserWindow();
-                                       }
-
-                                       screenResolution = 
resolutionChoiceDialog
-                                                       
.showResolutionChoiceDialog();
-                                       
layout.setScreenResolution(screenResolution);
-                               }
-
-                               if (layoutNode.getNodeName().equals("doc")) {
-
-                                       Position document = new 
Position(tabbedPane);
-                                       Node idAttribute = 
layoutNode.getAttributes().getNamedItem(
-                                                       "id");
-                                       
document.setId(Integer.valueOf(idAttribute.getNodeValue()));
-                                       Vector<String> doc_types = new 
Vector<String>();
-
-                                       NodeList docNodeList = 
layoutNode.getChildNodes();
-
-                                       String x = "0";
-                                       String y = "0";
-                                       String w = "0";
-                                       String h = "0";
-                                       for (int j = 0; j < 
docNodeList.getLength(); ++j) {
-                                               Node docNode = 
docNodeList.item(j);
-
-                                               if 
(docNode.getNodeName().equals("rect")) {
-                                                       NamedNodeMap 
rectAttributes = docNode
-                                                                       
.getAttributes();
-                                                       for (int l = 0; l < 
rectAttributes.getLength(); ++l) {
-                                                               Node attribute 
= rectAttributes.item(l);
-
-                                                               if 
(attribute.getNodeName().equals("x")) {
-                                                                       x = 
attribute.getNodeValue();
-                                                               }
-
-                                                               if 
(attribute.getNodeName().equals("y")) {
-                                                                       y = 
attribute.getNodeValue();
-                                                               }
-
-                                                               if 
(attribute.getNodeName().equals("w")) {
-                                                                       w = 
attribute.getNodeValue();
-                                                               }
-
-                                                               if 
(attribute.getNodeName().equals("h")) {
-                                                                       h = 
attribute.getNodeValue();
-                                                               }
-
-                                                       }
-
-                                               }
-
-                                               if 
(docNode.getNodeName().equals("doc_type")) {
-                                                       
doc_types.add(docNode.getTextContent());
-                                               }
-
-                                       }
-
-                                       double relHeight = Double.valueOf(h);
-                                       double relWidth = Double.valueOf(w);
-                                       double relTopX = Double.valueOf(x);
-                                       double relTopY = Double.valueOf(y);
-
-                                       RelativeCoordinates relativeCoordinates 
= new RelativeCoordinates(
-                                                       relTopX, relTopY, 
relWidth, relHeight);
-
-                                       
document.setElvysFromRelative(relativeCoordinates,
-                                                       screenResolution);
-                                       
document.setMonitorFromRelative(relativeCoordinates,
-                                                       screenResolution);
-
-                                       
-                                       PermittedDocumentTypes 
permittedDocumentTypes = new PermittedDocumentTypes();
-                                       
permittedDocumentTypes.setAllDocumentTypes(allTypesOfDocuments);
-                                       
-                                       System.out.println(doc_types);
-                                       for (int k = 0; k < doc_types.size(); 
++k) {
-                                               permittedDocumentTypes
-                                                               
.addPermittedDocumentType(doc_types.get(k));
-                                       }
-                                       
permittedDocumentTypes.setIsPermittedAll();
-
-                                       
document.setPermittedDocumentTypes(permittedDocumentTypes);
-
-                                       layoutPositions.addPosition(document);
-
-                               }
-                       }
-
-               } catch (Exception e) {
-                       e.printStackTrace();
-                       new WarningDialog(new JFrame(), 
tabbedPane.getProperties().getProperty("error.layoutReading"), 
tabbedPane.getProperties().getProperty("warning.warning"));
-               }
-
-               layout.setName(layoutName);
-               layout.setIsNew(layoutIsNew);
-               layout.setRevision(layoutRevision);
-               layout.setId(layoutID);
-               layoutPositions.sortID();
-               layout.setLayoutPositions(layoutPositions);
-
-               layout.setLayoutAspectRatio(layoutAspectRatio);
-               layout.setScreenResolution(screenResolution);
-               System.out.println("layoutID: " + layoutID + " layoutRevision: 
" + layoutRevision);
-
-               return layout;
-
-       }
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/RelativeCoordinates.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/RelativeCoordinates.java       
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/RelativeCoordinates.java
  2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 /**
  * RelativeCoordinates.java

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ResolutionChoiceDialog.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ResolutionChoiceDialog.java    
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ResolutionChoiceDialog.java
       2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,233 +0,0 @@
-package applet;
-/**
- * ResolutionChoiceDialog.java
- * @author Eva Viktorinova
- */
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Properties;
-import java.util.Vector;
-
-import javax.swing.DefaultComboBoxModel;
-import javax.swing.JComboBox;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-
-/**
- * @class ResolutionChoiceDialog
- * Resolution choice dialog allows choosing of resolution for opened layout
- */
-@SuppressWarnings("serial")
-public class ResolutionChoiceDialog extends JDialog implements ActionListener,
-               PropertyChangeListener {
-       // fields
-       private JComboBox resolutionList;               /** combo box with list 
of resolutions */ 
-       private int kioskWidth = 0;                             /** chosen 
width of kiosk */
-       private int kioskHeight = 0;                    /** chosen height of 
kiosk */
-       private boolean isNotSet = false;               /** flag whatever 
resolution was chosen */
-       private SupportedResolutions supportedResolutions;              /** 
supported resolutions */
-       private JOptionPane optionPane;                 /** option pane */
-       private String okButtonName;                    /** name of the button 
which confirms dialog choice */
-       private String cancelButtonName;                /** name of the button 
which cancels dialog choice */
-       private ResolutionChoiceDialog resolutionChoiceDialog;  /** this 
resolution choice dialog */
-       private JRootPane rootPane;                             /** root pane 
of the design area */
-       private JDialog dialog;                                 /** parent 
dialog where resolution choice dialog is shown */
-
-       
-       // classes
-       /**
-        * @class ResolutionListItem
-        * Represents item displayed in combo box 
-        */
-       private class ResolutionListItem {
-               private String itemName;        /** name of the item in 
resolution list */ 
-               private int kioskWidth;         /** width of kiosk */
-               private int kioskHeight;        /** height of kiosk */
-               
-               /**
-                * Constructor of the class ResolutionListItem
-                * @param itemName item name to set
-                * @param kioskWidth width of kiosk to set
-                * @param kiskHeight height of kiosk to set
-                */
-               public ResolutionListItem(String itemName, int kioskWidth, int 
kioskHeight) {
-                       this.itemName = itemName;
-                       this.kioskWidth = kioskWidth;
-                       this.kioskHeight = kioskHeight;
-               }
-               
-               /**
-                * Gets name of item
-                */
-               public String toString() {
-                       return itemName;
-               }
-       }
-       
-       /**
-        * Prepares resolution list displayed in combo box
-        * @return items for resolution list
-        */
-       private Vector<ResolutionListItem> prepareResolutionList() {
-               
-               Vector<ResolutionListItem> resolutionList = new 
Vector<ResolutionListItem>();
-               for (int i = 0; i < supportedResolutions.size(); ++i) {
-                       Vector<String> resolutionsString = 
supportedResolutions.get(i).getResolutionsString();
-                       Vector<ScreenResolution> resolutions = 
supportedResolutions.get(i).getResolutions();
-                       String basicResolution = 
supportedResolutions.get(i).getBasicResolution();
-                       for (int j = 0; j < resolutionsString.size(); ++j) {
-                               String itemName = resolutionsString.get(j) + " 
(" + basicResolution + ")";
-                               ResolutionListItem item = new 
ResolutionListItem(itemName, resolutions.get(j).getElvysWidth(), 
resolutions.get(j).getElvysHeight());
-                               resolutionList.add(item);
-                       }
-               }
-               
-               if(resolutionList.isEmpty()) {
-                       resolutionList.add(new ResolutionListItem("16x9: 
1600x900", 1600, 900));
-                       resolutionList.add(new ResolutionListItem("12x9: 
1200x900", 1200, 900));
-               }
-               return resolutionList;
-       }
-       
-       /**
-        * Shows resolution choice dialog and sets resolution of the screens
-        * @return screen resolution chosen in dialog
-        */
-       public ScreenResolution showResolutionChoiceDialog() {
-               
-               dialog.pack();
-               dialog.setLocationRelativeTo(rootPane);
-               resolutionChoiceDialog.pack();
-               resolutionChoiceDialog.setLocationRelativeTo(rootPane);
-               resolutionChoiceDialog.setVisible(true);
-
-               if (resolutionChoiceDialog.isNotSet()) {
-                       return null;
-               }
-
-               return new ScreenResolution(resolutionChoiceDialog
-                               .getKioskWidth(), 
resolutionChoiceDialog.getKioskHeight());
-
-       }
-
-       /**
-        * Constructor of the class ResolutionChoiceDialog. Initializes 
ResolutionChoiceDialog components.
-        * @param dialog parent dialog to set
-        * @param properties properties to set
-        * @param supportedResolution supported resolutions to set
-        */
-       public ResolutionChoiceDialog(JDialog dialog, Properties properties,
-                       SupportedResolutions supportedResolution, JRootPane 
rootPane) {
-               super(dialog, 
properties.getProperty("dialog.resolutionChoice"), true);
-               this.resolutionChoiceDialog = this;
-               this.supportedResolutions = supportedResolution;
-               this.dialog = dialog;
-               this.rootPane = rootPane;
-               
-
-               // create an array of the components to be displayed
-               resolutionList = new JComboBox();
-               Vector<ResolutionListItem> ratioStrings = 
prepareResolutionList();
-               resolutionList.setModel(new DefaultComboBoxModel(ratioStrings));
-               
-               resolutionList.setSelectedIndex(0);
-               Object[] array = { resolutionList };
-
-               // create an array specifying the number of dialog buttons and 
their text
-               okButtonName = properties.getProperty("dialog.OK");
-               cancelButtonName = properties.getProperty("dialog.cancel");
-               Object[] options = { okButtonName, cancelButtonName };
-
-
-               optionPane = new JOptionPane(array, 
JOptionPane.QUESTION_MESSAGE,
-                               JOptionPane.YES_NO_OPTION, null, options, 
options[0]);
-
-
-               setContentPane(optionPane);
-
-               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-               addWindowListener(new WindowAdapter() {
-                       public void windowClosing(WindowEvent we) {
-                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
-                       }
-               });
-
-               resolutionList.addActionListener(this);
-               optionPane.addPropertyChangeListener(this);
-       }
-
-       /** 
-        * Handles events for the resolution list
-        */
-       public void actionPerformed(ActionEvent e) {
-               optionPane.setValue(okButtonName);
-       }
-
-
-       /** 
-        * Reacts to the change of state in the option pane. 
-        */
-       public void propertyChange(PropertyChangeEvent e) {
-               String prop = e.getPropertyName();
-
-               if (isVisible()
-                               && (e.getSource() == optionPane)
-                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
-                                               .equals(prop))) {
-                       Object value = optionPane.getValue();
-
-                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
-                               return;
-                       }
-
-                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
-
-                       if (okButtonName.equals(value)) {
-                               ResolutionListItem selectedItem = 
(ResolutionListItem) resolutionList.getSelectedItem();
-                               isNotSet = false;
-                               
-                               kioskWidth = selectedItem.kioskWidth;
-                               kioskHeight = selectedItem.kioskHeight;
-
-                               setVisible(false);
-                       } else {
-                               
-                               isNotSet = true;
-                               kioskWidth = 0;
-                               kioskHeight = 0;
-                               setVisible(false);
-                       }
-               }
-       }
-
-       // getters & setters
-
-       /**
-        * Getter of the field kioskWidth
-        * @return the kioskWidth
-        */
-       public int getKioskWidth() {
-               return kioskWidth;
-       }
-
-       /**
-        * Getter of the field kioskHeight
-        * @return the kioskHeight
-        */
-       public int getKioskHeight() {
-               return kioskHeight;
-       }
-       
-       /**
-        * Getter of the fiels isNotSet
-        * @return the isNotSet
-        */
-       public boolean isNotSet() {
-               return isNotSet;
-       }
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveAsDialog.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/SaveAsDialog.java      
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveAsDialog.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,156 +0,0 @@
-package applet;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Properties;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-import javax.swing.JTextField;
-
-/**
- * SaveAsDialog.java
- * @author EvaV
- * 
- */
-
-/**
- * @class SaveAsDialog
- * Shows dialog where user can choose name of the layout under which layout is 
saved 
- */
-@SuppressWarnings("serial")
-public class SaveAsDialog extends JDialog implements ActionListener,
-               PropertyChangeListener {
-
-       // fields
-       private JOptionPane optionPane;                                 /** 
option pane */
-       private JTextField layoutNameTextField;                 /** text field 
where layout name is typed */
-       private String typedText = null;                                /** 
text typed in text field */
-       private String okButtonName = "Enter";                  /** name of the 
button which confirms dialog choice */ 
-       private String cancelButtonName = "Cancel";             /** name of the 
button which cancels dialog choice */
-       private SaveAsDialog saveAsDialog;                              /** 
this save as dialog */
-       private JDialog dialog;                                                 
/** parent dialog where this dialog is displayed */
-       private JRootPane rootPane;                                             
/** root pane of the LayoutDesigner */
-
-       // constants
-       private final static int MAX_LAYOUT_NAME_LENGHT = 100;          /** max 
length of the layout name */ 
-       private final static String INVALID_TEXT = "";                          
/** empty text is invalid */
-
-       /**
-        * Constructor of class SaveAsDialog. Initializes SaveAsDialog
-        * 
-        * @param dialog parent dialog where this dialog is displayed
-        * @param properties properties
-        * @param rootPane root pane of the LayoutDesigner
-        */
-       public SaveAsDialog(JDialog dialog, Properties properties,
-                       JRootPane rootPane, String layoutName) {
-               super(dialog, properties.getProperty("dialog.saveAs"), true);
-
-               this.saveAsDialog = this;
-               this.rootPane = rootPane;
-               this.dialog = dialog;
-
-               // creates an array with dialog message and text field for 
layout name
-               layoutNameTextField = new JTextField(MAX_LAYOUT_NAME_LENGHT);
-               layoutNameTextField.setText(layoutName);
-               String dialogMessage = 
properties.getProperty("dialog.insertName");
-               Object[] array = { dialogMessage, layoutNameTextField };
-
-               // create an array specifying the number of dialog buttons and 
their
-               // text
-               okButtonName = properties.getProperty("dialog.OK");
-               cancelButtonName = properties.getProperty("dialog.cancel");
-               Object[] options = { okButtonName, cancelButtonName };
-
-               optionPane = new JOptionPane(array, 
JOptionPane.QUESTION_MESSAGE,
-                               JOptionPane.YES_NO_OPTION, null, options, 
options[0]);
-
-               setContentPane(optionPane);
-
-               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-               addWindowListener(new WindowAdapter() {
-                       public void windowClosing(WindowEvent we) {
-                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
-                       }
-               });
-
-               // ensures the text field always gets the first focus
-               addComponentListener(new ComponentAdapter() {
-                       public void componentShown(ComponentEvent ce) {
-                               layoutNameTextField.requestFocusInWindow();
-                       }
-               });
-
-               layoutNameTextField.addActionListener(this);
-               optionPane.addPropertyChangeListener(this);
-
-       }
-
-       /**
-        * Handles events for the text field
-        * 
-        * @param e action event
-        */
-       public void actionPerformed(ActionEvent e) {
-               optionPane.setValue(okButtonName);
-       }
-
-       /**
-        * Shows saveAsDialog and sets new layout name
-        * @return new layout name
-        */
-       public String showSaveAsDialog() {
-               dialog.setLocationRelativeTo(rootPane);
-               dialog.pack();
-               saveAsDialog.pack();
-               saveAsDialog.setLocationRelativeTo(rootPane);
-               saveAsDialog.setVisible(true);
-
-               String newLayoutName = saveAsDialog.typedText;
-               return newLayoutName;
-       }
-
-       /**
-        * Reacts to state changes in the option pane
-        * @param e property change event
-        */
-       public void propertyChange(PropertyChangeEvent e) {
-               String prop = e.getPropertyName();
-
-               if (isVisible()
-                               && (e.getSource() == optionPane)
-                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
-                                               .equals(prop))) {
-                       Object value = optionPane.getValue();
-
-                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
-                               return;
-                       }
-
-                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
-
-                       if (okButtonName.equals(value)) {
-                               typedText = layoutNameTextField.getText();
-
-                               if (!typedText.equals(INVALID_TEXT)) {
-                                       setVisible(false);
-                               } else {
-                                       typedText = null;
-                                       setVisible(false);
-                               }
-                       } else {
-                               typedText = null;
-                               setVisible(false);
-                       }
-               }
-       }
-
-
-}
\ No newline at end of file

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveLayoutOnServer.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/SaveLayoutOnServer.java        
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SaveLayoutOnServer.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,177 +0,0 @@
-package applet;
-
-import java.util.Properties;
-
-import javax.swing.JFrame;
-
-/**
- * SaveLayoutOnServer.java
- * @author Eva Viktorinova
- */
-
-/**
- * @class SaveLayoutOnServer Saves layout on server
- */
-public class SaveLayoutOnServer {
-
-       private TabbedPane tabbedPane;
-
-       /** main tabbed pane */
-
-       /**
-        * Constructor of the class SaveLayoutOnServer
-        * 
-        * @param tabbedPane
-        *            tabbed pane to set
-        */
-       public SaveLayoutOnServer(TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-       /**
-        * Saves layout on the server for the actual design area
-        * 
-        * @param oldLayoutName
-        *            old name of the layout
-        * @param newLayoutName
-        *            new name of the layout
-        */
-       public void saveLayout(String oldLayoutName, String newLayoutName) {
-
-               if (tabbedPane == null || tabbedPane.getProperties() == null
-                               || tabbedPane.getActualDesignArea() == null) {
-                       return;
-               }
-
-               Properties properties = tabbedPane.getProperties();
-               DesignArea designArea = tabbedPane.getActualDesignArea();
-
-               Layout layout = designArea.getMyLayout();
-               System.out.println(layout.getId());
-               System.out.println(layout.getRevision());
-
-               try {
-
-                       // increasing revision number
-                       int layoutRevision = layout.getRevision();
-                       ++layoutRevision;
-
-                       // renames layout in tabbedPane
-
-                       TabbedPaneCloseTabButton buttonTab = 
(TabbedPaneCloseTabButton) tabbedPane
-                                       
.getTabComponentAt(tabbedPane.getSelectedIndex());
-                       buttonTab.setNewTabTitle(newLayoutName);
-
-                       tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(), 
newLayoutName);
-
-                       if (layout.isChangedPositionCount()) {
-                               System.out.println("changed position count");
-                               layout.setIsNew(true);
-                               ServerSideContext.getInstance().unlockLayout();
-                       }
-
-                       // this layout has never been saved on server
-                       if (layout.isNew()) {
-                               System.out.println("saved new layout");
-                               layout.setName(newLayoutName);
-                               String xml = new 
Marshaller().marshallLayoutToString(layout);
-                               System.out.println(xml);
-                               int layoutID = 
ServerSideContext.getInstance().storeLayout(xml);
-
-                               designArea.setSaved(true);
-
-                               layout.setId(layoutID);
-                               layout.setIsNew(false);
-                               layout.setRevision(0);
-                               layout.setIsChangedPositionCount(false);
-                               layout.setInformedThatIsEditing(false);
-                               
ServerSideContext.getInstance().setLayoutID(layoutID);
-                       } else {
-                               // saves old layout under new name
-                               if (oldLayoutName.compareTo(newLayoutName) != 
0) {
-                                       
-                                       
-                                       
-                                       System.out.println("old layout saved 
under new name");
-                                       layout.setName(newLayoutName);
-                                       layout.setIsNew(true);
-                                       layout.setRevision(0);
-                                       String xml = new Marshaller()
-                                                       
.marshallLayoutToString(layout);
-                                       int layoutID = 
ServerSideContext.getInstance()
-                                                       .storeLayout(
-                                                                       xml);
-                                       System.out.println(xml);
-                                       layout.setId(layoutID);
-                                       layout.setIsNew(false);
-                                       layout.setRevision(0);
-                                       layout.setIsChangedPositionCount(false);
-                                       layout.setInformedThatIsEditing(false);
-                                       designArea.setSaved(true);
-                                       
ServerSideContext.getInstance().unlockLayout();
-                                       
ServerSideContext.getInstance().setLayoutID(layoutID);
-                               }
-                               // saves already saved layout
-                               else {
-                                       boolean isLockedByMe = 
ServerSideContext.getInstance().isLayoutLockedByMe(null);
-                                       
-                                       if(isLockedByMe) {
-                                               System.out.println("layout 
saved");
-
-                                               
layout.setRevision(layoutRevision);
-                                               
System.out.println(layout.getId());
-                                               
System.out.println(layout.getRevision());
-                                               String xml = new Marshaller()
-                                                       
.marshallLayoutToString(layout);
-                                               
ServerSideContext.getInstance().storeLayout(xml);
-                                               System.out.println(xml);
-                                               designArea.setSaved(true);
-                                       }
-                                       else {
-                                               layout.setName(newLayoutName);
-                                               layout.setIsNew(true);
-                                               String xml = new Marshaller()
-                                                               
.marshallLayoutToString(layout);
-                                               int layoutID = 
ServerSideContext.getInstance()
-                                                               .storeLayout(
-                                                                               
xml);
-                                               System.out.println(xml);
-                                               layout.setId(layoutID);
-                                               layout.setIsNew(false);
-                                               layout.setRevision(0);
-                                               
layout.setIsChangedPositionCount(false);
-                                               
layout.setInformedThatIsEditing(false);
-                                               designArea.setSaved(true);
-
-                                               
ServerSideContext.getInstance().unlockLayout();
-                                               
ServerSideContext.getInstance().setLayoutID(layoutID);
-                                               
-                                               new WarningDialog(new JFrame(), 
properties
-                                                               
.getProperty("warning.isNotLocked"), properties
-                                                               
.getProperty("warning.warning"));
-                                               
-                                       }
-
-                               }
-                       }
-
-                       ServerSideContext.getInstance().setLayout(layout);
-                       ServerSideContext.getInstance().setLocked(true);
-                       
ServerSideContext.getInstance().setLayoutID(layout.getId());
-                       System.out.println(layout.getId());
-                       System.out.println(layout.getRevision());
-
-               } catch (Exception e) {
-                       if (tabbedPane.getSelectedIndex() != 0) {
-                               
tabbedPane.setTitleAt(tabbedPane.getSelectedIndex(),
-                                               oldLayoutName);
-                       }
-
-                       new WarningDialog(new JFrame(), properties
-                                       .getProperty("warning.saveError"), 
properties
-                                       .getProperty("warning.warning"));
-                       return;
-               }
-
-       }
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ScreenResolution.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ScreenResolution.java  
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ScreenResolution.java
     2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,11 +1,11 @@
-package applet;
+package com.elvys.applet.structures;
 
 /**
  * ScreenResolution.java
  * 
  * @author Eva Viktorinova
  */
-class ScreenResolution implements Cloneable {
+public class ScreenResolution implements Cloneable {
        
        // constants
        private final static int MAX_SIZE = 600;                /** maximal 
width or height of the monitor */

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ServerSideContext.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ServerSideContext.java 
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ServerSideContext.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,640 +0,0 @@
-package applet;
-
-import java.applet.Applet;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.StringReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.Vector;
-
-public class ServerSideContext {
-       // fields
-       private Integer companyID;                              /** id of 
company */
-       private Integer layoutID;                               /** id of 
layout */
-       private Integer userID;                                 /** id of user 
*/
-       private Vector<String> permittedDocumentTypes;          /** permitted 
document types for this company */
-       private SupportedResolutions supportedResolutions;      /** supported 
resolutions for this company */
-       private String host;                                                    
        /** host */
-       private static Charset charset = null;                          /** 
char set */
-       private Layout layout;                                                  
        /** opened layout - create new or edit */
-       private boolean isLocked;                                               
        /** flag whatever this layout is locked during opening */
-       private boolean isLockedByMe;                                           
/** flag whatever this layout is locked during saving */
-       private String lockedUser;                              /** name of 
user who has locked this layout */ 
-
-       // singleton variable
-       private static ServerSideContext instance;                      /** 
instance of this class */
-
-       // constants
-       private static final String CHARSET_XML_NIO = "UTF-8";          /** 
charset */
-       private static final String PROPREF_COMPANY_ID = "companyID";           
/** name of parameter companyID */
-       private static final String PROPREF_LAYOUT_ID = "layoutID";             
        /** name of parameter layoutID */
-       private static final String PROPREF_USER_ID = "userID";                 
        /** name of parameter userID */
-       private static final String PROP_SAVE_URL = "/dispatcher/storeLayout"; 
/** name of servlet for storing layout in dispatcher */
-       private static final String PROP_TYPES_URL = "/dispatcher/permTypes";  
/** name of servlet for getting permitted types in dispatcher */
-       private static final String PROP_RESOLUTIONS_URL = 
"/dispatcher/resolutions";   /** name of servlet for getting supported 
resolution in dispatcher */
-       private static final String PROP_LOAD_LAYOUT_URL = 
"/dispatcher/loadLayoutByID";        /** name of servlet for loading layout in 
dispatcher */
-       private static final String PROP_LOCK_LAYOUT_URL = 
"/dispatcher/LayoutLocking";  /** name of servlet for layout locking in 
dispatcher */
-       private static final String ASPECT_RATIO_DELIMITER = " ";       /** 
delimiter of aspect ratios */               
-       private static final String IS_LOCKED = "locked";                       
/** response from dispatcher that layout is locked */
-       private static final String LOCK_ACTION = "lock";
-       private static final String UNLOCK_ACTION = "unlock";
-       private static final String LOCKED_BY_ME_ACTION ="lockedByMe";
-       private static final String IS_LAYOUT_LOCKED="isLocked";
-
-       // private constructor- due to singleton
-       /**
-        * Empty constructor of the class ServerSideContext
-        */
-       private ServerSideContext() {
-       }
-
-       /**
-        * Initialize ServerSideContext
-        * @initializes context object
-        * @param applet LayoutDesigner applet
-        * @parm tabbedPane main tabbed pane of the applet
-        */
-       public static void newInstance(Applet applet, TabbedPane tabbedPane)
-                       throws Exception {
-               // initialize always, applet behaves strange..
-               init(applet, tabbedPane);
-       }
-
-       /**
-        * Gets instance of the class ServerSideContext
-        * @return ServerSideContext singleton object
-        */
-       public static ServerSideContext getInstance() {
-               return instance;
-       }
-
-
-       /**
-        * Initializes host 
-        * @param applet LayoutDesigner applet
-        * @param tabbedPane main tabbed pane
-        * @throws Exception
-        */
-       private static void init(Applet applet, TabbedPane tabbedPane)
-                       throws Exception {
-               // create instance
-               instance = new ServerSideContext();
-
-               // set host
-
-               String hostAddr = applet.getCodeBase().getHost();
-               Integer port = applet.getCodeBase().getPort();
-               instance.host = "http://"; + hostAddr + ":" + port;
-
-               // for debugging: 
-               //instance.host = "http://localhost:8080/";;
-
-       }
-
-       /**
-        * Gets layoutID, companyID, userID, layout, permitted types of 
documents and supported resolutions
-        * @param applet LayoutDesigner applet
-        * @param tabbedPane main tabbed pane
-        * @throws Exception
-        */
-       public void getProperties(Applet applet, TabbedPane tabbedPane)
-                       throws Exception {
-
-               // set companyID
-               String companyID = applet.getParameter(PROPREF_COMPANY_ID);
-               instance.companyID = Integer.parseInt(companyID);
-
-               // set layoutID
-               String layoutID = applet.getParameter(PROPREF_LAYOUT_ID);
-
-               // set userID
-               String userID = applet.getParameter(PROPREF_USER_ID);
-               instance.userID = Integer.parseInt(userID);
-
-               
-               
-               // set permitted document types
-               instance.permittedDocumentTypes = 
instance.preparePermittedDocumentTypes();
-
-               
tabbedPane.setAllTypesOfDocuments(instance.permittedDocumentTypes);
-
-               // set supported ratios
-               instance
-                               
.setSupportedResolutions(instance.prepareSupportedResolutions());
-
-                       try {
-                               instance.layoutID = Integer.parseInt(layoutID);
-                               instance.isLayoutLocked();
-
-                               if(!isLocked) {
-                                       instance.layout = 
instance.getLayoutToEdit(tabbedPane);
-                               }
-                               else {
-                                       instance.layout = null;
-                               }
-                                       
-                       } catch (Exception e) {
-                               instance.layout = null;
-                       }
-       }
-
-       /**
-        * Communicates with server and gets permitted types of document
-        * 
-        * @return permitted types of document
-        * @throws Exception
-        */
-       private Vector<String> preparePermittedDocumentTypes() throws Exception 
{
-               System.out.println("getting permitted types from:" + host
-                               + PROP_TYPES_URL);
-               URL url = new URL(host + PROP_TYPES_URL);
-               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
-               conn.setDoOutput(true);
-               conn.setRequestMethod("POST");
-               conn.setRequestProperty("user-agent", companyID.toString());
-               conn.setRequestProperty("Content-type", 
"application/octet-stream");
-               OutputStream os = conn.getOutputStream();
-               // send POST
-               os.flush();
-               os.close();
-
-               // Get the response
-               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
-                               .getInputStream(), getXMLCharset()));
-               String line;
-               String result = "";
-               while ((line = rd.readLine()) != null) {
-                       result += line + "\n";
-               }
-
-               // parse input message content
-               Vector<String> permissions = new Vector<String>();
-               if (result == null || result.equals("")) {
-                       // no type permission is granted
-                       System.out.println(0 + " types");
-                       return permissions;
-               } else {
-                       StringReader strr = new StringReader(result);
-                       BufferedReader reader = new BufferedReader(strr);
-                       String perm;
-                       // one line == one permission
-                       while ((perm = reader.readLine()) != null) {
-                               if (!perm.equals("")) {
-                                       permissions.add(perm);
-                               }
-                       }
-                       System.out.println(permissions);
-                       System.out.println(permissions.size() + " types");
-                       return permissions;
-               }
-       }
-
-       /**
-        *
-        * Parses one line from server output with supported resolutions for 
one aspect ratio
-        * @param line line from server output with supported resolutions for 
one aspect ratio
-        * @return supported resolution for one aspect ratio
-        * @throws Exception
-        */
-       private SupportedResolution parseLineWithResolutions(String line)
-                       throws Exception {
-               SupportedResolution resolution = new SupportedResolution();
-               Vector<Integer> delimiterPosition = new Vector<Integer>();
-               int pos = 0;
-               while (pos != -1 && pos < line.length()) {
-                       int delPos = line.indexOf(ASPECT_RATIO_DELIMITER, pos);
-                       if (delPos != -1) {
-                               delimiterPosition.add(delPos);
-                               pos = delPos + 1;
-                       } else {
-                               pos = delPos;
-                               delimiterPosition.add(line.length());
-                       }
-               }
-
-               for (int i = 0; i < delimiterPosition.size(); ++i) {
-                       int begin = 0;
-                       int end = 0;
-                       if (i == 0) { // first aspect ratio
-                               begin = 0;
-                               end = delimiterPosition.get(i);
-                               String aspectRatioString = 
line.substring(begin, end);
-                               
resolution.setAspectRatio(Double.valueOf(aspectRatioString));
-                       } else {
-                               begin = delimiterPosition.get(i - 1) + 1;
-                               end = delimiterPosition.get(i);
-                               String resolutionString = line.substring(begin, 
end);
-                               resolution.addResolution(resolutionString);
-                       }
-
-               }
-
-               return resolution;
-       }
-
-       /**
-        * Communicates with server and gets list of supported resolutions
-        * 
-        * @return list of supported resolutions
-        */
-       private SupportedResolutions prepareSupportedResolutions() throws 
Exception {
-               System.out.println("getting supported aspect ratios from:" + 
host
-                               + PROP_RESOLUTIONS_URL);
-               URL url = new URL(host + PROP_RESOLUTIONS_URL);
-               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
-               conn.setDoOutput(true);
-               conn.setRequestMethod("POST");
-               conn.setRequestProperty("user-agent", companyID.toString());
-               conn.setRequestProperty("Content-type", 
"application/octet-stream");
-               OutputStream os = conn.getOutputStream();
-               // send POST
-               os.flush();
-               os.close();
-
-               // Get the response
-               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
-                               .getInputStream(), getXMLCharset()));
-               String line;
-               String result = "";
-               while ((line = rd.readLine()) != null) {
-                       result += line + "\n";
-               }
-
-               // parse input message content
-               SupportedResolutions ratios = new SupportedResolutions();
-
-               if (result == null || result.equals("")) {
-                       System.out.println("nedodany aspect-ratia");
-                       return ratios;
-               } else {
-                       StringReader strr = new StringReader(result);
-                       BufferedReader reader = new BufferedReader(strr);
-                       String oneLine;
-                       // one line == one permission
-                       while ((oneLine = reader.readLine()) != null) {
-                               if (!oneLine.equals("")) {
-                                       SupportedResolution supportedResolution 
= parseLineWithResolutions(oneLine);
-                                       ratios.add(supportedResolution);
-                               }
-                       }
-                       System.out.println("nacteny aspect-ratia");
-                       return ratios;
-               }
-       }
-
-
-       /**
-        * Stores this layout on server
-        * @param xml string with xml of layout
-        * @return new id of layout
-        * @throws Exception
-        */
-       public Integer storeLayout(String xml) throws Exception {
-               return postLayoutStorage(xml);
-       }
-       
-       /**
-        * Unlocks edited layout
-        * @throws Exception
-        */
-       public void unlockLayout() throws Exception {
-               postLayoutLocking(UNLOCK_ACTION);
-               
-       }
-       
-       /**
-        * Read layout from server to be edited in LayoutDesigner
-        * @param tabbedPane tabbedPane
-        * @return layout
-        * @throws Exception
-        */
-       public Layout getLayoutToEdit(TabbedPane tabbedPane) throws Exception {
-               return postLoadLayoutByID(tabbedPane);
-       }
-       
-       /**
-        * Gets whatever saved layout is locked by me
-        * @param tabbedPane main tabbed pane
-        * @return whatever layout is locked by me
-        * @throws Exception
-        */
-       public boolean isLayoutLockedByMe(TabbedPane tabbedPane) throws 
Exception {
-               postLayoutLocking(LOCKED_BY_ME_ACTION);
-               return this.isLockedByMe;
-       }
-       
-       /**
-        * Locks edited layout  
-        * @throws Exception
-        */
-       public void lockLayout() throws Exception {
-               postLayoutLocking(LOCK_ACTION);
-       }
-       
-       /**
-        * Finds whatever this layout is locked by another user
-        * @throws Exception
-        */
-       public void isLayoutLocked() throws Exception {
-               postLayoutLocking(IS_LAYOUT_LOCKED);
-       }
-       
-       /**
-        * Sends xml of layout to the server and the server stores it into DB.
-        * @param xml xml of layout to store
-        * @return new id of stored layout
-        * @throws Exception
-        */
-       private Integer postLayoutStorage(String xml) throws Exception {
-               URL url = new URL(host + PROP_SAVE_URL);
-               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
-               conn.setDoOutput(true);
-               conn.setRequestMethod("POST");
-               conn.setRequestProperty("user-agent", companyID.toString() + 
";" + userID.toString());
-               System.out.println(companyID.toString() + ";" + 
userID.toString() + " -> " + xml);
-               conn.setRequestProperty("Content-type", 
"application/octet-stream");
-               OutputStream os = conn.getOutputStream();
-               OutputStreamWriter writer = new OutputStreamWriter(os);
-               writer.write(xml);
-               writer.close();
-
-               // send POST
-               os.flush();
-               os.close();
-
-               // Get the response
-               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
-                               .getInputStream(), getXMLCharset()));
-               String output = "";
-               String line;
-               while ((line = rd.readLine()) != null) {
-                       output += line;
-               }
-               System.out.println(output);
-               if (output.substring(0, 2).equals("ok")) {
-                       // everything is ok
-                       String sid = output.substring(2);
-                       Integer id = Integer.parseInt(sid);
-                       return id;
-               } else {
-                       // error, propagate up and over there write message to 
user
-                       throw new Exception(output);
-               }
-       }
-
-
-       /**
-        * Locks, unlocks or decides whatever layout is locked by this user 
-        * @param type type of post action
-        * @throws Exception
-        */
-       private void postLayoutLocking(String type) throws Exception {
-               URL url = new URL(host + PROP_LOCK_LAYOUT_URL);
-               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
-               conn.setDoOutput(true);
-               conn.setRequestMethod("POST");
-               conn.setRequestProperty("user-agent", companyID.toString() + 
";" + userID.toString() + ";" + layoutID.toString());
-               System.out.println(companyID.toString() + ";" + 
userID.toString() + layoutID.toString() + " -> " + type);
-               conn.setRequestProperty("Content-type", 
"application/octet-stream");
-               OutputStream os = conn.getOutputStream();
-               OutputStreamWriter writer = new OutputStreamWriter(os);
-               writer.write(type);
-               writer.close();
-
-
-               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
-                               .getInputStream(), getXMLCharset()));
-               
-
-               // parse input message content
-               if(type.equals(LOCKED_BY_ME_ACTION)) {
-                       
-                       
-                       String line;
-                       String result = "";
-                       while ((line = rd.readLine()) != null) {
-                               result += line;
-                       }
-                       isLockedByMe = result.equals(IS_LOCKED);        
-                       
-               }
-               
-               else if(type.equals(IS_LAYOUT_LOCKED)) {
-                       String line;
-                       String result = "";
-                       while ((line = rd.readLine()) != null) {
-                               result += line;
-                       }
-                       
-                       isLocked = result.substring(0, 
IS_LOCKED.length()).equals(IS_LOCKED);
-
-                       if(isLocked) {
-                               lockedUser = 
result.substring(IS_LOCKED.length());
-                       }
-
-                       
-               }
-
-                               
-       }
-       
-       /**
-        * Gets layout with layoutID from DB.
-        * @param tabbedPane main tabbed pane
-        * @return layout with the layoutID
-        * @throws Exception
-        */
-       private Layout postLoadLayoutByID(TabbedPane tabbedPane)
-                       throws Exception {
-
-               URL url = new URL(host + PROP_LOAD_LAYOUT_URL);
-               HttpURLConnection conn = (HttpURLConnection) 
url.openConnection();
-               conn.setDoOutput(true);
-               conn.setRequestMethod("POST");
-               conn.setRequestProperty("user-agent", layoutID.toString() + ";"
-                               + companyID.toString());
-               System.out.println(layoutID.toString() + ";"
-                               + companyID.toString() + ";" + 
userID.toString());
-               conn.setRequestProperty("Content-type", 
"application/octet-stream");
-               OutputStream os = conn.getOutputStream();
-               // send POST
-               os.flush();
-               os.close();
-
-               // Get the response
-               BufferedReader rd = new BufferedReader(new 
InputStreamReader(conn
-                               .getInputStream(), getXMLCharset()));
-               String line;
-               String result = "";
-               while ((line = rd.readLine()) != null) {
-                       result += line; // + "\n";
-               }
-               System.out.println(result);
-
-               // parse input message content
-
-               Layout newLayout = null;
-
-               if (result == null || result.equals("")) {
-                       // no layout is granted
-                       System.out.println("layout not opened");
-                       isLocked = false;
-                       return null;
-               } else {
-                       ReadLayoutFromServer openFile = new 
ReadLayoutFromServer(
-                                       tabbedPane, 
instance.supportedResolutions,
-                                       instance.permittedDocumentTypes);
-                       newLayout = openFile.readLayout(result);
-                       isLocked = false;
-                       System.out.println("layout opened");
-                       return newLayout;
-               }
-       }
-
-       /**
-        * Gets char set
-        * @return charset for XML data
-        */
-       private static Charset getXMLCharset() {
-               if (charset == null) {
-                       charset = Charset.forName(CHARSET_XML_NIO);
-               }
-               return charset;
-       }
-
-       /**
-        * Sets layoutID
-        * @param layoutID
-        *            the layoutID to set
-        */
-       public void setLayoutID(Integer layoutID) {
-               this.layoutID = layoutID;
-       }
-
-       /**
-        * Gets layoutID
-        * @return the layoutID
-        */
-       public Integer getLayoutID() {
-               return layoutID;
-       }
-
-       /**
-        * Sets userID
-        * @param userID
-        *            the userID to set
-        */
-       public void setUserID(Integer userID) {
-               this.userID = userID;
-       }
-
-       /**
-        * Gets userID
-        * @return the userID
-        */
-       public Integer getUserID() {
-               return userID;
-       }
-
-       /**
-        * Sets supported resolutions
-        * @param supportedResolutions
-        *            the supportedResolutions to set
-        */
-       public void setSupportedResolutions(
-                       SupportedResolutions supportedResolutions) {
-               this.supportedResolutions = supportedResolutions;
-       }
-
-       /**
-        * Gets supported resolutions
-        * @return the supportedResolutions
-        */
-       public SupportedResolutions getSupportedResolutions() {
-               return supportedResolutions;
-       }
-
-       /**
-        * Gets host
-        * @return the host
-        */
-       public String getHost() {
-               return host;
-       }
-
-       /**
-        * Sets host
-        * @param host
-        *            the host to set
-        */
-       public void setHost(String host) {
-               this.host = host;
-       }
-
-       /**
-        * Gets permitted document types
-        * @return the permittedDocumentTypes
-        */
-       public Vector<String> getPermittedDocumentTypes() {
-               return permittedDocumentTypes;
-       }
-
-       /**
-        * Sets whatever layout is locked
-        * @param isLocked isLocked to set
-        */
-       public void setLocked(boolean isLocked) {
-               this.isLocked = isLocked;
-       }
-
-       /**
-        * Gets whatever layout is locked
-        * @return whatever layout is locked
-        */
-       public boolean isLocked() {
-               return isLocked;
-       }
-
-       /**
-        * Gets companyID
-        * @return companyID
-        */
-       public Integer getCompanyID() {
-               return companyID;
-       }
-       
-       /**
-        * Gets layout
-        * @return layout
-        */
-       public Layout getLayout() {
-               return layout;
-       }
-
-       /**
-        * Sets layout
-        * @param layout layout to set
-        */
-       public void setLayout(Layout layout) {
-               this.layout = layout;
-       }
-
-       /**
-        * @param lockedUser the lockedUser to set
-        */
-       public void setLockedUser(String lockedUser) {
-               this.lockedUser = lockedUser;
-       }
-
-       /**
-        * @return the lockedUser
-        */
-       public String getLockedUser() {
-               return lockedUser;
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/StatusBar.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/StatusBar.java 2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/StatusBar.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,82 +0,0 @@
-/**
- * StatusBar.java
- * @author Eva Viktorinova
- */
-package applet;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-
-/**
- * @class StatusBar
- * Displays actual coordinates of the mouse
- *
- */
-@SuppressWarnings("serial")
-public class StatusBar extends JPanel {
-
-       // fields
-       private JLabel mouseCoordinatesLabel;           /** label with mouse 
coordinates */
-       @SuppressWarnings("unused")
-       private TabbedPane tabbedPane;                          /**  tabbed 
pane */
-
-       // constructors
-       /**
-        * Constructor of the class StatusBar
-        * @param statusBar panel where status bar is displayed
-        */
-       public StatusBar(JPanel statusBar) {
-               this.setFocusable(false);
-               int x = 0;
-               int y = 0;
-               String xy = Integer.toString(x) + " : " + Integer.toString(y);
-               mouseCoordinatesLabel = new JLabel(xy);
-               mouseCoordinatesLabel.setFocusable(false);
-               statusBar.add(mouseCoordinatesLabel);
-               
-       }
-
-       // methods
-       /**
-        * Sets new label text according to new mouse coordinates
-        * @param x new mouse x coordinate
-        * @param y new mouse y coordinate
-        */
-       public void actualizeXY(int x, int y) {
-               String xy = Integer.toString(x) + " : " + Integer.toString(y);
-               mouseCoordinatesLabel.setText(xy);
-       }
-       
-       
-       /**
-        * Actualizes mouse coordinates in status bar
-        * @param layout layout of the actual design area
-        * @param x new x coordinate
-        * @param y new y coordinate
-        */
-       public void actualizeStatusBarMouseCoordinates(Layout layout, int x,
-                       int y) {
-
-               ScreenResolution screenResolution = 
layout.getScreenResolution();
-
-               if (x <= screenResolution.getElvysWidth()
-                               && y <= screenResolution.getElvysHeight()) {
-                       actualizeXY(x, y);
-               }
-               else {
-                       actualizeXY(screenResolution.getElvysWidth(), 
screenResolution.getElvysHeight());
-               }
-
-       }
-
-       // getter & setters
-       /**
-        * Setter for the field tabbedPane
-        * @param tabbedPane the tabbedPane to set
-        */
-       public void setTabbedPane(TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolution.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/SupportedResolution.java       
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolution.java
  2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Vector;
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolutions.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/SupportedResolutions.java      
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/SupportedResolutions.java
 2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,4 +1,4 @@
-package applet;
+package com.elvys.applet.structures;
 
 import java.util.Vector;
 

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPane.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/TabbedPane.java        
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPane.java
   2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,363 +0,0 @@
-package applet;
-
-/**
- * TabbedPane.java
- * @author Eva Viktorinova
- */
-import java.awt.Cursor;
-import java.awt.Graphics;
-import java.util.Properties;
-import java.util.Vector;
-import javax.swing.JRootPane;
-import javax.swing.JTabbedPane;
-
-/**
- * @class TabbedPane
- * In tabbed pane layout are opened to be designed. 
- */
-@SuppressWarnings("serial")
-class TabbedPane extends JTabbedPane {
-       // fields
-       private JTabbedPane tabbedPane;                                         
        /** tabbed pane where tabbed pane is displayed */
-       private Properties properties;                                          
        /** properties */
-       private Vector<String> allTypesOfDocuments;                             
/** all permitted types of documents */
-       private PropertiesManager propertiesManager;                    /** 
properties manager */
-       private StatusBar statusBar;                                            
        /** status bar */
-       private ToolBar toolBar;                                                
                /** tool bar */
-       private MenuBar menuBar;                                                
                /** menu bar */
-       private JRootPane rootPane;                                             
                /** root pane of the LayoutDesigner */
-       private ComponentSizes componentSizes;                                  
/** size of components */
-       private SupportedResolutions supportedResolutions;              /** 
supported resolutions */
-       
-               
-
-       // constructors
-       /**
-        * Constructor of the class TabbedPane
-        * @param properties properties to set
-        * @param allTypesOfDocuments all types of documents to set
-        */
-       public TabbedPane(Properties properties, Vector<String> 
allTypesOfDocuments) {
-               this.setAllTypesOfDocuments(allTypesOfDocuments);
-               this.setProperties(properties);
-               this.setFocusable(false);
-       }
-
-       // methods
-       /**
-        * Adds new tab with new design area to tabbed pane
-        * @param tabName name of the new layout
-        * @param newDesignArea design area where layout is designed
-        */
-       public void addNewTab(String tabName, DesignArea newDesignArea) {
-
-               addTab(tabName, newDesignArea);
-               setSelectedComponent(newDesignArea);
-               setTabComponentAt(getSelectedIndex(), new 
TabbedPaneCloseTabButton(this,
-                               tabName, newDesignArea));
-
-               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) {
-               return ((DesignArea) 
this.getComponentAt(layoutTabID)).isSaved();
-       }
-
-       /**
-        * Finds whatever layout at actual design area is saved 
-        * @return whatever layout at actual design area is saved
-        */
-       public boolean isActualLayoutSaved() {
-               return ((DesignArea) this.getSelectedComponent()).isSaved();
-       }
-
-       /**
-        * 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 ((DesignArea) this.getComponentAt(layoutTabID))
-                               .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 ((DesignArea) this.getSelectedComponent())
-                               .getMyLayout().getName();
-       }
-
-       /** 
-        * Gets actual design area
-        * @return actual design area
-        */
-       public DesignArea getActualDesignArea() {
-               if (this.getComponentCount() == 0) {
-                       return null;
-               }
-               return ((DesignArea) this.getSelectedComponent());
-       }
-
-       /**
-        * 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 ((DesignArea) this.getComponentAt(layoutTabID));
-       }
-
-       
-       /**
-        * Actualizes all components according to the actual state of the 
LayoutDesigner
-        */
-       private void actualizeAllComponents() {
-
-               DesignArea designArea = getActualDesignArea();
-               if (designArea == null) {
-                       this.getToolBar().setEnabledForAllButtons(false);
-
-                       
this.getPropertiesManager().actualizePropertiesTableFields();
-                       this.getPropertiesManager().actualizeDocumentTypes();
-                       this.getPropertiesManager().actualizePositionsList();
-
-                       this.getMenuBar().setCursor(new 
Cursor(Cursor.DEFAULT_CURSOR));
-                       this.getMenuBar().actualize();
-
-               } else {
-
-                       designArea.getPopupMenu().actualize(designArea);
-                       this.getToolBar().setEnabledForAllButtons(true);
-                       toolBar.actualizeMemoryActionButtons(designArea);
-
-                       if 
(!this.getPropertiesManager().isPropertiesTableFocusOwner()) {
-                               
this.getPropertiesManager().actualizePropertiesTableFields();
-                               
this.getPropertiesManager().actualizePropertiesTable();
-                       }
-                       this.getPropertiesManager().actualizePositionsList();
-
-                       this.getMenuBar().actualize();
-                       designArea.repaint();
-
-                       int layoutCount = getTabCount();
-                       // setSelectedIndex(0);
-                       for (int i = 0; i < layoutCount; ++i) {
-                               DesignArea actual = (DesignArea) 
getComponentAt(i);
-
-                               String layoutName = actual.getMyLayout()
-                                               .getName();
-
-                               if (!actual.isSaved()) {
-                                       layoutName = 
actual.getMyLayout().getNotSavedName();
-                               }
-
-                               TabbedPaneCloseTabButton buttonTab = 
(TabbedPaneCloseTabButton) getTabComponentAt(i);
-                               buttonTab.setNewTabTitle(layoutName);
-
-                       }
-                       
-                       this.getMenuBar().setCursor(new 
Cursor(Cursor.WAIT_CURSOR));
-               }
-
-       }
-
-       /**
-        * Paints tabbed pane
-        * @param g graphics
-        */
-       public void paintComponent(Graphics g) {
-               super.paintComponent(g);
-               actualizeAllComponents();
-       }
-
-       /**
-        * Changes title of the tab to the title of unsaved file
-        * @return
-        */
-       public void changeActualTitleToNotSavedTitle(Layout layout) {
-               
-               String notSavedFileName = layout.getNotSavedName();
-               setTitleAt(getSelectedIndex(), notSavedFileName);
-       }
-
-       // getters & setters
-
-
-       /**
-        * Getter for the field tabbedPane
-        * @return the tabbedPane
-        */
-       public JTabbedPane getTabbedPane() {
-               return tabbedPane;
-       }
-
-       /**
-        * Setter for the field tabbedPane 
-        * @param tabbedPane
-        *            the tabbedPane to set
-        */
-       public void setTabbedPane(JTabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-       /**
-        * Getter for the field propertiesManager
-        * @return the propertiesManager
-        */
-       public PropertiesManager getPropertiesManager() {
-               return propertiesManager;
-       }
-
-       /**
-        * Setter for the field propertiesManager
-        * @param propertiesManager
-        *            the propertiesManager to set
-        */
-       public void setPropertiesManager(PropertiesManager propertiesManager) {
-               this.propertiesManager = propertiesManager;
-       }
-
-       /**
-        * Getter for the field statusBar
-        * @return the statusBar
-        */
-       public StatusBar getStatusBar() {
-               return statusBar;
-       }
-
-       /**
-        * Getter for the field statusBar
-        * @param statusBar
-        *            the statusBar to set
-        */
-       public void setStatusBar(StatusBar statusBar) {
-               this.statusBar = statusBar;
-       }
-
-       /**
-        * Getter for the field toolBar
-        * @return the toolBar
-        */
-       public ToolBar getToolBar() {
-               return toolBar;
-       }
-
-       /**
-        * Setter for the field toolBar
-        * @param toolBar
-        *            the toolBar to set
-        */
-       public void setToolBar(ToolBar toolBar) {
-               this.toolBar = toolBar;
-       }
-
-       /**
-        * Setter for the field menuBar
-        * @param menuBar
-        *            the menuBar to set
-        */
-       public void setMenuBar(MenuBar menuBar) {
-               this.menuBar = menuBar;
-       }
-
-       /**
-        * Getter for the field menuBar
-        * @return the menuBar
-        */
-       public MenuBar getMenuBar() {
-               return menuBar;
-       }
-
-       /**
-        * Setter for the field properties
-        * @param properties
-        *            the properties to set
-        */
-       public void setProperties(Properties properties) {
-               this.properties = properties;
-       }
-
-       /**
-        * Getter for the field properties
-        * @return the properties
-        */
-       public Properties getProperties() {
-               return properties;
-       }
-
-       /**
-        * Setter for the field allTypesOfDocuments
-        * @param allTypesOfDocuments
-        *            the allTypesOfDocuments to set
-        */
-       public void setAllTypesOfDocuments(Vector<String> allTypesOfDocuments) {
-               this.allTypesOfDocuments = allTypesOfDocuments;
-       }
-
-       /**
-        * Getter for the field allTypesOfDocuments
-        * @return the allTypesOfDocuments
-        */
-       public Vector<String> getAllTypesOfDocument() {
-               return allTypesOfDocuments;
-       }
-
-       /**
-        * Setter for the field componentSizes
-        * @param componentSizes
-        *            the componentSizes to set
-        */
-       public void setComponentSizes(ComponentSizes componentSizes) {
-               this.componentSizes = componentSizes;
-       }
-
-       /**
-        * Getter for the field componentSizes
-        * @return the componentSizes
-        */
-       public ComponentSizes getComponentSizes() {
-               return componentSizes;
-       }
-
-       /**
-        * Setter for the field rootPane
-        * @param rootPane
-        *            the rootPane to set
-        */
-       public void setRootPane(JRootPane appletRootPane) {
-               this.rootPane = appletRootPane;
-       }
-
-       /**
-        * Getter for the field rootPane
-        * @return the rootPane
-        */
-       public JRootPane getRootPane() {
-               return rootPane;
-       }
-
-       /**
-        * Setter for the field supportedResolutions
-        * @param supportedResolutions the supportedResolutions to set
-        */
-       public void setSupportedResolutions(SupportedResolutions 
supportedAspectRatios) {
-               this.supportedResolutions = supportedAspectRatios;
-       }
-
-       /**
-        * Getter for the filed supportedResolutions
-        * @return the supportedResolutions
-        */
-       public SupportedResolutions getSupportedResolutions() {
-               return supportedResolutions;
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPaneCloseTabButton.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/TabbedPaneCloseTabButton.java  
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/TabbedPaneCloseTabButton.java
     2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,123 +0,0 @@
-package applet;
-
-/**
- * TabbedPaneCloseTabButton.java
- * @author EvaV
- */
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.FlowLayout;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.plaf.basic.BasicButtonUI;
-
-@SuppressWarnings("serial")
-/**
- * TabbedPaneCloseTabButton implements cross button which enables to close tab 
of main tabbed pane  
- */
-public class TabbedPaneCloseTabButton extends JPanel {
-       private final TabbedPane tabbedPane;    /** main tabbed pane */
-       private DesignArea designArea;                  /** design area 
corresponding to this tab */
-       private JLabel tabTitleLabel;                   /** title of the tab - 
name of the layout of design area */
-
-       /**
-        * Constructor of the class TabbedPaneCloseTabButton
-        * @param tabbedPane main tabbed pane
-        * @param tabTitleText title of the tab - name of the layout of design 
area 
-        * @param designArea design area corresponding to this tab 
-        */
-       public TabbedPaneCloseTabButton(TabbedPane tabbedPane, String 
tabTitleText,
-                       DesignArea designArea) {
-       
-               super(new FlowLayout(FlowLayout.LEFT, 0, 0));
-
-               
-               this.tabbedPane = tabbedPane;
-               this.designArea = designArea;
-               this.setOpaque(false);
-               this.setFocusable(false);
-
-               tabTitleLabel = new JLabel(tabTitleText);
-               
-               add(tabTitleLabel);
-               tabTitleLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 
0, 2));
-               tabTitleLabel.setFocusable(false);
-               
-               JButton button = new CrossCloseButton();
-               add(button);
-
-               setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
-       }
-
-       /**
-        * Sets new title for the actual tab
-        * @param newTitle new title to set
-        */
-       public void setNewTabTitle(String newTitle) {
-               tabTitleLabel.setText(newTitle);
-               repaint();
-
-       }
-
-       /**
-        * @class CrossCloseButton
-        * CrossCloseButton displays button which enables to close tab 
-        * 
-        */
-       private class CrossCloseButton extends JButton implements 
ActionListener {
-               private final static int CROSS_BUTTON_SIZE = 17;        /** 
size of the cross button */
-               private final static int DELTA = 6;                             
        /** size of the cross */
-               
-               /**
-                * Constructor of the class CrossCloseButton
-                */
-               public CrossCloseButton() {
-                       setPreferredSize(new Dimension(CROSS_BUTTON_SIZE, 
CROSS_BUTTON_SIZE));
-                       setUI(new BasicButtonUI());
-                       setContentAreaFilled(false);
-                       setBorder(BorderFactory.createEtchedBorder());
-                       setBorderPainted(false);
-                       setRolloverEnabled(true);
-                       addActionListener(this);
-               }
-
-               /**
-                * Handles closing of the tab
-                * @param e action event
-                */
-               public void actionPerformed(ActionEvent e) {
-
-                       CloseLayout closeDesignArea = new 
CloseLayout(tabbedPane, tabbedPane
-                                       .getProperties());
-                       closeDesignArea.closeActualLayout(designArea, 
tabbedPane.getRootPane());
-               }
-
-
-               /**
-                * Paints the close cross
-                * @param g graphics 
-                */
-               protected void paintComponent(Graphics g) {
-                       super.paintComponent(g);
-                       Graphics2D g2 = (Graphics2D) g.create();
-                       
-                       g2.setStroke(new BasicStroke(2));
-                       g2.setColor(Color.BLACK);
-                
-                       g2.drawLine(DELTA, DELTA, getWidth() - DELTA - 1, 
getHeight()
-                                       - DELTA - 1);
-                       g2.drawLine(getWidth() - DELTA - 1, DELTA, DELTA, 
getHeight()
-                                       - DELTA - 1);
-                       g2.dispose();
-               }
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ToolBar.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/ToolBar.java   2010-02-18 
22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/ToolBar.java  
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,587 +0,0 @@
-package applet;
-
-/**
- * ToolBar.java
- * @author Eva Viktorinova
- */
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.BorderFactory;
-import javax.swing.Icon;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JTabbedPane;
-import javax.swing.JToolBar;
-
-/**
- * @class ToolBar 
- * Toolbar displays tools which allows manipulating with the LayoutDesigner
- */
-
-@SuppressWarnings("serial")
-public class ToolBar extends JToolBar {
-       // fields
-       private TabbedPane tabbedPane;                          /** tabbed pane 
*/
-       private JButton designPositionButton;           /** enables or disables 
designing of positions */
-       private JButton backwardButton;                         /** goes 
backward in memory of actions */
-       private JButton forwardButton;                          /** goes 
forward in memory of actions */ 
-       private JButton centerHorizontalButton;         /** centers 
horizontally selected positions */
-       private JButton centerVerticalButton;           /** centers vertically 
selected positions */    
-       private JButton sameTopButton;                          /** aligns 
selected positions to the same top */
-       private JButton sameBottomButton;                       /** aligns 
selected positions to the same bottom */
-       private JButton sameLeftButton;                         /** aligns 
selected positions to the same left */
-       private JButton sameRightButton;                        /** aligns 
selected positions to the same right */
-       private JButton propertiesManagerButton;        /** makes visible 
properties manager */
-       private String urlString;                                       /** url 
of toolbar buttons location */
-
-       // constants
-       private final static int BORDER_SIZE = 1;                               
/** size of border of toolbar buttons */
-       private final static int CENTER_MIN_COUNT = 3;                  /** min 
count of selected positions for centering */
-       private final static int SAME_COORDINATE_MIN_COUNT = 2; /** min count 
of selected positions for aligning */
-
-       // methods
-       /**
-        * Enables or disables designing of positions
-        * 
-        * @param enabled enabled to set
-        */
-       public void designPositionButtonSetEnabled(boolean enabled) {
-               designPositionButton.setEnabled(enabled);
-               Icons icons = new Icons(urlString);
-               if (!enabled) {
-                       designPositionButton.setIcon(new 
ImageIcon(icons.getSelectDisabledImage()));
-               } else {
-                       if (tabbedPane.getActualDesignArea().isInDesignMode()) {
-                               designPositionButton.setIcon(new 
ImageIcon(icons.getDesignEnabledImage()));
-                       } else {
-                               designPositionButton.setIcon(new 
ImageIcon(icons.getSelectEnabledImage()));
-                       }
-               }
-
-       }
-
-       /**
-        * Enables going forward in memory of actions
-        * @param enabled enabled to set
-        */
-       public void forwardButtonSetEnabled(boolean enabled) {
-               forwardButton.setEnabled(enabled);
-       }
-
-       /** Enables going backward in memory of actions
-        * @param enabled enabled to set
-        */
-       public void backwardButtonSetEnabled(boolean enabled) {
-               backwardButton.setEnabled(enabled);
-       }
-
-       /**
-        * Enables horizontal centering of actually selected positions
-        * @param enabled enabled to set
-        */
-       public void centerHorizontalButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if (designArea.getMyLayout()
-                                       .getSelectedPositions().size() < 
CENTER_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               centerHorizontalButton.setEnabled(enabled);
-       }
-
-       /** 
-        * Enables vertical centering of actually selected positions 
-        * @param enabled enabled to set
-        */
-       public void centerVerticalButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if 
(designArea.getMyLayout().getSelectedPositions().size() < CENTER_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               centerVerticalButton.setEnabled(enabled);
-
-       }
-
-       /**
-        * Enables aligning of actually selected position to the same top
-        * @param enabled enabled to set
-        */
-       public void sameTopButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if (designArea.getMyLayout()
-                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               sameTopButton.setEnabled(enabled);
-
-       }
-
-       /**
-        * Enables aligning of actually selected positions to the same bottom
-        * @param enabled enabled to set
-        */
-       public void sameBottomButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if (designArea.getMyLayout()
-                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               sameBottomButton.setEnabled(enabled);
-
-       }
-
-       /** 
-        * Enables aligning of actually selected positions to the same right 
-        * @param enabled enabled to set
-        */
-       public void sameRightButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if (designArea.getMyLayout()
-                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               sameRightButton.setEnabled(enabled);
-
-       }
-
-       /** 
-        * Enables aligning of actually selected positions to the same left
-        * @param enabled enabled to set
-        */
-       public void sameLeftButtonSetEnabled(boolean enabled) {
-
-               if (enabled) {
-                       DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                       if (designArea == null) {
-                               return;
-                       }
-                       if (designArea.getMyLayout()
-                                       .getSelectedPositions().size() < 
SAME_COORDINATE_MIN_COUNT) {
-                               enabled = false;
-                       }
-               }
-               sameLeftButton.setEnabled(enabled);
-
-       }
-
-       
-       /**
-        * Enables centering and aligning buttons
-        * @param enabled enabled to set
-        */
-       public void setEnabledForCenterAndAlignButtons(boolean enabled) {
-
-               this.centerHorizontalButtonSetEnabled(enabled);
-               this.centerVerticalButtonSetEnabled(enabled);
-
-               this.sameBottomButtonSetEnabled(enabled);
-               this.sameLeftButtonSetEnabled(enabled);
-               this.sameRightButtonSetEnabled(enabled);
-               this.sameTopButtonSetEnabled(enabled);
-
-       }
-
-       /**
-        * Enables all buttons 
-        * @param enabled enabled to set
-        */
-       public void setEnabledForAllButtons(boolean enabled) {
-
-               this.backwardButtonSetEnabled(enabled);
-               this.centerHorizontalButtonSetEnabled(enabled);
-               this.centerVerticalButtonSetEnabled(enabled);
-               this.designPositionButtonSetEnabled(enabled);
-               this.forwardButtonSetEnabled(enabled);
-
-               this.sameBottomButtonSetEnabled(enabled);
-               this.sameLeftButtonSetEnabled(enabled);
-               this.sameRightButtonSetEnabled(enabled);
-               this.sameTopButtonSetEnabled(enabled);
-
-       }
-       
-       /**
-        * Sets border for button in toolbar
-        * 
-        * @param toolbarButton
-        *            button in toolbar
-        */
-       private void setToolbarButtonBorder(final JButton toolbarButton) {
-               
toolbarButton.setBorder(BorderFactory.createEmptyBorder(BORDER_SIZE,
-                               BORDER_SIZE, BORDER_SIZE, BORDER_SIZE));
-               toolbarButton.addMouseListener(new MouseAdapter() {
-                       public void mouseEntered(MouseEvent e) {
-                               if (toolbarButton.isEnabled()) {
-                                       toolbarButton.setBorder(BorderFactory
-                                                       
.createLineBorder(Color.black));
-                               } else {
-                                       toolbarButton
-                                                       
.setBorder(BorderFactory.createEmptyBorder(
-                                                                       
BORDER_SIZE, BORDER_SIZE, BORDER_SIZE,
-                                                                       
BORDER_SIZE));
-                               }
-                       }
-
-                       public void mouseExited(MouseEvent e) {
-                               
toolbarButton.setBorder(BorderFactory.createEmptyBorder(
-                                               BORDER_SIZE, BORDER_SIZE, 
BORDER_SIZE, BORDER_SIZE));
-                       }
-               });
-       }
-       
-       /**
-        * Actualizes forward and backward buttons in toolbar according to the 
state of the actual design area
-        * @param actualDesignArea the actual design area 
-        */
-       public void actualizeMemoryActionButtons(DesignArea actualDesignArea) {
-               if (actualDesignArea.getActionMemory().getBackward().size() == 
1) {
-                       
actualDesignArea.getTabbedPane().getToolBar().backwardButtonSetEnabled(
-                                       false);
-               } else {
-                       
actualDesignArea.getTabbedPane().getToolBar().backwardButtonSetEnabled(
-                                       true);
-               }
-
-               if (actualDesignArea.getActionMemory().getForward().isEmpty()) {
-                       actualDesignArea.getTabbedPane().getToolBar()
-                                       .forwardButtonSetEnabled(false);
-               } else {
-                       actualDesignArea.getTabbedPane().getToolBar()
-                                       .forwardButtonSetEnabled(true);
-               }
-       }
-
-       // constructors
-       
-       /**
-        * Constructor of the class ToolBar. Initializes buttons in toolbar and 
their actions
-        * @param toolBar tool bar where this toolbar is displayed
-        * @param _urlString location of icons for buttons
-        * @param propertiesManagerTabbedPane tabbed pane with properties 
manager
-        * @param layoutTabbedPane tabbed pane with layouts
-        */
-       public ToolBar(JToolBar toolBar, String _urlString,
-                       final JTabbedPane propertiesManagerTabbedPane,
-                       final TabbedPane layoutTabbedPane) {
-
-               toolBar.setFloatable(false);
-               toolBar.setRollover(false);
-               this.tabbedPane = layoutTabbedPane;
-               urlString = _urlString;
-               Insets insets = new Insets(1, 1, 1, 1);
-               toolBar.setMargin(insets);
-
-               // toolBar.setFocusable(false);
-
-               Icons icons = new Icons(urlString);
-
-               propertiesManagerButton = new JButton(tabbedPane.getProperties()
-                               .getProperty("propertiesManager.label"));
-               propertiesManagerButton.setVisible(false);
-               propertiesManagerButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               propertiesManagerTabbedPane.setVisible(true);
-                               propertiesManagerButton.setVisible(false);
-
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                               if (designArea == null) {
-                                       return;
-                               }
-                               ScreenResolution screenSizes = designArea
-                                               
.getMyLayout().getScreenResolution();
-
-                               Layout layout = designArea.getMyLayout();
-                               ScreenResolution newScreenSizes = new 
ScreenResolution(
-                                               screenSizes.getElvysWidth(), 
screenSizes
-                                                               
.getElvysHeight());
-
-                               layout.setScreenResolution(newScreenSizes);
-                               
designArea.setSize(newScreenSizes.getMonitorWidth(),
-                                               
newScreenSizes.getMonitorHeight());
-
-                               Positions positions = 
layout.getLayoutPositions();
-                               positions.changeMonitorResolution(designArea, 
screenSizes,
-                                               newScreenSizes);
-
-                       }
-               });
-
-               Icon icon = new ImageIcon(icons.getSelectEnabledImage());
-
-               designPositionButton = new JButton(icon);
-               designPositionButton.setEnabled(false);
-               designPositionButton.setDisabledIcon(new 
ImageIcon(icons.getSelectDisabledImage()));
-               
designPositionButton.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
-
-               // pushing document button enables designing in the selected 
design area
-               designPositionButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
-                               boolean isEnabledToDesign = selectedDesignArea
-                                               .isInDesignMode();
-                               Icons icons = new Icons(urlString);
-                               if (isEnabledToDesign) {
-                                       designPositionButton
-                                                       .setIcon(new 
ImageIcon(icons.getSelectEnabledImage()));
-                                       selectedDesignArea.setCursor(new Cursor(
-                                                       Cursor.DEFAULT_CURSOR));
-                               } else {
-                                       designPositionButton.setIcon(new 
ImageIcon(icons.getDesignEnabledImage()));
-
-                                       selectedDesignArea.setCursor(new Cursor(
-                                                       
Cursor.CROSSHAIR_CURSOR));
-                               }
-                               selectedDesignArea
-                                               
.setInDesignMode(!isEnabledToDesign);
-
-                       }
-               });
-
-               icon = new ImageIcon(icons.getBackwardEnabledImage());
-
-               backwardButton = new JButton(icon);
-
-               backwardButton.setDisabledIcon(new 
ImageIcon(icons.getBackwardDisabledImage()));
-               backwardButton.setEnabled(false);
-
-
-               backwardButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
-                               ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
-                                               .getActionMemory();
-                               
selectedDesignAreaActionMemory.backwardAction(selectedDesignArea);
-
-                       }
-               });
-
-               forwardButton = new JButton(new 
ImageIcon(icons.getForwardEnabledImage()));
-               forwardButton.setDisabledIcon(new 
ImageIcon(icons.getForwardDisabledImage()));
-
-               forwardButton.setEnabled(false);
-               forwardButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
-                               ActionsMemory selectedDesignAreaActionMemory = 
selectedDesignArea
-                                               .getActionMemory();
-                               selectedDesignAreaActionMemory
-                                               
.forwardAction(selectedDesignArea);
-
-                       }
-               });
-
-               sameTopButton = new JButton(new 
ImageIcon(icons.getSameTopEnabledImage()));
-               sameTopButton.setDisabledIcon(new 
ImageIcon(icons.getSameTopDisabledImage()));
-               sameTopButton.setEnabled(false);
-               sameTopButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {          
 
-                           DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.setSameTopCoordinate(designArea);
-                       }
-               });
-
-               sameBottomButton = new JButton(
-                               new 
ImageIcon(icons.getSameBottomEnabledImage()));
-               sameBottomButton.setDisabledIcon(new ImageIcon(icons
-                               .getSameBottomDisabledImage()));
-               sameBottomButton.setEnabled(false);
-               sameBottomButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.setSameBottomCoordinate(designArea);
-                       }
-               });
-
-               sameLeftButton = new JButton(new 
ImageIcon(icons.getSameLeftEnabledImage()));
-               sameLeftButton
-                               .setDisabledIcon(new 
ImageIcon(icons.getSameLeftDisabledImage()));
-               sameLeftButton.setEnabled(false);
-               sameLeftButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.setSameLeftCoordinate(designArea);
-                       }
-               });
-
-               sameRightButton = new JButton(new 
ImageIcon(icons.getSameRightEnabledImage()));
-               sameRightButton.setDisabledIcon(new ImageIcon(icons
-                               .getSameRightDisabledImage()));
-               sameRightButton.setEnabled(false);
-
-               sameRightButton.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.setSameRightCoordinate(designArea);
-                       }
-               });
-
-               centerHorizontalButton = new JButton(new 
ImageIcon(icons.getCenterHorEnabledImage()));
-               centerHorizontalButton.setDisabledIcon(new ImageIcon(icons
-                               .getCenterHorDisabledImage()));
-               centerHorizontalButton.setEnabled(false);
-               centerHorizontalButton.addActionListener(new ActionListener() {
-
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.centerHorizontal(designArea);
-                       }
-               });
-
-               centerVerticalButton = new JButton(new 
ImageIcon(icons.getCenterVerEnabledImage()));
-               centerVerticalButton
-                               .setDisabledIcon(new 
ImageIcon(icons.getCenterVerDisabledImage()));
-               centerVerticalButton.setEnabled(false);
-               centerVerticalButton.addActionListener(new ActionListener() {
-
-                       public void actionPerformed(ActionEvent evt) {
-                               DesignArea designArea = 
tabbedPane.getActualDesignArea();
-                           Layout layout = designArea.getMyLayout();
-                           layout.centerVertical(designArea);
-                       }
-               });
-
-               // sets toolbar's buttons border
-               setToolbarButtonBorder(backwardButton);
-               setToolbarButtonBorder(centerHorizontalButton);
-               setToolbarButtonBorder(centerVerticalButton);
-               setToolbarButtonBorder(designPositionButton);
-               setToolbarButtonBorder(forwardButton);
-               setToolbarButtonBorder(sameBottomButton);
-               setToolbarButtonBorder(sameLeftButton);
-               setToolbarButtonBorder(sameRightButton);
-               setToolbarButtonBorder(sameTopButton);
-
-               // there is not need to be focusable
-               this.setFocusable(false);
-               this.backwardButton.setFocusable(false);
-               this.centerHorizontalButton.setFocusable(false);
-               this.centerVerticalButton.setFocusable(false);
-               this.designPositionButton.setFocusable(false);
-               this.forwardButton.setFocusable(false);
-               this.sameBottomButton.setFocusable(false);
-               this.sameLeftButton.setFocusable(false);
-               this.sameRightButton.setFocusable(false);
-               this.sameTopButton.setFocusable(false);
-
-               
-               // 
-               //this.backButton.setMnemonic(KeyEvent.VK_Z);
-               //this.forwardButton.setMnemonic(KeyEvent.VK_Y);
-               
-               // adds tool tip text to buttons
-
-               
designPositionButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.draw"));
-               
backwardButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.back"));
-               
forwardButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.forward"));
-               
sameTopButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.sameTop"));
-               
sameBottomButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.sameBottom"));
-               
sameRightButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.sameRight"));
-               
sameLeftButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.sameLeft"));
-               
centerVerticalButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.centerVertical"));
-               
centerHorizontalButton.setToolTipText(tabbedPane.getProperties().getProperty(
-                               "toolbar.centerHorizontal"));
-
-               // adds buttons to tool bar
-
-               toolBar.add(designPositionButton);
-               toolBar.addSeparator();
-               toolBar.add(backwardButton);
-               toolBar.add(forwardButton);
-               toolBar.addSeparator();
-               toolBar.add(sameTopButton);
-               toolBar.add(sameBottomButton);
-               toolBar.add(sameLeftButton);
-               toolBar.add(sameRightButton);
-               toolBar.addSeparator();
-               toolBar.add(centerHorizontalButton);
-               toolBar.add(centerVerticalButton);
-               toolBar.addSeparator();
-               toolBar.add(propertiesManagerButton);
-       }
-
-
-       /*
-        * Getters & setters
-        */
-
-       /**
-        * Setter for the field tabbedPane
-        * @param tabbedPane
-        *            the tabbedPane to set
-        */
-       public void setTabbedPane(TabbedPane tabbedPane) {
-               this.tabbedPane = tabbedPane;
-       }
-
-       /**
-        * Getter for the field tabbedPane
-        * @return the tabbedPane
-        */
-       public TabbedPane getTabbedPane() {
-               return tabbedPane;
-       }
-
-       /**
-        * Getter for the field propertiesManagerButton
-        * @return the propertiesManagerButton
-        */
-       public JButton getPropertiesManagerButton() {
-               return propertiesManagerButton;
-       }
-
-       /**
-        * Setter for the field propertiesManagerButton
-        * @param propertiesManagerButton
-        *            the propertiesManagerButton to set
-        */
-       public void setPropertiesManagerButton(JButton propertiesManagerButton) 
{
-               this.propertiesManagerButton = propertiesManagerButton;
-       }
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/UnsavedLayoutClosedDialog.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/UnsavedLayoutClosedDialog.java 
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/UnsavedLayoutClosedDialog.java
    2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,153 +0,0 @@
-package applet;
-
-/**
- * UnsavedClosedDialog.java
- * @author Eva Viktorinova
- */
-import java.awt.event.ComponentAdapter;
-import java.awt.event.ComponentEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Properties;
-import javax.swing.JDialog;
-import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-
-/**
- * @class UnsavedClosedDialog
- * Shows dialog where user can choose if unsaved design area should or 
shouldn't be saved before closing, or closing should be canceled 
- *
- */
-@SuppressWarnings("serial")
-public class UnsavedLayoutClosedDialog extends JDialog implements
-               PropertyChangeListener {
-
-       public enum DialogResultOption { /** Result of the unsaved dialog close 
*/
-               YES,            /** save unsaved design area */ 
-               NO,             /** don't save unsaved design area */
-               CANCELED;       /** cancel closing of the design area */
-       }
-
-       private JOptionPane optionPane;                         /** option pane 
*/
-       private String buttonYesName = "Yes";                   /** button 
label for yes action */
-       private String buttonNoName = "No";                             /** 
button label for no action */
-       private String buttonCancelName = "Cancel";             /** button 
label for cancel */
-       private DialogResultOption dialogResult;        /** result of the 
unsaved design area close dialog */
-       private JRootPane rootPane;                                     /** 
root pane of the LayoutDesigner */                  
-
-       /**
-        * Empty constructor of class UnsavedClosedDialog
-        */
-       public UnsavedLayoutClosedDialog(JRootPane rootPane) {
-               this.rootPane = rootPane;
-       }
-
-       /**
-        * Constructor of class UnsavedClosedDialog
-        * 
-        * @param dialog parent dialog where unsaved closed dialog should be 
displayed
-        * @param unsavedLayoutName name of the unsaved layout
-        * @param properties properties
-        */
-       public UnsavedLayoutClosedDialog(JDialog dialog, String 
unsavedLayoutName,
-                       Properties properties) {
-               super(dialog, properties.getProperty("dialog.closeUnsaved"), 
true);
-
-               setTitle(properties.getProperty("dialog.closeUnsaved"));
-
-               String message = 
properties.getProperty("dialog.closeUnsavedQuestion");
-               message += " " + unsavedLayoutName + " ?";
-
-               // initialization of button labels 
-               buttonYesName = properties.getProperty("dialog.yes");
-               buttonNoName = properties.getProperty("dialog.no");
-               buttonCancelName = properties.getProperty("dialog.cancel");
-
-               Object[] options = { buttonYesName, buttonNoName, 
buttonCancelName };
-
-               optionPane = new JOptionPane(message, 
JOptionPane.QUESTION_MESSAGE,
-                               JOptionPane.YES_NO_CANCEL_OPTION, null, 
options, options[2]);
-
-               setContentPane(optionPane);
-
-               setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
-               addWindowListener(new WindowAdapter() {
-                       public void windowClosing(WindowEvent we) {
-                               optionPane.setValue(new 
Integer(JOptionPane.CLOSED_OPTION));
-                       }
-               });
-
-               addComponentListener(new ComponentAdapter() {
-                       public void componentShown(ComponentEvent ce) {
-                       }
-               });
-
-               optionPane.addPropertyChangeListener(this);
-
-       }
-
-       /**
-        * Handles change of property in unsaved design area closed dialog
-        * @param e change of property
-        */
-       public void propertyChange(PropertyChangeEvent e) {
-               String prop = e.getPropertyName();
-
-               if (isVisible()
-                               && (e.getSource() == optionPane)
-                               && (JOptionPane.VALUE_PROPERTY.equals(prop) || 
JOptionPane.INPUT_VALUE_PROPERTY
-                                               .equals(prop))) {
-                       Object value = optionPane.getValue();
-
-                       if (value == JOptionPane.UNINITIALIZED_VALUE) {
-                               return;
-                       }
-
-                       optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
-
-                       if (buttonYesName.equals(value)) {
-                               dialogResult = DialogResultOption.YES;
-                               setVisible(false);
-                       } else if (buttonNoName.equals(value)) {
-                               dialogResult = DialogResultOption.NO;
-                               setVisible(false);
-                       } else {
-                               dialogResult = DialogResultOption.CANCELED;
-                               setVisible(false);
-                       }
-                       
-               }
-       }
-
-       /**
-        * Shows unsaved design area closed dialog
-        * @param properties properties
-        * @param unsavedLayoutName name of the unsaved layout
-        * @return result of the dialog
-        */
-       public DialogResultOption showUnsavedLayoutClosedDialog(
-                       Properties properties, String unsavedLayoutName) {
-               JDialog dialog = new JDialog();
-               UnsavedLayoutClosedDialog unsavedClosedDialog = new 
UnsavedLayoutClosedDialog(
-                               dialog, unsavedLayoutName, properties);
-               dialog.pack();
-               unsavedClosedDialog.pack();
-               unsavedClosedDialog.setLocationRelativeTo(rootPane);
-               unsavedClosedDialog.setVisible(true);
-               return unsavedClosedDialog.getDialogResult();
-       }
-
-       // getters & setters
-
-       /**
-        * Getter of field dialogResult
-        * 
-        * @return the dialogResult
-        */
-       public DialogResultOption getDialogResult() {
-               return dialogResult;
-       }
-
-}

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/WarningDialog.java
===================================================================
--- trunk/layouteditor/LayoutDesigner/src/applet/WarningDialog.java     
2010-02-18 22:32:39 UTC (rev 1789)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/WarningDialog.java
        2010-02-22 02:30:04 UTC (rev 1813)
@@ -1,36 +0,0 @@
-package applet;
-
-/**
- * WarningDialog.java
- * @author EvaV
- */
-
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
-
-@SuppressWarnings("serial")
-/**
- * WarningDialog shows warning dialog to the user
- */
-public class WarningDialog extends JDialog {
-
-       // constructors
-
-       /**
-        * Creates and shows warning dialog with
-        * @param frame frame in which the warning dialog is displayed
-        * @param warningMessage message displayed in the warning dialog
-        * @param warningDialogTitle title of the warning dialog
-        */
-       public WarningDialog(JFrame frame, String warningMessage, String 
warningDialogTitle) {
-               super(frame, warningDialogTitle, true);
-               
-               JOptionPane optionPane = new JOptionPane();
-               add(optionPane);
-               JOptionPane.showMessageDialog(frame, warningMessage, 
warningDialogTitle,
-                               JOptionPane.WARNING_MESSAGE);
-
-       }
-
-}


Other related posts:

  • » [elvystrac] r1813 - rozdeleni do package, uprava vykonu, snap to grid - snapne ve smeru pohybu - elvys