Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Stacking parts vertically without using PartSashContainer(Stacking parts vertically without using PartSashContainer)
Stacking parts vertically without using PartSashContainer [message #1219920] Fri, 06 December 2013 18:34 Go to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
Is there a way to place separate parts vertically without using a PartSashContainer? The PartSashContainer provides nice part management in either a horizontal or vertical layout, but I need to be able to lock it so that the user cannot re-size the parts (it would also be good if the re-size bar could be made invisible). To give an idea of what I'm doing, the main area of the view will be the "meat" of the application view, while a small area on the bottom will be for displaying read-only status information. I don't want the users to be able to re-size that area. If I just place two or more parts into, say a perspective, they are laid out horizontally and that's not what I need.
Re: Stacking parts vertically without using PartSashContainer [message #1219935 is a reply to message #1219920] Fri, 06 December 2013 21:34 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Is this in e(fx)clipse? Then yes. You can use tags to lock the layout!
See http://wiki.eclipse.org/Efxclipse/Runtime/e4#MPartSashContainer

Tom

On 06.12.13 19:34, Joseph Gagnon wrote:
> Is there a way to place separate parts vertically without using a
> PartSashContainer? The PartSashContainer provides nice part management
> in either a horizontal or vertical layout, but I need to be able to lock
> it so that the user cannot re-size the parts (it would also be good if
> the re-size bar could be made invisible). To give an idea of what I'm
> doing, the main area of the view will be the "meat" of the application
> view, while a small area on the bottom will be for displaying read-only
> status information. I don't want the users to be able to re-size that
> area. If I just place two or more parts into, say a perspective, they
> are laid out horizontally and that's not what I need.
Re: Stacking parts vertically without using PartSashContainer [message #1220073 is a reply to message #1219935] Mon, 09 December 2013 14:05 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
I guess it's two questions in one. One is whether a part sash container can be locked so that the user cannot resize the different parts contained within. If the answer to the first question was no (which I know now is not the case), how could I vertically stack two or more parts without using a part sash container. It now appears the second question is moot.

I tried what you suggested but it didn't do what I needed. I think part of what might be complicating things is that the main part of the UI is dynamically built based upon a user menu selection. As an example, the user may choose to monitor message traffic. They can choose from one of four ways to do this: incoming, outgoing, in time sequence or both incoming and outgoing. In all cases, a message display shows the message data. This view is the same for all choices. The last choice would present two message display views stacked one above the other. The two views are identical except for the "type" of message (incoming vs outgoing traffic) they are displaying. Finally, at the bottom of the window is a small (vertically) area for displaying read-only status information. Each of these views are a separate "part" (unless I find it should be structured differently).

I want the status area to always remain small and not re-sizable. However, the main part could present a resizing capability if the choice to view both directions of message traffic is chosen (obviously the other choices do not have this).

I tried setting the "fx_fixedLayout" tag for my sash container, but when I did so, my UI screen was rendered in the upper left corner instead of filling the area. I then tried adding a part sash container within the original sash container and set its container data to 950 and then added a part and set its container data to 50. I changed switched the sash container names so that when the UI was built (by menu choice), it would add my parts to the inner sash. This didn't work either. If anything it was worse, with my UI crunched way into the upper left corner. I must be doing something really wrong. Perhaps I need to construct my UI in a different way?
Re: Stacking parts vertically without using PartSashContainer [message #1220074 is a reply to message #1220073] Mon, 09 December 2013 14:10 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
On 09.12.13 15:05, Joseph Gagnon wrote:
> I guess it's two questions in one. One is whether a part sash container
> can be locked so that the user cannot resize the different parts
> contained within. If the answer to the first question was no (which I
> know now is not the case), how could I vertically stack two or more
> parts without using a part sash container. It now appears the second
> question is moot.
>
> I tried what you suggested but it didn't do what I needed. I think part
> of what might be complicating things is that the main part of the UI is
> dynamically built based upon a user menu selection. As an example, the
> user may choose to monitor message traffic. They can choose from one of
> four ways to do this: incoming, outgoing, in time sequence or both
> incoming and outgoing. In all cases, a message display shows the message
> data. This view is the same for all choices. The last choice would
> present two message display views stacked one above the other. The two
> views are identical except for the "type" of message (incoming vs
> outgoing traffic) they are displaying. Finally, at the bottom of the
> window is a small (vertically) area for displaying read-only status
> information. Each of these views are a separate "part" (unless I find it
> should be structured differently).
>
> I want the status area to always remain small and not re-sizable.
> However, the main part could present a resizing capability if the choice
> to view both directions of message traffic is chosen (obviously the
> other choices do not have this).
>
> I tried setting the "fx_fixedLayout" tag for my sash container, but when
> I did so, my UI screen was rendered in the upper left corner instead of
> filling the area. I then tried adding a part sash container within the
> original sash container and set its container data to 950 and then added
> a part and set its container data to 50. I changed switched the sash
> container names so that when the UI was built (by menu choice), it would
> add my parts to the inner sash. This didn't work either. If anything it
> was worse, with my UI crunched way into the upper left corner. I must be
> doing something really wrong. Perhaps I need to construct my UI in a
> different way?
>

containerData is NOT evaluated. You need to use the tags defined in
MPartSashContainerElement on the various children, e.g. fx_layout_width
to fix the width, fx_layout_grab_horizontal to make up the complte
h-space, ...

Tom
Re: Stacking parts vertically without using PartSashContainer [message #1220108 is a reply to message #1220074] Mon, 09 December 2013 18:59 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

Joseph, could you open up an enhancement request against Platform UI ? This should be trivial to implement if we were to honor the existing 'NO_DRAG' tag on PartSashContainers...it likely won't be exactly what you want since it'll still size proportionally but it'll be closer to what you want.
Re: Stacking parts vertically without using PartSashContainer [message #1220118 is a reply to message #1220074] Mon, 09 December 2013 20:41 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
If I understand it correctly, I can lock a sash pane so that it cannot be re-sized by a user, but I then need to specify either a set size in height or width -or- set to grab all horizontal or vertical space for the part(s) added to that sash. Have I got that correct?

The thing I liked about the "regular" way is that via the container data property you could in essence define the percentage of the vertical (or horizontal) space would be occupied by a given part. [Side note: This technique (the property) seems a little odd for controlling the size of major UI compoents.] So for example, let's assume I use a sash pane with vertical direction and add 3 parts to it. They will be stacked one on top of the other. However, if I change the container data for the three to be, say, 400, 500 and 100, respectively, the top pane will take 40% of the vertical space, the middle pane, 50% and the bottom pane only 10%. This was more or less preserved even when the application window is re-sized. It doesn't look that's an option in the scenario above.
Re: Stacking parts vertically without using PartSashContainer [message #1220173 is a reply to message #1220118] Tue, 10 December 2013 08:37 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
No it is not, but it could be implemented as well in the current
renderer, another option to fix this yourself would be to create your
own renderer - which is dead simple in e(fx)clipse - who exhibits your
behavior.

The best option would be to teach the fixed sash this type of layout,
the fixed layout is implemented using a GridLayoutPane (which is a port
of SWT-GridLayout).

IIRC there's no fx-layout-pane yet which would exhibit your requested
behavior so the first would be to develop a layout who uses ratios
instead of absolute values.

Tom

On 09.12.13 21:41, Joseph Gagnon wrote:
> If I understand it correctly, I can lock a sash pane so that it cannot
> be re-sized by a user, but I then need to specify either a set size in
> height or width -or- set to grab all horizontal or vertical space for
> the part(s) added to that sash. Have I got that correct?
>
> The thing I liked about the "regular" way is that via the container data
> property you could in essence define the percentage of the vertical (or
> horizontal) space would be occupied by a given part. [Side note: This
> technique (the property) seems a little odd for controlling the size of
> major UI compoents.] So for example, let's assume I use a sash pane with
> vertical direction and add 3 parts to it. They will be stacked one on
> top of the other. However, if I change the container data for the three
> to be, say, 400, 500 and 100, respectively, the top pane will take 40%
> of the vertical space, the middle pane, 50% and the bottom pane only
> 10%. This was more or less preserved even when the application window is
> re-sized. It doesn't look that's an option in the scenario above.
Re: Stacking parts vertically without using PartSashContainer [message #1220220 is a reply to message #1220173] Tue, 10 December 2013 13:14 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
> No it is not, but it could be implemented as well in the current
> renderer, another option to fix this yourself would be to create your
> own renderer - which is dead simple in e(fx)clipse - who exhibits your
> behavior.

If you say so. It certainly appeared to behave that way to me, but I certainly didn't try all sorts of tests on it to see what happened. Also, a section in Lars Vogel's E4 RCP tutorial (http://www.vogella.com/articles/EclipseRCP/article.html#tutorial_modelelementslayout) seems to indicate that it can be used for that. That being said, I will try to effect layout behavior in other ways.

I'm somewhat confused about your references to JavaFX in this situation, as I was dealing with the E4 part sash container, which I assumed is handled by the E4 framework. Is it being rendered by JavaFX by virtue of the fact that I'm using JavaFX as the UI renderer for the UI components contained within the parts?

Regarding your statement on creating my own renderer, could you point me to examples of how that is done?
Re: Stacking parts vertically without using PartSashContainer [message #1220222 is a reply to message #1220108] Tue, 10 December 2013 13:15 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
Eric,

How do I go about submitting the enhancement request as you suggest?
Re: Stacking parts vertically without using PartSashContainer [message #1220226 is a reply to message #1220220] Tue, 10 December 2013 13:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

There are 2 ways use JavaFX:
1. use the e4 swt renderer and embed JavaFX using FXCanvas
2. run e4 on JavaFX (no SWT involved!)

From what I got until now is that you are running with option (2) so
there's no SWT involved at all anymore and all and everything is
rendered by JavaFX (e.g. as SashContainer is renderer using a
JavaFX-SplitPane or GridLayoutPane).

If I got all the information you give us right you want something in
between SplitPane and GridLayoutPane where you can give components are
ratio. The GridLayoutPane only provides fixed sizes + the possibility to
fill up the rest.

Creating your own renderer is fairly easy:
a) you need to subclass DefWorkbenchRendererFactory
b) you need to subclass DefSashRenderer
c) you need to make your RendererFactory the customized DefSashRenderer
subclass
d) in your DefSashRenderer you need to provide return a class which
implements WSash<Node>
e) you need to make the system use your custom renderer-factory by
adding adding a property with name "rendererFactoryUri" and the value
"bundleclass:/"-url to your custom factory

Tom

On 10.12.13 14:14, Joseph Gagnon wrote:
>> No it is not, but it could be implemented as well in the current
>> renderer, another option to fix this yourself would be to create your
>> own renderer - which is dead simple in e(fx)clipse - who exhibits your
>> behavior.
>
> If you say so. It certainly appeared to behave that way to me, but I
> certainly didn't try all sorts of tests on it to see what happened.
> Also, a section in Lars Vogel's E4 RCP tutorial
> (http://www.vogella.com/articles/EclipseRCP/article.html#tutorial_modelelementslayout)
> seems to indicate that it can be used for that. That being said, I will
> try to effect layout behavior in other ways.
>
> I'm somewhat confused about your references to JavaFX in this situation,
> as I was dealing with the E4 part sash container, which I assumed is
> handled by the E4 framework. Is it being rendered by JavaFX by virtue of
> the fact that I'm using JavaFX as the UI renderer for the UI components
> contained within the parts?
>
> Regarding your statement on creating my own renderer, could you point me
> to examples of how that is done?
Re: Stacking parts vertically without using PartSashContainer [message #1220228 is a reply to message #1220226] Tue, 10 December 2013 13:49 Go to previous messageGo to next message
Joseph Gagnon is currently offline Joseph GagnonFriend
Messages: 68
Registered: June 2013
Member
> There are 2 ways use JavaFX:
> 1. use the e4 swt renderer and embed JavaFX using FXCanvas
> 2. run e4 on JavaFX (no SWT involved!)
>
> From what I got until now is that you are running with option (2) so
> there's no SWT involved at all anymore and all and everything is
> rendered by JavaFX (e.g. as SashContainer is renderer using a
> JavaFX-SplitPane or GridLayoutPane).

Yes I am using option 2. OK, so that makes sense that the E4 layout components (i.e. the sash container) are renedered via JavaFX.

> If I got all the information you give us right you want something in
> between SplitPane and GridLayoutPane where you can give components are
> ratio. The GridLayoutPane only provides fixed sizes + the possibility to
> fill up the rest.

I've experimented with the idea of using the SplitPane to provide the ability to re-size the message display views (for those instances where more than one is showing). I'd probably also just put the status message in the bottom portion of a BorderPane, while the message viewers would be placed in the center pane. I haven't looked at the GridLayoutPane. I'll have to spend some time with that, as I used the GridLayout extensively when I worked with SWT.

I will investigate your suggestion for developing my own renderer. Are there any articles online that go over that in more detail?
Re: Stacking parts vertically without using PartSashContainer [message #1220231 is a reply to message #1220228] Tue, 10 December 2013 14:03 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
[...]

> I will investigate your suggestion for developing my own renderer. Are
> there any articles online that go over that in more detail?

Not that I know of but it is fairly straight forward. e(fx)clipse
renderer system (unlike the e4 SWT one) is designed very carefully to
make it as simple as possible to contribute your own renderer.

I'd suggest you checkout our source from git and import:
org.eclipse.fx.ui.workbench.base
org.eclipse.fx.ui.workbench.fx
org.eclipse.fx.ui.workbench.renderers.base
org.eclipse.fx.ui.workbench.renderers.fx

If you have question then please ask them at the efxclipse forum because
nothing applies to e4 in general.

Naturally if you've gone through the process it would be great if you'd
document them in a wiki page for others how to approach this.

Tom
Re: Stacking parts vertically without using PartSashContainer [message #1220284 is a reply to message #1220222] Tue, 10 December 2013 20:17 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric MoffattFriend
Messages: 118
Registered: July 2009
Senior Member

Joseph, already done, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=423748

Which ever way you decide to go this is still a good idea for us...Wink
Re: Stacking parts vertically without using PartSashContainer [message #1220341 is a reply to message #1220284] Wed, 11 December 2013 08:27 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
And this one is the bugzilla for JavaFx
https://bugs.eclipse.org/bugs/show_bug.cgi?id=423770

Tom

On 10.12.13 21:17, Eric Moffatt wrote:
>
> Joseph, already done, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=423748
>
> Which ever way you decide to go this is still a good idea for us...;)
>
Previous Topic:Create extendable PopupMenu for an SWT Component via EMenuService
Next Topic: Debug Perspective not switching after clicking Yes on "Confirm Perspective switch"
Goto Forum:
  


Current Time: Fri Apr 19 13:42:13 GMT 2024

Powered by FUDForum. Page generated in 0.02950 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top