Home » Eclipse Projects » Eclipse 4 » Stacking parts vertically without using PartSashContainer(Stacking parts vertically without using PartSashContainer)
| |
Re: Stacking parts vertically without using PartSashContainer [message #1220073 is a reply to message #1219935] |
Mon, 09 December 2013 14:05 |
Joseph Gagnon 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 |
Thomas Schindl 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 #1220118 is a reply to message #1220074] |
Mon, 09 December 2013 20:41 |
Joseph Gagnon 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 |
Thomas Schindl 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 #1220226 is a reply to message #1220220] |
Tue, 10 December 2013 13:39 |
Thomas Schindl 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?
|
|
| | | | |
Goto Forum:
Current Time: Thu Sep 26 04:05:37 GMT 2024
Powered by FUDForum. Page generated in 0.05568 seconds
|