[elvystrac] r1817 - pridany panely pro taby a kategorie

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

Author: EvaV
Date: 2010-02-23 01:10:51 +0100 (Tue, 23 Feb 2010)
New Revision: 1817

Added:
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/SaveLayoutOnServer.java
Removed:
   trunk/layouteditor/LayoutDesigner/src/applet/
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
Modified:
   
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.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/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/ResolutionChoiceDialog.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/CloseLayout.java
Log:
pridany panely pro taby a kategorie

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/DesignArea.java
   2010-02-23 00:10:51 UTC (rev 1817)
@@ -15,6 +15,7 @@
 import javax.swing.JPanel;
 import javax.swing.border.LineBorder;
 
+import com.elvys.applet.components.TabbedPane.Tab;
 import com.elvys.applet.dialog.WarningDialog;
 import com.elvys.applet.structures.AbsoluteCoordinates;
 import com.elvys.applet.structures.ActionsMemory;
@@ -183,8 +184,10 @@
 
                this.arePositionToPaste = false;
                this.isInDesignMode = false;
-               designArea.setBorder(new LineBorder(Color.black));
 
+               Color lightGray = new Color(211, 211, 211);
+               designArea.setBorder(new LineBorder(lightGray));
+
                this.id = layout.getLayoutPositions().size();
 
                designArea.setLayout(null);
@@ -289,8 +292,59 @@
                                .round((double) monitorY * elvysHeight / 
monitorHeight);
 
        }
+       
+       /**
+        * Generates x coordinate on monitor from x coordinate on elvys
+        * 
+        * @param elvysX
+        *            x coordinate on elvys
+        * @return x coordinate on monitor
+        */
+       public int getMonitorX(int elvysX) {
 
+               if (layout == null) {
+                       return elvysX;
+               }
+
+               int monitorWidth = 
layout.getScreenResolution().getMonitorWidth();
+               int elvysWidth = layout.getScreenResolution().getElvysWidth();
+
+
+               System.out.println(elvysX + " " + monitorWidth + " " + 
elvysWidth);
+               if (elvysWidth == 0) {
+                       return elvysX;
+               }
+
+               return (int) Math.ceil(((double)elvysX / (double)elvysWidth * 
(double)monitorWidth));
+
+       }
+
        /**
+        * Generates y coordinate on monitor from y coordinate on elvys
+        * 
+        * @param elvysY
+        *            y coordinate on elvys
+        * @return y coordinate on monitor
+        */
+       public int getMonitorY(int elvysY) {
+
+               if (layout == null) {
+                       return elvysY;
+               }
+
+               int monitorHeight = 
layout.getScreenResolution().getMonitorHeight();
+               int elvysHeight = layout.getScreenResolution().getElvysHeight();
+
+               if (elvysHeight == 0) {
+                       return elvysY;
+               }
+
+               return (int) Math
+                               .ceil((double)elvysY / (double)elvysHeight * 
(double)monitorHeight);
+
+       }
+
+       /**
         * Decides whatever this mouse location is in the design area
         * 
         * @param x
@@ -938,7 +992,20 @@
                        Positions positions = layout.getLayoutPositions();
                        positions.changeMonitorResolution(designArea, 
oldScreenSizes,
                                        newScreenSizes);
+                       
+                       Tab tab = tabbedPane.getActualTab();
+                       
+                       int leftWidth = 
designArea.getMonitorX(tabbedPane.getLayoutDesigner().getTabPanelSizeWidth());
+                       int bottomHeight = 
designArea.getMonitorY(tabbedPane.getLayoutDesigner().getCategoriesPanelHeight());
+                       
 
+                       tab.getLeftTabPanel().setSize(leftWidth, 
designArea.getHeight());
+                       
+                       tab.getBottomCatPanel().setLocation(leftWidth, 
designArea.getHeight());
+                       tab.getBottomCatPanel().setSize(designArea.getWidth(), 
bottomHeight);
+                       tab.getDesignArea().setLocation(leftWidth, 0);
+                       tab.getDesignArea().setSize(designArea.getWidth(), 
designArea.getHeight());
+
                }
        }
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
       2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/LayoutDesigner.java
       2010-02-23 00:10:51 UTC (rev 1817)
@@ -72,6 +72,10 @@
        /** height of applet */
        private final static int BAR_HEIGHT = 35;
        /** height of all bars */
