|
|
Re: How to use SnapBox [message #1003434 is a reply to message #1002512] |
Mon, 21 January 2013 08:29 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
Hi Beat
Thanks for your answer. I've come one step closer, but there are still a few questions that remain open.
First, part of my confusion was, that apparently the SnapBox is not fully supported by the SDK, as you cannot add buttons to it through the SDK.
Adding the buttons directly in the code sort of works, but I can't get the same display that your screenshot shows. In Swing there seems to be no implementation of the SnapBox. In SWT I only managed to get iconised buttons that show the name of the outline in the tooltip but have been unable to have the buttons show the name of the outline on them. I've looked at all the properties of the SnapBox but couldn't find anything to chenge this.
Is there any way to adjust this?
As a followup, since this control seems to aim at changing outlines in an SWT application, I would probably want it shown in the main window, not in one of the sub forms. What would the recommended way to place it above or below the tree view on the main form?
-
Attachment: SnapSDK.png
(Size: 4.51KB, Downloaded 1193 times) -
Attachment: SnapOutput.png
(Size: 2.79KB, Downloaded 1167 times)
[Updated on: Mon, 21 January 2013 08:29] Report message to a moderator
|
|
|
Re: How to use SnapBox [message #1004212 is a reply to message #1003434] |
Tue, 22 January 2013 20:14 |
|
Urs Beeli wrote on Mon, 21 January 2013 03:29First, part of my confusion was, that apparently the SnapBox is not fully supported by the SDK, as you cannot add buttons to it through the SDK.
Yes, that seems to be missing. Please open a bug report if you need it.
Quote:
Adding the buttons directly in the code sort of works, but I can't get the same display that your screenshot shows.
My bad! Apparently there is some extended display functionality in an internal plug-in (non-open-source) that produces a view like in the screenshot, I did not notice that. The default look is indeed the one you posted. Unfortunately, it seems to me that this look cannot be altered easily (but you could write your own UI representation, of course).
Quote:As a followup, since this control seems to aim at changing outlines in an SWT application, I would probably want it shown in the main window, not in one of the sub forms. What would the recommended way to place it above or below the tree view on the main form?
When Scout SDK generates a project for you, it creates a class called "Desktop". In this Desktop (= main window) two default forms are put:
@Override
protected void execOpened() throws ProcessingException {
// outline tree
DefaultOutlineTreeForm treeForm = new DefaultOutlineTreeForm();
treeForm.startView();
//outline table
DefaultOutlineTableForm tableForm = new DefaultOutlineTableForm();
tableForm.startView();
if (getAvailableOutlines().length > 0) {
setOutline(getAvailableOutlines()[0]);
}
}
To customize the outline tree, simply replace the DefaultOutlineTreeForm with your own implementation. The code of that class is a good start for your own class. If you look at the source code, you can see that it is a fairly normal form, with a MainBox and everything. Just add your desired fields to that MainBox.
B.
|
|
|
Re: How to use SnapBox [message #1004433 is a reply to message #1004212] |
Wed, 23 January 2013 08:17 |
Urs Beeli Messages: 573 Registered: October 2012 Location: Bern, Switzerland |
Senior Member |
|
|
Hi Beat
Now that I know how to populate the SnapBox, I don't really need the SDK integration any more. Still, I think it would make sense to integrate this fully, so I opened a bug regardless (https://bugs.eclipse.org/bugs/show_bug.cgi?id=398860)
Thanks also for clarifying about the differences in the representation of the UI.
I have - in the mean time - found this post by Andreas Hoegger about integrating the snapbox into the tree view.
As I mentioned in my post on how to switch outlines in SWT that the outline buttons in the snapbox are behaving strangely. Apparently their default display style is DISPLAY_STYLE_TOGGLE. I've added two OutlineButtons to the SnapBox for the two outlines StandardOutline and AdministrationOutlin (from the minicrm tutorial). When I click on the button for AdministrationOutline, the outline is changed. When I then click on the button for the StandardOutline for the first time, nothing happens. When I click on that button the second time, the outline changes. After that, I always have to click the OutlineButton for an outline twice in order to change the outline. I thought this might be related to them having toggle style, but even returning DISPLAY_STYLE_DEFAULT from getConfiguredDisplayStyle() does not change this behaviour.
Is there some obvious mistake I could have made that explains this?
[Updated on: Wed, 23 January 2013 08:24] Report message to a moderator
|
|
|
Re: How to use SnapBox [message #1004933 is a reply to message #1004433] |
Thu, 24 January 2013 07:04 |
|
Quote:Apparently their default display style is DISPLAY_STYLE_TOGGLE.
Yes, but only in the UI, not in the Scout model. I think, this is to give the user a visual hint, which outline currently is selected.
Quote:When I then click on the button for the StandardOutline for the first time, nothing happens. When I click on that button the second time, the outline changes.
It seems to me, that the currently "selected" button is not "un-selected" when another button is pressed. When you click an already selected button, the "selected" value is FALSE, and as you can see in org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutlineButton.execToggleAction(boolean), nothing happens in this case. When clicking one of the buttons, the others should be un-selected. Seems to be worth a bug report...
Quote:I thought this might be related to them having toggle style, but even returning DISPLAY_STYLE_DEFAULT from getConfiguredDisplayStyle() does not change this behaviour.
As previously mentioned, the Scout model's "display style" is not considered for this type of buttons. The Toggle-Style is only applied in the UI (see org.eclipse.scout.rt.ui.swt.form.fields.snapbox.button.SwtScoutMinimizedButton).
Beat
|
|
|
|
|
Re: How to use SnapBox [message #1004952 is a reply to message #1004942] |
Thu, 24 January 2013 07:47 |
|
Quote:I have not been succesful in finding something to take care of SomeMagic.isUsingSWT() but I am sure there is a way to find out which client UI is used? Can anyone give me a hint on how to do this?
org.eclipse.scout.rt.shared.ui.UserAgentUtility (since Scout 3.8.0) provides various methods to find out information about the current execution environment.
Or you could simply check if the SWT plug-in is present:
Platform.getBundle("my.scout.project.ui.swt.core") != null
|
|
|
|
Powered by
FUDForum. Page generated in 0.02676 seconds