Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » How to model a status bar
How to model a status bar [message #1403890] Mon, 28 July 2014 13:24 Go to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
Hi

I am currently thinking about including a status bar in our project. The goal would be to display a progress bar und optionaly one line of text to show the current running task name.

I tried the following:

1) Place a Part directly next to the main container (i.e. a PartSashContainer or the Perspective Stack) in the Controls.

This does not look like it is a supported use case, since the "Container Data" is not evaluated by the renderer and the Part will always be positioned vertically next to the PartSashContainer. Can this be changed, i.e. by a tag?

2) Use a ToolControl as part of a WindowTrim

This works, but has the downside, that the ToolControl is not resized with the application. Is this by design or can this be configured? Is it only possible to inject a Group as the root pane or are there other options?

Thanks for any hints!

Smile
Christoph
Re: How to model a status bar [message #1403893 is a reply to message #1403890] Mon, 28 July 2014 13:40 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5571
Registered: July 2009
Senior Member
The correct way is to use the WindowTrim. I'm not sure what you mean
when saying it is not resized with the application. Do you mean
repositioned?

Tom

On 28.07.14 15:24, Christoph Keimel wrote:
> Hi
>
> I am currently thinking about including a status bar in our project. The
> goal would be to display a progress bar und optionaly one line of text
> to show the current running task name.
> I tried the following:
>
> 1) Place a Part directly next to the main container (i.e. a
> PartSashContainer or the Perspective Stack) in the Controls.
>
> This does not look like it is a supported use case, since the "Container
> Data" is not evaluated by the renderer and the Part will always be
> positioned vertically next to the PartSashContainer. Can this be
> changed, i.e. by a tag?
>
> 2) Use a ToolControl as part of a WindowTrim
>
> This works, but has the downside, that the ToolControl is not resized
> with the application. Is this by design or can this be configured? Is it
> only possible to inject a Group as the root pane or are there other
> options?
>
> Thanks for any hints!
>
> Smile
> Christoph
Re: How to model a status bar [message #1403922 is a reply to message #1403893] Mon, 28 July 2014 15:23 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
I'm trying to get the ProgressBar to be at the right side of the trim bar (and stay there when the size of the application window is changed).

I think, that I am having difficulties because I am using a Group as the root pane.
@PostConstruct
void postConstruct(Group parent) {
	Pane controlsPane = createControls();
	parent.getChildren().add(controlsPane);
}
As the Javadoc of Group says, the Group will always have the size of it's Components, so I don't see a way to anchor something to the right edge of the available space. Trying to inject a BorderPane or AnchorPane will result in a InjectionException.

Am I missing something?

Thomas Schindl wrote on Mon, 28 July 2014 15:40
The correct way is to use the WindowTrim. I'm not sure what you mean
when saying it is not resized with the application. Do you mean
repositioned?

Tom
Re: How to model a status bar [message #1403929 is a reply to message #1403893] Mon, 28 July 2014 15:34 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
To further explain please look at this screenshot:
index.php/fa/18650/0/
The blue box is a Border which surrounds the Group node. There is still space available to the right.
Re: How to model a status bar [message #1403933 is a reply to message #1403929] Mon, 28 July 2014 16:03 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5571
Registered: July 2009
Senior Member
To make a control take the complete space you can tag the element with
"fillspace".

So if you current control is written to take the complete space setting
the tag on it should already be enough.

The other option is that you split out the right part into its own
ToolControl and optionally add another spacer ToolControl

Something like
<WindowTrim>
<ToolControl />
<ToolControl>
<tag>fillspace</tag>
</ToolControl>
</ToolControl />
</QindowTrim>

Tom

On 28.07.14 17:34, Christoph Keimel wrote:
> To further explain please look at this screenshot:
>
> The blue box is a Border which surrounds the Group node. There is still space available to the right.
>
Re: How to model a status bar [message #1404020 is a reply to message #1403933] Tue, 29 July 2014 07:53 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
Hi Tom

thanks for the input! I tried with this ToolControl test:
public class GrowTestBar {
	@PostConstruct
	void postContruct(Group parent) {
		final HBox pane = new HBox();
		pane.setPadding(new Insets(6));
		pane.setAlignment(Pos.CENTER_LEFT);
		pane.setMaxWidth(Double.MAX_VALUE);
		pane.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, null, null)));
		parent.getChildren().add(pane);

		final TextField text = new TextField();
		text.setMaxWidth(Double.MAX_VALUE);
		HBox.setHgrow(text, Priority.ALWAYS);
		pane.getChildren().add(text);
	}
}
Using "fillspace" positions my pane (red border) in the center of the available space. See screenshot:
index.php/fa/18666/0/

The Javadoc of Group says: A Group will take on the collective bounds of its children and is not directly resizable. So I am either missing something, or this is not possible with the Group as main container.

What do you think? Am I "on the wooden track"?

Smile
Christoph
Re: How to model a status bar [message #1404022 is a reply to message #1404020] Tue, 29 July 2014 08:07 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
Found it!

It's possible to set the container using a tag (see class org.eclipse.fx.ui.workbench.renderers.fx.internal.CustomContainerSupport). After I added the tag "Container:HBox" (as well as "fillspace") to the ToolControl my example looks like this:
public class GrowTestBar {
	@PostConstruct
	void postContruct(HBox parent) {
		final HBox pane = new HBox();
		pane.setPadding(new Insets(6));
		pane.setAlignment(Pos.CENTER_LEFT);
		pane.setMaxWidth(Double.MAX_VALUE);
		pane.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID, null, null)));
		parent.getChildren().add(pane);
		HBox.setHgrow(pane, Priority.ALWAYS);

		final TextField text = new TextField();
		text.setMaxWidth(Double.MAX_VALUE);
		HBox.setHgrow(text, Priority.ALWAYS);
		pane.getChildren().add(text);
	}
}
and works perfectly spanning the whole width of the window!
Re: How to model a status bar [message #1404023 is a reply to message #1404022] Tue, 29 July 2014 08:23 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5571
Registered: July 2009
Senior Member
If you look into the git repo you find in org.eclipse.fx.testcases.e4
how I set up a toolbar with a control on the far left and far right.

> <trimBars xmi:id="_W56f0A3tEeSWdaJj_r118A" elementId="org.eclipse.fx.testcases.e4.trimbar.1" side="Bottom">
> <children xsi:type="menu:ToolControl" xmi:id="_yeLf4BZuEeS6JMmOlvf6LA" elementId="org.eclipse.fx.testcases.e4.toolcontrol.2"/>
> <children xsi:type="menu:ToolBar" xmi:id="_YRFHEA3tEeSWdaJj_r118A" elementId="org.eclipse.fx.testcases.e4.toolbar.6">
> <children xsi:type="menu:DirectToolItem" xmi:id="_aERjAA3tEeSWdaJj_r118A" elementId="org.eclipse.fx.testcases.e4.directtoolitem.test" label="Test"/>
> </children>
> <children xsi:type="menu:ToolControl" xmi:id="_zz_cQBZuEeS6JMmOlvf6LA" elementId="org.eclipse.fx.testcases.e4.toolcontrol.3" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.tool.SpacerDummy">
> <tags>fillspace</tags>
> </children>
> <children xsi:type="menu:ToolControl" xmi:id="_0fID8BZuEeS6JMmOlvf6LA" elementId="org.eclipse.fx.testcases.e4.toolcontrol.4" contributionURI="bundleclass://org.eclipse.fx.testcases.e4/org.eclipse.fx.testcases.e4.tool.ProgressControl"/>


Tom

On 29.07.14 10:07, Christoph Keimel wrote:
> Found it!
>
> It's possible to set the container using a tag (see class
> org.eclipse.fx.ui.workbench.renderers.fx.internal.CustomContainerSupport).
> After I added the tag "Container:HBox" (as well as "fillspace") to the
> ToolControl my example looks like this:
> public class GrowTestBar {
> @PostConstruct
> void postContruct(HBox parent) {
> final HBox pane = new HBox();
> pane.setPadding(new Insets(6));
> pane.setAlignment(Pos.CENTER_LEFT);
> pane.setMaxWidth(Double.MAX_VALUE);
> pane.setBorder(new Border(new BorderStroke(Color.RED,
> BorderStrokeStyle.SOLID, null, null)));
> parent.getChildren().add(pane);
> HBox.setHgrow(pane, Priority.ALWAYS);
>
> final TextField text = new TextField();
> text.setMaxWidth(Double.MAX_VALUE);
> HBox.setHgrow(text, Priority.ALWAYS);
> pane.getChildren().add(text);
> }
> } and works perfectly spanning the whole width of the window!
Re: How to model a status bar [message #1404038 is a reply to message #1404023] Tue, 29 July 2014 09:41 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 387
Registered: December 2010
Location: Germany
Senior Member
Cool! Thx!
Re: How to model a status bar [message #1404426 is a reply to message #1404038] Fri, 01 August 2014 09:51 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5571
Registered: July 2009
Senior Member
Hi,

I've added the answer to the Recipes page. See
https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#Position_a_TrimBar_element_to_the_far_right

I encourage any developer here to add reuseable informations to this
wiki - if you are not sure drop me a mail and I'll review it!

In future we could also contribute reuseable snippets to Code
Recommenders Snipmatch [1].

Tom

[1]http://www.codetrails.com/blog/code-recommenders-212-improved-proxy-support-snippet-creation-code-completion

On 29.07.14 11:41, Christoph Keimel wrote:
> Cool! Thx!
Re: How to model a status bar [message #1404432 is a reply to message #1404426] Fri, 01 August 2014 10:57 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5571
Registered: July 2009
Senior Member
BTW - The tag was already speced at
https://wiki.eclipse.org/Efxclipse/Runtime/e4#MTrimElement

Tom

On 01.08.14 11:51, Tom Schindl wrote:
> Hi,
>
> I've added the answer to the Recipes page. See
> https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#Position_a_TrimBar_element_to_the_far_right
>
> I encourage any developer here to add reuseable informations to this
> wiki - if you are not sure drop me a mail and I'll review it!
>
> In future we could also contribute reuseable snippets to Code
> Recommenders Snipmatch [1].
>
> Tom
>
> [1]http://www.codetrails.com/blog/code-recommenders-212-improved-proxy-support-snippet-creation-code-completion
>
> On 29.07.14 11:41, Christoph Keimel wrote:
>> Cool! Thx!
>
Previous Topic:e(fx)clipse CSS validation questions
Next Topic:Console Error Output when using FXCanvas
Goto Forum:
  


Current Time: Sat Feb 28 14:07:20 GMT 2015

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

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