[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Finding out the screen size?  XML
Forum Index -> Development
Author Message
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

Hi,

I use few Modal and Modeless Popup where I need to pass width and height into. No problem, I pick some values and they look well on my screen. Using 0,0 for automatic popup sizing is not possible at any time, so I need to stick to this static size definition.

I'm afraid that what works on my screen could look bad on other monitors (Maybe because they're bigger and the Popup looks very small or vice versa).
So my Idea is: If I know the width and height of the client screen then I could implement something adaptive for that screen, e.g. that a Popup opens at 1/3 of the screen height and 2/3 of screen width).

In Code it would look like this:
Code:
     popup.open(
         popupUi.getPageName(),
         this.messageSource.getMessage("popup_headline", getLocale()),
         (getScreenWidth()*2)/3,
         (getScreenHeight())/3,
         new DefaultModalPopupListener(popup)
     );
 


Spontaniously, I have no idea how I would implement getScreenWidth() and getScreenHeight(). Any hints how this can be accomplished, are welcome.

Thanks,

Björn
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5523
Offline

Hi,

within a PANE you may arrange a SIZETRANSFER component.This always passes the current size of the PANE to the server.

(Example: Demo Workplace, Container, Transfer of actual Size)

Regards, Björn

Björn Müller, CaptainCasa GmbH
bthalheim

Power User

Joined: 05/04/2012 11:45:24
Messages: 72
Offline

OK, cool. Thanks.

This works. Even better would bei a possibility to obtain the _screen_ size, because even the outmost CaptainCasa pane is way smaller than the screen (especially in a PageBrowser scenario).

But getting the real screen size is not possible, I presume?

Cheers,

Björn
phuber

Power User
[Avatar]

Joined: 06/08/2010 14:10:58
Messages: 50
Offline

A quick and dirty solution could be ...

There exists a SCREEN GRABBER component (see Demo Workplace -> Screen Grabber).

Take a full screenshot. Use some code to get the width and heigth as shown below ...

Code:
public void onReceiveGrabbedArea(ActionEvent event)
   {
     if (event instanceof BaseActionEventSendImage)
     {
       try
       {
         BufferedImage image = ImageIO.read(new ByteArrayInputStream(
         ((BaseActionEventSendImage) event).getImageBytes()));
         m_hgt = image.getHeight();
         m_wdt = image.getWidth();
       }
       catch (IOException e1)
       {
         System.err.println(e1.getMessage());
       }
     }
   }
 
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team