+       private final static int CATEGORIES_PANEL_HEIGHT = 43;
+       /** height of panel with categories where it isn't possible to design 
position */
+       private final static int TAB_PANEL_SIZE_WIDTH = 39; 
+       /** width of panel with tabs where it isn't possible to design position 
*/
        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";
@@ -117,8 +121,7 @@
                                        }
                                        
                                        String localization = 
ServerSideContext.getInstance().getLocalization();
-                       
-                                       localization = "cs";
+       
                                        
                                        
if(!ServerSideContext.getInstance().getLOCALIZATION().contains(localization)) {
                                                new WarningDialog(new JFrame(), 
NOT_SUPPORTED, WARNING);
@@ -201,8 +204,10 @@
                                                                        
layoutToOpen);
 
                                                        
tabbedPane.addNewTab(layoutToOpen.getName(),
-                                                                       
editedLayoutDesignArea);
-
+                                                                       
editedLayoutDesignArea, 
editedLayoutDesignArea.getMonitorX(TAB_PANEL_SIZE_WIDTH), 
+                                                                       
editedLayoutDesignArea.getMonitorY(CATEGORIES_PANEL_HEIGHT), 
+                                                                       
layoutToOpen.getScreenResolution().getMonitorWidth(), 
+                                                                       
layoutToOpen.getScreenResolution().getMonitorHeight());
                                                        
editedLayoutDesignArea.setTabbedPane(tabbedPane);
 
                                                        tabbedPane.repaint();
@@ -267,7 +272,7 @@
                toolBar.setPreferredSize(componentSizes.getToolBar());
                contentPane.add(toolBar, BorderLayout.PAGE_START);
 
-               tabbedPane = new TabbedPane(properties, 
allPossibleDocumentTypes);
+               tabbedPane = new TabbedPane(properties, 
allPossibleDocumentTypes, this);
                tabbedPane.setPreferredSize(componentSizes.getTabbedPane());
                contentPane.add(tabbedPane, BorderLayout.CENTER);
 
@@ -331,7 +336,7 @@
                                new JDialog(), properties,
                                tabbedPane.getSupportedResolutions(), rootPane);
                ScreenResolution screenSizes = resolutionChoiceDialog
-                               .showResolutionChoiceDialog();
+                               
.showResolutionChoiceDialog(TAB_PANEL_SIZE_WIDTH, CATEGORIES_PANEL_HEIGHT);
 
                if (screenSizes == null) {
                        closeLayoutDesignerBrowserWindow();
@@ -354,7 +359,11 @@
                                newDesignAreaLayout));
 
                DesignArea designArea = new DesignArea(tabbedPane, 
newDesignAreaLayout);
-               tabbedPane.addNewTab(newDesignAreaName, designArea);
+       
+               tabbedPane.addNewTab(newDesignAreaName, designArea, 
designArea.getMonitorX(TAB_PANEL_SIZE_WIDTH), 
+                               
designArea.getMonitorY(CATEGORIES_PANEL_HEIGHT), 
+                               screenSizes.getMonitorWidth(), 
+                               screenSizes.getMonitorHeight());
 
        }
 
@@ -387,5 +396,21 @@
                        }
                }
        }
+       
+       /**
+        * Gets categories panel height
+        * @return the categoriesPanelHeight
+        */
+       public static int getCategoriesPanelHeight() {
+               return CATEGORIES_PANEL_HEIGHT;
+       }
 
+       /**
+        * Gets tab panel width
+        * @return the tabPanelSizeWidth
+        */
+       public static int getTabPanelSizeWidth() {
+               return TAB_PANEL_SIZE_WIDTH;
+       }
+
 }

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java  
    2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/MenuBar.java  
    2010-02-23 00:10:51 UTC (rev 1817)
@@ -11,9 +11,10 @@
 import javax.swing.*;
 
 
+import com.elvys.applet.components.TabbedPane.Tab;
 import com.elvys.applet.dialog.ResolutionChoiceDialog;
 import com.elvys.applet.dialog.SaveAsDialog;
-import com.elvys.applet.dialog.SaveLayoutOnServer;
+import com.elvys.applet.serverCommunication.SaveLayoutOnServer;
 import com.elvys.applet.serverCommunication.ServerSideContext;
 import com.elvys.applet.structures.CloseLayout;
 import com.elvys.applet.structures.Layout;
@@ -229,6 +230,7 @@
 
        /**
         * Changes resolution of the actual design area
+        * 
         */
        private void changeActualDesignAreaResolution() {
 
@@ -236,7 +238,7 @@
                ResolutionChoiceDialog resolutionChoiceDialog = new 
ResolutionChoiceDialog(
                                new JDialog(), properties, 
tabbedPane.getSupportedResolutions(), rootPane);
                ScreenResolution newResolution = resolutionChoiceDialog
-                               .showResolutionChoiceDialog();
+                               
.showResolutionChoiceDialog(tabbedPane.getLayoutDesigner().getTabPanelSizeWidth(),
 tabbedPane.getLayoutDesigner().getCategoriesPanelHeight());
 
                if (newResolution == null) {
                        return;
@@ -259,6 +261,20 @@
 
                actualDesignArea.setSize(actualDesignArea.getWidth(), 
actualDesignArea
                                .getHeight());
+               
+               Tab tab = tabbedPane.getActualTab();
+               
+               int leftWidth = 
actualDesignArea.getMonitorX(tabbedPane.getLayoutDesigner().getTabPanelSizeWidth());
+               int bottomHeight = 
actualDesignArea.getMonitorY(tabbedPane.getLayoutDesigner().getCategoriesPanelHeight());
+               
+
+               tab.getLeftTabPanel().setSize(leftWidth, 
actualDesignArea.getHeight());
+               
+               tab.getBottomCatPanel().setLocation(leftWidth, 
actualDesignArea.getHeight());
+               tab.getBottomCatPanel().setSize(actualDesignArea.getWidth(), 
bottomHeight);
+               tab.getDesignArea().setLocation(leftWidth, 0);
+               tab.getDesignArea().setSize(actualDesignArea.getWidth(), 
actualDesignArea.getHeight());
+               
                actualDesignArea.paintAllPositions();
 
        }

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPane.java
   2010-02-23 00:10:51 UTC (rev 1817)
@@ -4,10 +4,13 @@
  * TabbedPane.java
  * @author Eva Viktorinova
  */
+import java.awt.Color;
 import java.awt.Cursor;
 import java.awt.Graphics;
 import java.util.Properties;
 import java.util.Vector;
+
+import javax.swing.JPanel;
 import javax.swing.JRootPane;
 import javax.swing.JTabbedPane;
 
@@ -34,18 +37,64 @@
        private JRootPane rootPane;                                             
                /** root pane of the LayoutDesigner */
        private ComponentSizes componentSizes;                                  
/** size of components */
        private SupportedResolutions supportedResolutions;              /** 
supported resolutions */
+       private LayoutDesigner layoutDesigner;                                  
/** layout designer */                                  
+               
+       /**
+        * Represents tab in main tabbed pane
+        */
+       public class Tab extends JPanel {
+               private DesignArea designArea;          /** design area */
+               private JPanel leftTabPanel;            /** left panel with 
tabs where it isn't possible to design */
+               private JPanel bottomCatPanel;          /** bottom panel with 
categories where it isn't possible to design */
+               
+               /**
+                * Constructor of the class Tab
+                * @param the designArea design area to set
+                * @param the left tab panel to set
+                * @param the bottom categories panel to set
+                */
+               public Tab(DesignArea designArea, JPanel leftTabPanel, JPanel 
bottomCatPanel) {
+                       this.designArea = designArea;
+                       this.leftTabPanel = leftTabPanel;
+                       this.bottomCatPanel = bottomCatPanel;
+               }
+               
+               /**designAreaPanel
+                * Gets the design area
+                * @return the designArea
+                */
+               public DesignArea getDesignArea() {
+                       return designArea;
+               }
+               
+               /**
+                * Gets the left tab panel
+                * @return the leftTabPanel
+                */
+               public JPanel getLeftTabPanel() {
+                       return leftTabPanel;
+               }
        
+               /**
+                * Gets the bottom categories panel
+                * @return the bottomCatPanel
+                */
+               public JPanel getBottomCatPanel() {
+                       return bottomCatPanel;
+               }
                
-
+       }
        // constructors
        /**
         * Constructor of the class TabbedPane
         * @param properties properties to set
         * @param allTypesOfDocuments all types of documents to set
+        * @param layoutDesigner layout designer to set
         */
-       public TabbedPane(Properties properties, Vector<String> 
allTypesOfDocuments) {
+       public TabbedPane(Properties properties, Vector<String> 
allTypesOfDocuments, LayoutDesigner layoutDesigner) {
                this.setAllTypesOfDocuments(allTypesOfDocuments);
                this.setProperties(properties);
+               this.setLayoutDesigner(layoutDesigner);
                this.setFocusable(false);
        }
 
@@ -54,11 +103,36 @@
         * 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
+        * @param leftWidth the width of the panel with tabs
+        * @param bottomHeight the height of the panel with categories
+        * @param designAreaWidth the width of the design area
+        * @param designAreaHeight the height of the design area 
         */
-       public void addNewTab(String tabName, DesignArea newDesignArea) {
-
-               addTab(tabName, newDesignArea);
-               setSelectedComponent(newDesignArea);
+       public void addNewTab(String tabName, DesignArea newDesignArea, int 
leftWidth, int bottomHeight, int designAreaWidth, int designAreaHeight) {
+                               
+               System.out.println(leftWidth + " : " + bottomHeight);
+               JPanel tabPanel = new JPanel();
+               Color lightGray = new Color(211, 211, 211);
+               tabPanel.setBackground(lightGray);
+               
+               tabPanel.setLocation(0,0);
+               tabPanel.setSize(leftWidth, designAreaHeight);
+               
+               JPanel catPanel = new JPanel();
+               catPanel.setBackground(lightGray);
+               catPanel.setLocation(leftWidth, designAreaHeight);
+               catPanel.setSize(designAreaWidth, bottomHeight);
+               
+               newDesignArea.setLocation(leftWidth,0);
+               newDesignArea.setSize(designAreaWidth, designAreaHeight);
+               Tab tab = new Tab(newDesignArea, tabPanel, catPanel);
+               tab.setLayout(null);
+               tab.add(tabPanel);
+               tab.add(catPanel);
+               tab.add(newDesignArea);
+               
+               addTab(tabName, tab);
+               setSelectedComponent(tab);
                setTabComponentAt(getSelectedIndex(), new 
TabbedPaneCloseTabButton(this,
                                tabName, newDesignArea));
 
@@ -71,7 +145,8 @@
         * @return whatever layout at the give tab is saved
         */
        public boolean isLayoutAtSaved(int layoutTabID) {
-               return ((DesignArea) 
this.getComponentAt(layoutTabID)).isSaved();
+               Tab tab = (Tab)this.getComponentAt(layoutTabID);
+               return tab.getDesignArea().isSaved();
        }
 
        /**
@@ -79,16 +154,23 @@
         * @return whatever layout at actual design area is saved
         */
        public boolean isActualLayoutSaved() {
-               return ((DesignArea) this.getSelectedComponent()).isSaved();
+               return ((Tab) 
this.getSelectedComponent()).getDesignArea().isSaved();
        }
 
        /**
+        * Gets the actual tab
+        * @return the actual tab
+        */
+       public Tab getActualTab() {
+               return ((Tab) this.getSelectedComponent());
+       }
+       /**
         * Gets name of the layout at the given tab
         * @param layoutTabID id of the tab
         * @return name of the layout at the given tab
         */
        public String getLayoutNameAt(int layoutTabID) {
-               return ((DesignArea) this.getComponentAt(layoutTabID))
+               return ((Tab) this.getComponentAt(layoutTabID)).getDesignArea()
                                .getMyLayout().getName();
        }
 
@@ -97,7 +179,7 @@
         * @return name of the layout at the actual design area
         */
        public String getActualLayoutName() {
-               return ((DesignArea) this.getSelectedComponent())
+               return ((Tab) this.getSelectedComponent()).getDesignArea()
                                .getMyLayout().getName();
        }
 
@@ -109,7 +191,7 @@
                if (this.getComponentCount() == 0) {
                        return null;
                }
-               return ((DesignArea) this.getSelectedComponent());
+               return ((Tab) this.getSelectedComponent()).getDesignArea();
        }
 
        /**
@@ -118,7 +200,7 @@
         * @return design area at the given tab
         */
        public DesignArea getDesignAreaAt(int layoutTabID) {
-               return ((DesignArea) this.getComponentAt(layoutTabID));
+               return ((Tab) this.getComponentAt(layoutTabID)).getDesignArea();
        }
 
        
@@ -156,7 +238,7 @@
                        int layoutCount = getTabCount();
                        // setSelectedIndex(0);
                        for (int i = 0; i < layoutCount; ++i) {
-                               DesignArea actual = (DesignArea) 
getComponentAt(i);
+                               DesignArea actual = ((Tab) 
(getComponentAt(i))).getDesignArea();
 
                                String layoutName = actual.getMyLayout()
                                                .getName();
@@ -366,4 +448,20 @@
                return supportedResolutions;
        }
 
+       /**
+        * Sets layout designer
+        * @param layoutDesigner the layoutDesigner to set
+        */
+       public void setLayoutDesigner(LayoutDesigner layoutDesigner) {
+               this.layoutDesigner = layoutDesigner;
+       }
+
+       /**
+        * Gets layout designer
+        * @return the layoutDesigner
+        */
+       public LayoutDesigner getLayoutDesigner() {
+               return layoutDesigner;
+       }
+
 }

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
     2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/TabbedPaneCloseTabButton.java
     2010-02-23 00:10:51 UTC (rev 1817)
@@ -18,7 +18,8 @@
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.plaf.basic.BasicButtonUI;
-
+import com.elvys.applet.structures.Layout;
+import com.elvys.applet.serverCommunication.ServerSideContext;
 import com.elvys.applet.structures.CloseLayout;
 
 
@@ -101,6 +102,14 @@
                        CloseLayout closeDesignArea = new 
CloseLayout(tabbedPane, tabbedPane
                                        .getProperties());
                        closeDesignArea.closeActualLayout(designArea, 
tabbedPane.getRootPane());
+                       Layout layout = 
ServerSideContext.getInstance().getLayout();
+                       if (layout != null) {
+                               try {
+                                       
ServerSideContext.getInstance().unlockLayout();
+                               } catch (Exception ex) {
+                                       ex.printStackTrace();
+                               }
+                       }
                }
 
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
    2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/components/ToolBar.java  
    2010-02-23 00:10:51 UTC (rev 1817)
@@ -353,8 +353,7 @@
                designPositionButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
 
-                               DesignArea selectedDesignArea = (DesignArea) 
tabbedPane
-                                               .getSelectedComponent();
+                               DesignArea selectedDesignArea = 
tabbedPane.getActualDesignArea();
                                boolean isEnabledToDesign = selectedDesignArea
                                                .isInDesignMode();
                                Icons icons = new Icons(urlString);

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
   2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/ResolutionChoiceDialog.java
   2010-02-23 00:10:51 UTC (rev 1817)
@@ -99,10 +99,12 @@
        }
        
        /**
-        * Shows resolution choice dialog and sets resolution of the screens
+        * Shows resolution choice dialog and sets resolution of the screen
+        * @param elvysX width of left panel with tabs that isn't part of the 
design area
+        * @param elvysY height of bottom panel with categories that isn't part 
of the design area
         * @return screen resolution chosen in dialog
         */
-       public ScreenResolution showResolutionChoiceDialog() {
+       public ScreenResolution showResolutionChoiceDialog(int elvysX, int 
elvysY) {
                
                dialog.pack();
                dialog.setLocationRelativeTo(rootPane);
@@ -115,7 +117,7 @@
                }
 
                return new ScreenResolution(resolutionChoiceDialog
-                               .getKioskWidth(), 
resolutionChoiceDialog.getKioskHeight());
+                               .getKioskWidth() - elvysX, 
resolutionChoiceDialog.getKioskHeight() - elvysY);
 
        }
 

Deleted: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
       2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java
       2010-02-23 00:10:51 UTC (rev 1817)
@@ -1,185 +0,0 @@
-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;
-               }
-
-       }
-}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
        2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ReadLayoutFromServer.java
        2010-02-23 00:10:51 UTC (rev 1817)
@@ -136,7 +136,7 @@
                                        }
 
                                        screenResolution = 
resolutionChoiceDialog
-                                                       
.showResolutionChoiceDialog();
+                                                       
.showResolutionChoiceDialog(tabbedPane.getLayoutDesigner().getTabPanelSizeWidth(),
 tabbedPane.getLayoutDesigner().getCategoriesPanelHeight());
                                        
layout.setScreenResolution(screenResolution);
                                }
 

