|
|
Re: Tabs at bottom instead of top [message #1033631 is a reply to message #1022144] |
Thu, 04 April 2013 09:05   |
Eclipse User |
|
|
|
Andi, thanks for your help with this. For anyone else interested in how to do this, I'll summarise the solution we came up with to make this configurable.
First, we created an interface IBottomAlignedTabBox:
import org.eclipse.scout.rt.client.ui.form.fields.tabbox.ITabBox;
public interface IBottomAlignedTabBox extends ITabBox {
static String PROP_TAB_ALIGNED_BOTTOM = "alignedBottom";
boolean isTabBottomAligned();
void setTabBottomAligned(boolean tabBottomAligned);
}
Next, we created an abstract class AbstractBottomAlignedTabBox:
import org.eclipse.scout.commons.annotations.ConfigProperty;
import org.eclipse.scout.commons.annotations.Order;
import org.eclipse.scout.rt.client.ui.form.fields.tabbox.AbstractTabBox;
public abstract class AbstractBottomAlignedTabBox extends AbstractTabBox implements IBottomAlignedTabBox {
@Override
public boolean isTabBottomAligned() {
return propertySupport.getPropertyBool(PROP_TAB_ALIGNED_BOTTOM);
}
@Override
public void setTabBottomAligned(boolean tabAtBottomAligned) {
propertySupport.setPropertyBool(PROP_TAB_ALIGNED_BOTTOM, tabAtBottomAligned);
}
@ConfigProperty(ConfigProperty.BOOLEAN)
@Order(1000)
protected boolean getConfiguredTabBottomAligned() {
return false;
}
@Override
protected void initConfig() {
super.initConfig();
setTabBottomAligned((getConfiguredTabBottomAligned()));
}
}
Next, we created the Swt class SwtScoutBottomAlignedTabBox
import org.eclipse.scout.rt.ui.swt.form.fields.tabbox.SwtScoutTabBox;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import com.bsiag.minicrm.client.ui.form.fields.ext.IBottomAlignedTabBox;
public class SwtScoutBottomAlignedTabBox extends SwtScoutTabBox {
@Override
protected void attachScout() {
super.attachScout();
updateAlignmentFromScout();
}
@Override
public IBottomAlignedTabBox getScoutObject() {
return (IBottomAlignedTabBox) super.getScoutObject();
}
protected void updateAlignmentFromScout() {
getSwtField().setTabPosition(getScoutObject().isTabBottomAligned() ? SWT.BOTTOM : SWT.TOP);
getSwtContainer().layout(true);
}
@Override
protected void initializeSwt(Composite parent) {
super.initializeSwt(parent);
updateAlignmentFromScout();
}
@Override
protected void handleScoutPropertyChange(String name, Object newValue) {
super.handleScoutPropertyChange(name, newValue);
if (name.equals(IBottomAlignedTabBox.PROP_TAB_ALIGNED_BOTTOM)) {
updateAlignmentFromScout();
}
}
}
Finally, in the SWT plugin.xml we added an entry to the extension point formfields
<extension point="org.eclipse.scout.rt.ui.swt.formfields">
<formField
active="true"
modelClass="org.eclipse.minicrm.client.ui.form.fields.ext.AbstractBottomAlignedTabBox"
name="Bottom Aligned Tab Box"
scope="default">
<uiClass
class="org.eclipse.minicrm.ui.swt.form.fields.ext.SwtScoutBottomAlignedTabBox">
</uiClass>
</formField>
</extension>
This gives us SDK support for the new property when using a "BottomAlignedTabBox" instead of a "TabBox":

And in our client, this looks as follows:

If we were adventurous, we could even swap the position of the tabs at runtime by calling
setTabBottomAligned(!isTabBottomAligned());
[Updated on: Thu, 04 April 2013 09:06] by Moderator
|
|
|
|
|
|
|
|
Re: Tabs at bottom instead of top [message #1059651 is a reply to message #1037281] |
Tue, 21 May 2013 02:13  |
Eclipse User |
|
|
|
Urs Beeli wrote on Tue, 09 April 2013 13:24I'd be happy to do that.
While I'm still willing to put together a patch for this, I simply don't have time at the moment. It might be a while until I get around to it...
|
|
|
Powered by
FUDForum. Page generated in 0.03499 seconds