SEBSERV-203 fixed

This commit is contained in:
anhefti 2021-06-29 13:26:21 +02:00
parent d76f1f5ca9
commit 24d5c4feea
4 changed files with 33 additions and 19 deletions

View file

@ -61,9 +61,10 @@ public class ActionPane implements TemplateComposer {
@Override @Override
public void compose(final PageContext pageContext) { public void compose(final PageContext pageContext) {
final Composite root = pageContext.getParent();
final Map<String, Tree> actionTrees = new HashMap<>(); final Map<String, Tree> actionTrees = new HashMap<>();
final Label label = this.widgetFactory.labelLocalized( final Label label = this.widgetFactory.labelLocalized(
pageContext.getParent(), root,
CustomVariant.TEXT_H2, CustomVariant.TEXT_H2,
TITLE_KEY); TITLE_KEY);
@ -75,10 +76,24 @@ public class ActionPane implements TemplateComposer {
} }
label.setLayoutData(titleLayout); label.setLayoutData(titleLayout);
final Composite scroll = PageService.createManagedVScrolledComposite(
root,
scrolledComposite -> {
final Composite composite = new Composite(scrolledComposite, SWT.NONE);
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
final GridLayout gridLayout = new GridLayout();
gridLayout.horizontalSpacing = 0;
gridData.heightHint = 0;
composite.setLayoutData(gridData);
composite.setLayout(gridLayout);
return composite;
},
false, false, true);
label.setData( label.setData(
PageEventListener.LISTENER_ATTRIBUTE_KEY, PageEventListener.LISTENER_ATTRIBUTE_KEY,
(ActionPublishEventListener) event -> { (ActionPublishEventListener) event -> {
final Composite parent = pageContext.getParent(); final Composite parent = scroll;
final Tree treeForGroup = getTreeForGroup(actionTrees, parent, event.action.definition, true); final Tree treeForGroup = getTreeForGroup(actionTrees, parent, event.action.definition, true);
final TreeItem actionItem = ActionPane.this.widgetFactory.treeItemLocalized( final TreeItem actionItem = ActionPane.this.widgetFactory.treeItemLocalized(
treeForGroup, treeForGroup,
@ -101,18 +116,10 @@ public class ActionPane implements TemplateComposer {
parent.layout(); parent.layout();
}); });
final Composite composite = new Composite(pageContext.getParent(), SWT.NONE); scroll.setData(
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
final GridLayout gridLayout = new GridLayout();
gridLayout.horizontalSpacing = 0;
gridData.heightHint = 0;
composite.setLayoutData(gridData);
composite.setLayout(gridLayout);
composite.setData(
PageEventListener.LISTENER_ATTRIBUTE_KEY, PageEventListener.LISTENER_ATTRIBUTE_KEY,
(ActionActivationEventListener) event -> { (ActionActivationEventListener) event -> {
final Composite parent = pageContext.getParent(); final Composite parent = scroll;
for (final ActionDefinition ad : event.actions) { for (final ActionDefinition ad : event.actions) {
final TreeItem actionItem = findAction(actionTrees, parent, ad); final TreeItem actionItem = findAction(actionTrees, parent, ad);
if (actionItem == null) { if (actionItem == null) {

View file

@ -378,7 +378,7 @@ public interface PageService {
final Composite parent, final Composite parent,
final Function<ScrolledComposite, Composite> contentFunction, final Function<ScrolledComposite, Composite> contentFunction,
final boolean showScrollbars) { final boolean showScrollbars) {
return createManagedVScrolledComposite(parent, contentFunction, showScrollbars, false); return createManagedVScrolledComposite(parent, contentFunction, showScrollbars, true, false);
} }
/** Creates a ScrolledComposite with content supplied the given content creation function. /** Creates a ScrolledComposite with content supplied the given content creation function.
@ -391,16 +391,21 @@ public interface PageService {
* @param parent the parent Composite of the ScrolledComposite * @param parent the parent Composite of the ScrolledComposite
* @param contentFunction the content creation function * @param contentFunction the content creation function
* @param showScrollbars indicates whether the scrollbar shall always be shown * @param showScrollbars indicates whether the scrollbar shall always be shown
* @param showBorder indicates whether a border is shown for the composite or not
* @param fill indicates if the content shall be vertically filled * @param fill indicates if the content shall be vertically filled
* @return the child composite that is scrolled by the newly created ScrolledComposite */ * @return the child composite that is scrolled by the newly created ScrolledComposite */
static Composite createManagedVScrolledComposite( static Composite createManagedVScrolledComposite(
final Composite parent, final Composite parent,
final Function<ScrolledComposite, Composite> contentFunction, final Function<ScrolledComposite, Composite> contentFunction,
final boolean showScrollbars, final boolean showScrollbars,
final boolean showBorder,
final boolean fill) { final boolean fill) {
final ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL); final ScrolledComposite scrolledComposite = new ScrolledComposite(
scrolledComposite.setLayoutData(new GridData(SWT.FILL, (fill) ? SWT.FILL : SWT.TOP, true, true)); parent,
(showBorder) ? SWT.BORDER | SWT.V_SCROLL : SWT.V_SCROLL);
final GridData gridData = new GridData(SWT.FILL, (fill) ? SWT.FILL : SWT.TOP, true, true);
scrolledComposite.setLayoutData(gridData);
final Composite content = contentFunction.apply(scrolledComposite); final Composite content = contentFunction.apply(scrolledComposite);
scrolledComposite.setContent(content); scrolledComposite.setContent(content);

View file

@ -323,6 +323,7 @@ public class WidgetFactory {
return g; return g;
}, },
false, false,
true,
false); false);
} }
@ -340,6 +341,7 @@ public class WidgetFactory {
return g; return g;
}, },
false, false,
true,
true); true);
} }

View file

@ -3,7 +3,8 @@
color: #4a4a4a; color: #4a4a4a;
background-image: none; background-image: none;
background-color: #FFFFFF; background-color: #FFFFFF;
padding: 0; padding: 0;
border: none;
} }
*:disabled { *:disabled {
@ -142,10 +143,9 @@ Label.colorlight {
Composite { Composite {
background-color: transparent; background-color: transparent;
border: none;
} }
Composite.bordered { Composite.bordered {
border: 2px; border: 2px;
} }
@ -402,7 +402,7 @@ Combo-Field {
padding: 3px 0px 1px 10px; padding: 3px 0px 1px 10px;
} }
Combo.error, , Combo[BORDER].error { Combo.error, Combo[BORDER].error {
border: 1px solid #aa0000; border: 1px solid #aa0000;
border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0;
} }