SEBSERV-45 SEBSERV-48 added v-scrolling to main content page
This commit is contained in:
parent
bdf8ea8bd9
commit
66608e0953
5 changed files with 28 additions and 15 deletions
|
@ -82,12 +82,18 @@ public class MainPage implements TemplateComposer {
|
||||||
navLayout.marginWidth = 0;
|
navLayout.marginWidth = 0;
|
||||||
nav.setLayout(navLayout);
|
nav.setLayout(navLayout);
|
||||||
|
|
||||||
final Composite content = new Composite(mainSash, SWT.NONE);
|
final Composite content = PageService.createManagedVScrolledComposite(
|
||||||
content.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
mainSash,
|
||||||
final GridLayout contentOuterlayout = new GridLayout();
|
scrolledComposite -> {
|
||||||
contentOuterlayout.marginHeight = 0;
|
final Composite reusult = new Composite(scrolledComposite, SWT.NONE);
|
||||||
contentOuterlayout.marginWidth = 0;
|
reusult.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||||
content.setLayout(contentOuterlayout);
|
final GridLayout contentOuterlayout = new GridLayout();
|
||||||
|
contentOuterlayout.marginHeight = 0;
|
||||||
|
contentOuterlayout.marginWidth = 0;
|
||||||
|
reusult.setLayout(contentOuterlayout);
|
||||||
|
return reusult;
|
||||||
|
},
|
||||||
|
false);
|
||||||
|
|
||||||
final Label toggleView = this.widgetFactory.imageButton(
|
final Label toggleView = this.widgetFactory.imageButton(
|
||||||
ImageIcon.MAXIMIZE,
|
ImageIcon.MAXIMIZE,
|
||||||
|
@ -130,7 +136,7 @@ public class MainPage implements TemplateComposer {
|
||||||
event.action.pageContext().copyOf(contentObjects)), 2));
|
event.action.pageContext().copyOf(contentObjects)), 2));
|
||||||
|
|
||||||
final Composite actionPane = new Composite(mainSash, SWT.NONE);
|
final Composite actionPane = new Composite(mainSash, SWT.NONE);
|
||||||
actionPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
actionPane.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
|
||||||
final GridLayout actionPaneGrid = new GridLayout();
|
final GridLayout actionPaneGrid = new GridLayout();
|
||||||
actionPane.setLayout(actionPaneGrid);
|
actionPane.setLayout(actionPaneGrid);
|
||||||
actionPane.setData(RWT.CUSTOM_VARIANT, "actionPane");
|
actionPane.setData(RWT.CUSTOM_VARIANT, "actionPane");
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.ScrolledComposite;
|
import org.eclipse.swt.custom.ScrolledComposite;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -187,14 +188,16 @@ public interface PageService {
|
||||||
scrolledComposite.setContent(content);
|
scrolledComposite.setContent(content);
|
||||||
scrolledComposite.setExpandHorizontal(true);
|
scrolledComposite.setExpandHorizontal(true);
|
||||||
scrolledComposite.setExpandVertical(true);
|
scrolledComposite.setExpandVertical(true);
|
||||||
scrolledComposite.setSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
final Point parentSize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
scrolledComposite.setSize(parentSize);
|
||||||
if (showScrollbars) {
|
if (showScrollbars) {
|
||||||
scrolledComposite.setAlwaysShowScrollBars(true);
|
scrolledComposite.setAlwaysShowScrollBars(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Runnable update = () -> {
|
final Runnable update = () -> {
|
||||||
scrolledComposite.setMinSize(content.computeSize(SWT.DEFAULT - 20, SWT.DEFAULT));
|
final Point computeSize = content.computeSize(SWT.DEFAULT - 20, SWT.DEFAULT);
|
||||||
;
|
scrolledComposite.setMinSize(computeSize);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
scrolledComposite.addListener(SWT.Resize, event -> update.run());
|
scrolledComposite.addListener(SWT.Resize, event -> update.run());
|
||||||
|
|
|
@ -100,8 +100,8 @@ public class EntityTable<ROW extends Entity> {
|
||||||
layout.horizontalSpacing = 0;
|
layout.horizontalSpacing = 0;
|
||||||
layout.verticalSpacing = 0;
|
layout.verticalSpacing = 0;
|
||||||
this.composite.setLayout(layout);
|
this.composite.setLayout(layout);
|
||||||
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true);
|
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
|
||||||
gridData.heightHint = (pageSize + 2) * 40;
|
// gridData.heightHint = (pageSize + 2) * 40;
|
||||||
this.composite.setLayoutData(gridData);
|
this.composite.setLayoutData(gridData);
|
||||||
|
|
||||||
// TODO just for debugging, remove when tested
|
// TODO just for debugging, remove when tested
|
||||||
|
@ -296,6 +296,9 @@ public class EntityTable<ROW extends Entity> {
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final GridData gridData = (GridData) this.composite.getLayoutData();
|
||||||
|
gridData.heightHint = (this.table.getItemCount() + 2) * 50;
|
||||||
|
|
||||||
this.composite.layout(true, true);
|
this.composite.layout(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,8 @@ public class TableNavigator {
|
||||||
|
|
||||||
TableNavigator(final EntityTable<?> entityTable) {
|
TableNavigator(final EntityTable<?> entityTable) {
|
||||||
this.composite = new Composite(entityTable.composite, SWT.NONE);
|
this.composite = new Composite(entityTable.composite, SWT.NONE);
|
||||||
this.composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
|
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
|
||||||
|
this.composite.setLayoutData(gridData);
|
||||||
|
|
||||||
// TODO just for debugging, remove when tested
|
// TODO just for debugging, remove when tested
|
||||||
// this.composite.setBackground(new Color(entityTable.composite.getDisplay(), new RGB(200, 0, 0)));
|
// this.composite.setBackground(new Color(entityTable.composite.getDisplay(), new RGB(200, 0, 0)));
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class WidgetFactory {
|
||||||
public Composite defaultPageLayout(final Composite parent, final LocTextKey title) {
|
public Composite defaultPageLayout(final Composite parent, final LocTextKey title) {
|
||||||
final Composite defaultPageLayout = defaultPageLayout(parent);
|
final Composite defaultPageLayout = defaultPageLayout(parent);
|
||||||
final Label labelLocalizedTitle = labelLocalizedTitle(defaultPageLayout, title);
|
final Label labelLocalizedTitle = labelLocalizedTitle(defaultPageLayout, title);
|
||||||
final GridData gridData = new GridData(SWT.TOP, SWT.LEFT, true, false);
|
final GridData gridData = new GridData(SWT.TOP, SWT.TOP, true, false);
|
||||||
labelLocalizedTitle.setLayoutData(gridData);
|
labelLocalizedTitle.setLayoutData(gridData);
|
||||||
return defaultPageLayout;
|
return defaultPageLayout;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public class WidgetFactory {
|
||||||
|
|
||||||
final Composite defaultPageLayout = defaultPageLayout(parent);
|
final Composite defaultPageLayout = defaultPageLayout(parent);
|
||||||
final Label labelLocalizedTitle = labelLocalizedTitle(defaultPageLayout, title);
|
final Label labelLocalizedTitle = labelLocalizedTitle(defaultPageLayout, title);
|
||||||
labelLocalizedTitle.setLayoutData(new GridData(SWT.TOP, SWT.LEFT, true, false));
|
labelLocalizedTitle.setLayoutData(new GridData(SWT.TOP, SWT.TOP, true, false));
|
||||||
return defaultPageLayout;
|
return defaultPageLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue