Author: EvaV Date: 2010-02-15 19:59:31 +0100 (Mon, 15 Feb 2010) New Revision: 1738 Modified: trunk/layouteditor/LayoutDesigner/src/applet/AbsoluteCoordinates.java trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java trunk/layouteditor/LayoutDesigner/src/applet/Position.java trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java Log: uprava zamykani, seznam pozici spravne rozmery, pokud se nevybere rozliseni, okno s appletem se zavre, zavirani okna s appletem pri editovani zamknuteho layoutu Modified: trunk/layouteditor/LayoutDesigner/src/applet/AbsoluteCoordinates.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/AbsoluteCoordinates.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/AbsoluteCoordinates.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -49,7 +49,6 @@ this.height = height; } - //TODO: pouzit misto /** * Changes absolute coordinates to be in design area */ Modified: trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/LayoutDesigner.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -65,6 +65,10 @@ /** 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 */ @@ -260,11 +264,9 @@ /** * Closes browser window with LayoutDesigner */ - private void closeLayoutDesignerBrowserWindow() { + public void closeLayoutDesignerBrowserWindow() { - /* String jscmd = "window.close()"; - String jsresult = null; - boolean success = false; + String jscmd = "window.close()"; try { Method getw = null, eval = null; Object jswin = null; @@ -287,14 +289,14 @@ } catch (Exception e) { - }*/ + } } /** * Opens new empty layout */ - private void openNewLayout() { + public void openNewLayout() { ResolutionChoiceDialog resolutionChoiceDialog = new ResolutionChoiceDialog( new JDialog(), properties, @@ -303,6 +305,7 @@ .showResolutionChoiceDialog(); if (screenSizes == null) { + closeLayoutDesignerBrowserWindow(); return; } String newDesignAreaName = tabbedPane.getProperties().getProperty( Modified: trunk/layouteditor/LayoutDesigner/src/applet/Position.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/Position.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/Position.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -605,6 +605,23 @@ int width = (int) Math.ceil(relative.getWidth() * kiosekWidth); int height = (int) Math.ceil(relative.getHeight() * kiosekHeight); + + if(topX < 0) { + topX = 0; + } + + if(topY < 0) { + topY = 0; + } + + if(topX + width > kiosekWidth) { + width = kiosekWidth - topX; + } + + if(topY + height > kiosekHeight) { + height = kiosekHeight - topY; + } + elvys = new AbsoluteCoordinates(topX, topY, width, height); } @@ -620,15 +637,32 @@ monitor = new AbsoluteCoordinates(0, 0, 0, 0); } - int kiosekWidth = screenResolution.getMonitorWidth(); + int monitorWidth = screenResolution.getMonitorWidth(); - int kiosekHeight = screenResolution.getMonitorHeight(); + int monitorHeight = screenResolution.getMonitorHeight(); - int topX = (int) Math.ceil(relative.getTopX() * kiosekWidth); - int topY = (int) Math.ceil(relative.getTopY() * kiosekHeight); - int width = (int) Math.ceil(relative.getWidth() * kiosekWidth); - int height = (int) Math.ceil(relative.getHeight() * kiosekHeight); + int topX = (int) Math.ceil(relative.getTopX() * monitorWidth); + int topY = (int) Math.ceil(relative.getTopY() * monitorHeight); + int width = (int) Math.ceil(relative.getWidth() * monitorWidth); + int height = (int) Math.ceil(relative.getHeight() * monitorHeight); + + if(topX < 0) { + topX = 0; + } + + if(topY < 0) { + topY = 0; + } + + if(topX + width > monitorWidth) { + width = monitorWidth - topX; + } + + if(topY + height > monitorHeight) { + height = monitorHeight - topY; + } + monitor = new AbsoluteCoordinates(topX, topY, width, height); } Modified: trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/PositionsList.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -70,7 +70,7 @@ scroller = new JScrollPane(positionPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scroller.setPreferredSize(new Dimension(100, 200)); + scroller.setPreferredSize(new Dimension(80, 185)); positionList.add(scroller); } Modified: trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/PropertiesManager.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -35,7 +35,7 @@ private boolean isMinimalized; /** flag whatever tab with properties manager is minimalized */ // constants - private final static int LIST_HEIGHT = 400; /** height of the position list component */ + 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 */ Modified: trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java =================================================================== --- trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java 2010-02-15 18:58:10 UTC (rev 1737) +++ trunk/layouteditor/LayoutDesigner/src/applet/ReadLayoutFromServer.java 2010-02-15 18:59:31 UTC (rev 1738) @@ -116,6 +116,10 @@ ResolutionChoiceDialog resolutionChoiceDialog = new ResolutionChoiceDialog( new JDialog(), tabbedPane.getProperties(), resolutions, tabbedPane.getRootPane()); + + if(resolutions == null) { + LayoutDesigner.getInstance().closeLayoutDesignerBrowserWindow(); + } screenResolution = resolutionChoiceDialog .showResolutionChoiceDialog();