Copied: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/SaveLayoutOnServer.java
 (from rev 1815, 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/dialog/SaveLayoutOnServer.java)
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/SaveLayoutOnServer.java
                          (rev 0)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/SaveLayoutOnServer.java
  2010-02-23 00:10:51 UTC (rev 1817)
@@ -0,0 +1,184 @@
+package com.elvys.applet.serverCommunication;
+
+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.dialog.WarningDialog;
+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;
+               }
+
+       }
+}

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
   2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/serverCommunication/ServerSideContext.java
   2010-02-23 00:10:51 UTC (rev 1817)
@@ -104,7 +104,7 @@
                instance.host = "http://"; + hostAddr + ":" + port;
 
                // for debugging: 
-               // instance.host = "http://localhost:8080/";;
+               //instance.host = "http://localhost:8080/";;
 
        }
 

Modified: 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
===================================================================
--- 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
  2010-02-22 18:30:57 UTC (rev 1816)
+++ 
trunk/layouteditor/LayoutDesigner/src/com/elvys/applet/structures/CloseLayout.java
  2010-02-23 00:10:51 UTC (rev 1817)
@@ -5,8 +5,8 @@
 
 import com.elvys.applet.components.DesignArea;
 import com.elvys.applet.components.TabbedPane;
-import com.elvys.applet.dialog.SaveLayoutOnServer;
 import com.elvys.applet.dialog.UnsavedLayoutClosedDialog;
+import com.elvys.applet.serverCommunication.SaveLayoutOnServer;
 
 /**
  * 


Other related posts:

  • » [elvystrac] r1817 - pridany panely pro taby a kategorie - elvys