SEBSERV-45 some styles and GridTable adaptColumnWidth with TODO
This commit is contained in:
parent
e90bf79034
commit
f95485fb7d
5 changed files with 42 additions and 57 deletions
|
@ -193,7 +193,8 @@ public class TableFieldBuilder extends AbstractTableFieldBuilder {
|
||||||
new ModalInputDialog<Map<Long, TableValue>>(
|
new ModalInputDialog<Map<Long, TableValue>>(
|
||||||
this.control.getShell(),
|
this.control.getShell(),
|
||||||
this.tableContext.getWidgetFactory())
|
this.tableContext.getWidgetFactory())
|
||||||
.setDialogWidth(500)
|
.setDialogWidth(600)
|
||||||
|
.setDialogHeight(550)
|
||||||
.open(
|
.open(
|
||||||
ExamConfigurationService.getTablePopupTitleKey(
|
ExamConfigurationService.getTablePopupTitleKey(
|
||||||
this.attribute,
|
this.attribute,
|
||||||
|
|
|
@ -13,6 +13,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.eclipse.rap.rwt.RWT;
|
import org.eclipse.rap.rwt.RWT;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
@ -40,6 +41,7 @@ public class ModalInputDialog<T> extends Dialog {
|
||||||
|
|
||||||
private final WidgetFactory widgetFactory;
|
private final WidgetFactory widgetFactory;
|
||||||
private int dialogWidth = 400;
|
private int dialogWidth = 400;
|
||||||
|
private int dialogHeight = 600;
|
||||||
|
|
||||||
public ModalInputDialog(
|
public ModalInputDialog(
|
||||||
final Shell parent,
|
final Shell parent,
|
||||||
|
@ -55,6 +57,11 @@ public class ModalInputDialog<T> extends Dialog {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ModalInputDialog<T> setDialogHeight(final int dialogHeight) {
|
||||||
|
this.dialogHeight = dialogHeight;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void open(
|
public void open(
|
||||||
final LocTextKey title,
|
final LocTextKey title,
|
||||||
final Consumer<T> callback,
|
final Consumer<T> callback,
|
||||||
|
@ -69,6 +76,7 @@ public class ModalInputDialog<T> extends Dialog {
|
||||||
shell.setLayout(new GridLayout(2, true));
|
shell.setLayout(new GridLayout(2, true));
|
||||||
final GridData gridData2 = new GridData(SWT.FILL, SWT.TOP, false, false);
|
final GridData gridData2 = new GridData(SWT.FILL, SWT.TOP, false, false);
|
||||||
gridData2.widthHint = this.dialogWidth;
|
gridData2.widthHint = this.dialogWidth;
|
||||||
|
//gridData2.heightHint = this.dialogHeight;
|
||||||
shell.setLayoutData(gridData2);
|
shell.setLayoutData(gridData2);
|
||||||
|
|
||||||
final Composite main = new Composite(shell, SWT.NONE);
|
final Composite main = new Composite(shell, SWT.NONE);
|
||||||
|
@ -80,6 +88,9 @@ public class ModalInputDialog<T> extends Dialog {
|
||||||
|
|
||||||
final Supplier<T> valueSuppier = contentComposer.compose(main);
|
final Supplier<T> valueSuppier = contentComposer.compose(main);
|
||||||
|
|
||||||
|
final Point computeSize = main.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
gridData.heightHint = (computeSize.y < this.dialogHeight) ? computeSize.y : this.dialogHeight;
|
||||||
|
|
||||||
final Button ok = this.widgetFactory.buttonLocalized(shell, OK_TEXT_KEY);
|
final Button ok = this.widgetFactory.buttonLocalized(shell, OK_TEXT_KEY);
|
||||||
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
|
||||||
data.widthHint = 100;
|
data.widthHint = 100;
|
||||||
|
|
|
@ -72,6 +72,8 @@ public class GridTable extends Composite {
|
||||||
gridLayout.horizontalSpacing = 0;
|
gridLayout.horizontalSpacing = 0;
|
||||||
this.setLayout(gridLayout);
|
this.setLayout(gridLayout);
|
||||||
|
|
||||||
|
this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||||
|
|
||||||
this.columns = new ArrayList<>();
|
this.columns = new ArrayList<>();
|
||||||
for (final ColumnDef columnDef : columnDefs) {
|
for (final ColumnDef columnDef : columnDefs) {
|
||||||
final Label label = widgetFactory.labelLocalized(
|
final Label label = widgetFactory.labelLocalized(
|
||||||
|
@ -85,14 +87,15 @@ public class GridTable extends Composite {
|
||||||
this.addAction = widgetFactory.imageButton(
|
this.addAction = widgetFactory.imageButton(
|
||||||
ImageIcon.ADD_BOX,
|
ImageIcon.ADD_BOX,
|
||||||
this,
|
this,
|
||||||
new LocTextKey(locTextKeyPrefix + "removeAction"),
|
new LocTextKey(locTextKeyPrefix + "addAction"),
|
||||||
this::addRow);
|
this::addRow);
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.CENTER, SWT.FILL, true, true);
|
||||||
gridData.widthHint = ACTION_COLUMN_WIDTH;
|
gridData.widthHint = ACTION_COLUMN_WIDTH;
|
||||||
this.addAction.setLayoutData(gridData);
|
this.addAction.setLayoutData(gridData);
|
||||||
|
|
||||||
this.rows = new ArrayList<>();
|
this.rows = new ArrayList<>();
|
||||||
this.addListener(SWT.Resize, this::adaptColumnWidth);
|
this.addListener(SWT.Resize, this::adaptColumnWidth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListener(final Listener listener) {
|
public void setListener(final Listener listener) {
|
||||||
|
@ -198,14 +201,22 @@ public class GridTable extends Composite {
|
||||||
|
|
||||||
private void adaptColumnWidth(final Event event) {
|
private void adaptColumnWidth(final Event event) {
|
||||||
try {
|
try {
|
||||||
// final int currentTableWidth = this.getClientArea().width;
|
|
||||||
// final int dynWidth = currentTableWidth - ACTION_COLUMN_WIDTH;
|
// TODO the computeSize seems not to correspond with the width of of parent when display
|
||||||
// final int colWidth = dynWidth / this.columns.size();
|
// final Point computeSize = this.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
// for (final Column column : this.columns) {
|
// final int widthUnits = this.columns
|
||||||
// column.header.widthHint = 200;// colWidth;
|
// .stream()
|
||||||
// }
|
// .reduce(
|
||||||
|
// 0,
|
||||||
|
// (acc, c) -> acc + c.columnDef.widthFactor,
|
||||||
|
// (acc1, acc2) -> acc1 + acc2);
|
||||||
|
// final int widthUnit = computeSize.x / widthUnits;
|
||||||
|
// this.columns
|
||||||
|
// .stream()
|
||||||
|
// .forEach(c -> c.header.widthHint = c.columnDef.widthFactor * widthUnit);
|
||||||
|
|
||||||
this.columns.get(0).header.widthHint = 50;
|
this.columns.get(0).header.widthHint = 50;
|
||||||
this.columns.get(1).header.widthHint = 150;
|
this.columns.get(1).header.widthHint = 200;
|
||||||
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
log.warn("Failed to adaptColumnWidth: ", e);
|
log.warn("Failed to adaptColumnWidth: ", e);
|
||||||
|
@ -221,9 +232,10 @@ public class GridTable extends Composite {
|
||||||
this.removeAction = GridTable.this.widgetFactory.imageButton(
|
this.removeAction = GridTable.this.widgetFactory.imageButton(
|
||||||
ImageIcon.REMOVE_BOX,
|
ImageIcon.REMOVE_BOX,
|
||||||
GridTable.this,
|
GridTable.this,
|
||||||
new LocTextKey(GridTable.this.locTextKeyPrefix + "addAction"),
|
new LocTextKey(GridTable.this.locTextKeyPrefix + "removeAction"),
|
||||||
event -> deleteRow(this));
|
event -> deleteRow(this));
|
||||||
final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false);
|
final GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
|
||||||
|
gridData.widthHint = ACTION_COLUMN_WIDTH;
|
||||||
this.removeAction.setLayoutData(gridData);
|
this.removeAction.setLayoutData(gridData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +275,6 @@ public class GridTable extends Composite {
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2:argument:TEXT_FIELD
|
|
||||||
public static final ColumnDef fromString(
|
public static final ColumnDef fromString(
|
||||||
final String string,
|
final String string,
|
||||||
final Map<String, String> defaultValueMap) {
|
final Map<String, String> defaultValueMap) {
|
||||||
|
@ -348,7 +359,7 @@ public class GridTable extends Composite {
|
||||||
|
|
||||||
CheckBox(final Composite parent, final ColumnDef columnDef, final Listener listener) {
|
CheckBox(final Composite parent, final ColumnDef columnDef, final Listener listener) {
|
||||||
this.checkbox = new Button(parent, SWT.CHECK);
|
this.checkbox = new Button(parent, SWT.CHECK);
|
||||||
this.checkbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
this.checkbox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
||||||
this.columnDef = columnDef;
|
this.columnDef = columnDef;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
this.checkbox.addListener(SWT.Selection, listener);
|
this.checkbox.addListener(SWT.Selection, listener);
|
||||||
|
@ -385,7 +396,7 @@ public class GridTable extends Composite {
|
||||||
|
|
||||||
TextField(final Composite parent, final ColumnDef columnDef, final Listener listener) {
|
TextField(final Composite parent, final ColumnDef columnDef, final Listener listener) {
|
||||||
this.textField = new Text(parent, SWT.LEFT | SWT.BORDER);
|
this.textField = new Text(parent, SWT.LEFT | SWT.BORDER);
|
||||||
this.textField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
this.textField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
|
||||||
this.columnDef = columnDef;
|
this.columnDef = columnDef;
|
||||||
this.textField.addListener(SWT.FocusOut, listener);
|
this.textField.addListener(SWT.FocusOut, listener);
|
||||||
this.textField.addListener(SWT.Traverse, listener);
|
this.textField.addListener(SWT.Traverse, listener);
|
||||||
|
|
|
@ -15,7 +15,9 @@ sebserver.webservice.api.admin.clientId=guiClient
|
||||||
sebserver.webservice.api.admin.endpoint=/admin-api/v1
|
sebserver.webservice.api.admin.endpoint=/admin-api/v1
|
||||||
sebserver.webservice.api.admin.accessTokenValiditySeconds=1800
|
sebserver.webservice.api.admin.accessTokenValiditySeconds=1800
|
||||||
sebserver.webservice.api.admin.refreshTokenValiditySeconds=-1
|
sebserver.webservice.api.admin.refreshTokenValiditySeconds=-1
|
||||||
sebserver.webservice.api.exam.endpoint=/exam-api/v1
|
sebserver.webservice.api.exam.endpoint=/exam-api
|
||||||
|
sebserver.webservice.api.exam.endpoint.discovery=${sebserver.webservice.api.exam.endpoint}/discovery
|
||||||
|
sebserver.webservice.api.exam.endpoint.v1=${sebserver.webservice.api.exam.endpoint}/v1
|
||||||
sebserver.webservice.api.exam.accessTokenValiditySeconds=1800
|
sebserver.webservice.api.exam.accessTokenValiditySeconds=1800
|
||||||
sebserver.webservice.api.exam.refreshTokenValiditySeconds=-1
|
sebserver.webservice.api.exam.refreshTokenValiditySeconds=-1
|
||||||
sebserver.webservice.api.redirect.unauthorized=http://0.0.0.0:8080/gui
|
sebserver.webservice.api.redirect.unauthorized=http://0.0.0.0:8080/gui
|
||||||
|
|
|
@ -250,7 +250,7 @@ Text[BORDER]:focused, Text[MULTI][BORDER]:focused {
|
||||||
Text[BORDER]:disabled, Text[MULTI][BORDER]:disabled, Text[BORDER]:read-only,
|
Text[BORDER]:disabled, Text[MULTI][BORDER]:disabled, Text[BORDER]:read-only,
|
||||||
Text[MULTI][BORDER]:read-only {
|
Text[MULTI][BORDER]:read-only {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
color: #CFCFCF;
|
background-color: #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -678,46 +678,6 @@ TabItem:selected:hover:first {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ScrollBar default theme */
|
|
||||||
ScrollBar {
|
|
||||||
background-color: #c0c0c0;
|
|
||||||
background-image: none;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
width: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar-Thumb {
|
|
||||||
background-color: #c0c0c0;
|
|
||||||
border: 1px solid #bdbdbd;
|
|
||||||
border-radius: 15px;
|
|
||||||
/*background-image: url( themes/images/scrollbar/scrollbar-background.png );*/
|
|
||||||
min-height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar-UpButton, ScrollBar-DownButton {
|
|
||||||
background-color: transparent;
|
|
||||||
border: none;
|
|
||||||
border-radius: 0;
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
ScrollBar-UpButton[HORIZONTAL] {
|
|
||||||
background-image: url( themes/images/scrollbar/right.png );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar-DownButton[HORIZONTAL] {
|
|
||||||
background-image: url( themes/images/scrollbar/left.png );
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar-UpButton[VERTICAL] {
|
|
||||||
background-image: url( themes/images/scrollbar/down.png )
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollBar-DownButton[VERTICAL] {
|
|
||||||
background-image: url( themes/images/scrollbar/up.png );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Widget-ToolTip {
|
Widget-ToolTip {
|
||||||
padding: 1px 3px 2px 3px;
|
padding: 1px 3px 2px 3px;
|
||||||
|
|
Loading…
Reference in a new issue