pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: MDI Kind of implementation simulating JDesktopPane
Date Mon, 21 Mar 2011 20:14:39 GMT
On 20 March 2011 16:58, Pavan Vadavalli <pavan.vadavalli@gmail.com> wrote:

> Main issues concerning for me .
> 1. How to Create this fixed length divided partitions to the main area.
>
As Greg mentioned, you would probably create two Windows ('main display'
&'taskbar'), each of which are as wide as the Display, and positioned as you
need.  Then add a resize listener to the Display so that when its size
changes you can recalculate how to size the windows.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ComponentListener.html

Pivot Sheets position themselves this way, so perhaps take a look at the
following skin class.
http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSheetSkin.java

You might also want to look at the source code for other layout containers
to see how they allocate space.
http://pivot.apache.org/tutorials/layout-containers.html
http://svn.apache.org/repos/asf/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/

See the MenuBar tutorial for an example of how to put a menu into a Window.
http://pivot.apache.org/tutorials/menu-bars.html


2. How can i create a generic container kind of environment that can hold
> all the Frames that i can add at runtime and manage the window
> events,especially considering that in general the containers in Pivot is not
> designed to add Windows.
>
You would still just open Frames as normal, but would specify that your
'main display' Window is the parent, rather than the Display.

You could track these Frames manually by adding them to a list when you open
them, and removing them when they close (via a WindowStateListener).
 Another option would be to listen for new Frames that are attached to your
'main display' window (via ContainerListener). Yet another option might be
to use the 'main display' Window itself as the model via its internal
ownedWindows list (getOwnedWindow, getOwnedWindowCount).
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Window.html#getOwnedWindow(int)
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ContainerListener.html


When you have a list of the Windows you wish to display in your 'taskbar',
you can use to populate a FlowPane or BoxPane. The components used to
represent the Frames might simply be PushButtons with a custom renderer that
will show the icon from the Frame, along with its title text.  If you do use
PushButtons, they might have their 'toggleButton' property set to true, and
be part of a ButtonGroup so that only one will ever show as pressed.  (The
'buttonData' property of the button would probably be a reference to the
actual Frame that it represents on the taskbar) Adding a ButtonPressListener
to the PushButtons would allow you to set the active Window corresponding to
the pressed button.

http://pivot.apache.org/tutorials/push-buttons.html
http://pivot.apache.org/tutorials/toggle-buttons.html
http://pivot.apache.org/tutorials/windows.html
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/PushButton.html
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ButtonGroup.html
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ButtonPressListener.html
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/Window.html#requestActive()
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/ContainerListener.html

You might also want to extend Window and/or Frame to create a custom class
or skin which behaves exactly how you need.  For instance, a maximized
Window will size to fit the Display, but you might not want it to cover your
'task bar'.  Also, clicking on the PushButton (or however you choose to
represent your Frames on the task bar) may result in the relevant window
being hidden (if it is already active), made active or some other custom
action.

Chris

Mime
View raw message