SEBSERV-78 SEBSERV-77 fixed
This commit is contained in:
parent
0b1ed4c46c
commit
24c3d31e58
8 changed files with 58 additions and 24 deletions
|
@ -94,7 +94,7 @@ public class ActivitiesPane implements TemplateComposer {
|
||||||
.newAction(ActionDefinition.INSTITUTION_VIEW_LIST)
|
.newAction(ActionDefinition.INSTITUTION_VIEW_LIST)
|
||||||
.create());
|
.create());
|
||||||
|
|
||||||
} else {
|
} else if (userInfo.hasRole(UserRole.INSTITUTIONAL_ADMIN)) {
|
||||||
// otherwise show the form of the institution for current user
|
// otherwise show the form of the institution for current user
|
||||||
final TreeItem institutions = this.widgetFactory.treeItemLocalized(
|
final TreeItem institutions = this.widgetFactory.treeItemLocalized(
|
||||||
navigation,
|
navigation,
|
||||||
|
|
|
@ -109,7 +109,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> {
|
||||||
composite.setLayout(gridLayout);
|
composite.setLayout(gridLayout);
|
||||||
if (StringUtils.isBlank(this.value)) {
|
if (StringUtils.isBlank(this.value)) {
|
||||||
final Label label = new Label(composite, SWT.NONE);
|
final Label label = new Label(composite, SWT.NONE);
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true);
|
||||||
label.setLayoutData(gridData);
|
label.setLayoutData(gridData);
|
||||||
label.setText(this.value);
|
label.setText(this.value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,7 +131,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> {
|
||||||
|
|
||||||
private Text buildReadonlyLabel(final Composite composite, final String valueKey, final int hspan) {
|
private Text buildReadonlyLabel(final Composite composite, final String valueKey, final int hspan) {
|
||||||
final Text label = new Text(composite, SWT.READ_ONLY);
|
final Text label = new Text(composite, SWT.READ_ONLY);
|
||||||
final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, false, hspan, 1);
|
final GridData gridData = new GridData(SWT.LEFT, SWT.TOP, true, true, hspan, 1);
|
||||||
gridData.verticalIndent = 0;
|
gridData.verticalIndent = 0;
|
||||||
gridData.horizontalIndent = 0;
|
gridData.horizontalIndent = 0;
|
||||||
label.setLayoutData(gridData);
|
label.setLayoutData(gridData);
|
||||||
|
@ -141,7 +141,7 @@ public final class SelectionFieldBuilder extends FieldBuilder<String> {
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(tuple -> tuple._2)
|
.map(tuple -> tuple._2)
|
||||||
.orElse(Constants.EMPTY_NOTE);
|
.orElse(Constants.EMPTY_NOTE);
|
||||||
final Consumer<Label> updateFunction = l -> l.setText(valueSupplier.get());
|
final Consumer<Text> updateFunction = t -> t.setText(valueSupplier.get());
|
||||||
|
|
||||||
label.setText(valueSupplier.get());
|
label.setText(valueSupplier.get());
|
||||||
label.setData(PolyglotPageService.POLYGLOT_WIDGET_FUNCTION_KEY, updateFunction);
|
label.setData(PolyglotPageService.POLYGLOT_WIDGET_FUNCTION_KEY, updateFunction);
|
||||||
|
|
|
@ -58,12 +58,12 @@ public final class TextFieldBuilder extends FieldBuilder<String> {
|
||||||
|
|
||||||
final Composite fieldGrid = Form.createFieldGrid(builder.formParent, this.spanInput);
|
final Composite fieldGrid = Form.createFieldGrid(builder.formParent, this.spanInput);
|
||||||
final Text textInput = (this.isNumber)
|
final Text textInput = (this.isNumber)
|
||||||
? builder.widgetFactory.numberInput(fieldGrid, null)
|
? builder.widgetFactory.numberInput(fieldGrid, null, readonly)
|
||||||
: (this.isArea)
|
: (this.isArea)
|
||||||
? builder.widgetFactory.textAreaInput(fieldGrid)
|
? builder.widgetFactory.textAreaInput(fieldGrid, readonly)
|
||||||
: builder.widgetFactory.textInput(fieldGrid, this.isPassword);
|
: builder.widgetFactory.textInput(fieldGrid, this.isPassword, readonly);
|
||||||
|
|
||||||
final GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
final GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, true);
|
||||||
if (this.isArea) {
|
if (this.isArea) {
|
||||||
gridData.minimumHeight = 35;
|
gridData.minimumHeight = 35;
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ public class TableFilter<ROW extends Entity> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean adaptWidth(final int width) {
|
boolean adaptWidth(final int width) {
|
||||||
return super.adaptWidth(width - CELL_WIDTH_ADJUSTMENT);
|
return super.adaptWidth(width - 2 * CELL_WIDTH_ADJUSTMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -252,6 +252,7 @@ public class TableFilter<ROW extends Entity> {
|
||||||
String getValue() {
|
String getValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TextFilter extends FilterComponent {
|
private class TextFilter extends FilterComponent {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import ch.ethz.seb.sebserver.gbl.Constants;
|
import ch.ethz.seb.sebserver.gbl.Constants;
|
||||||
import ch.ethz.seb.sebserver.gbl.util.Tuple;
|
import ch.ethz.seb.sebserver.gbl.util.Tuple;
|
||||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||||
|
import ch.ethz.seb.sebserver.gui.service.page.PageService;
|
||||||
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.ImageIcon;
|
import ch.ethz.seb.sebserver.gui.widget.WidgetFactory.ImageIcon;
|
||||||
|
|
||||||
public final class MultiSelectionCombo extends Composite implements Selection {
|
public final class MultiSelectionCombo extends Composite implements Selection {
|
||||||
|
@ -55,13 +56,15 @@ public final class MultiSelectionCombo extends Composite implements Selection {
|
||||||
|
|
||||||
private final GridData comboCell;
|
private final GridData comboCell;
|
||||||
private final GridData actionCell;
|
private final GridData actionCell;
|
||||||
|
private final Composite updateAnchor;
|
||||||
|
|
||||||
private Listener listener = null;
|
private Listener listener = null;
|
||||||
|
|
||||||
MultiSelectionCombo(
|
MultiSelectionCombo(
|
||||||
final Composite parent,
|
final Composite parent,
|
||||||
final WidgetFactory widgetFactory,
|
final WidgetFactory widgetFactory,
|
||||||
final String locTextPrefix) {
|
final String locTextPrefix,
|
||||||
|
final Composite updateAnchor) {
|
||||||
|
|
||||||
super(parent, SWT.NONE);
|
super(parent, SWT.NONE);
|
||||||
this.widgetFactory = widgetFactory;
|
this.widgetFactory = widgetFactory;
|
||||||
|
@ -94,6 +97,7 @@ public final class MultiSelectionCombo extends Composite implements Selection {
|
||||||
this.actionCell = new GridData(SWT.LEFT, SWT.CENTER, true, false);
|
this.actionCell = new GridData(SWT.LEFT, SWT.CENTER, true, false);
|
||||||
this.actionCell.widthHint = ACTION_COLUMN_WIDTH;
|
this.actionCell.widthHint = ACTION_COLUMN_WIDTH;
|
||||||
imageButton.setLayoutData(this.actionCell);
|
imageButton.setLayoutData(this.actionCell);
|
||||||
|
this.updateAnchor = updateAnchor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -202,7 +206,8 @@ public final class MultiSelectionCombo extends Composite implements Selection {
|
||||||
this.selectionControls.add(new Tuple<>(label, imageButton));
|
this.selectionControls.add(new Tuple<>(label, imageButton));
|
||||||
|
|
||||||
this.combo.remove(itemName);
|
this.combo.remove(itemName);
|
||||||
this.getParent().layout();
|
this.updateAnchor.layout();
|
||||||
|
PageService.updateScrolledComposite(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeComboSelection(final Event event) {
|
private void removeComboSelection(final Event event) {
|
||||||
|
@ -228,7 +233,8 @@ public final class MultiSelectionCombo extends Composite implements Selection {
|
||||||
final Tuple<String> value = this.selectedValues.remove(indexOf);
|
final Tuple<String> value = this.selectedValues.remove(indexOf);
|
||||||
this.combo.add(value._2, this.combo.getItemCount());
|
this.combo.add(value._2, this.combo.getItemCount());
|
||||||
|
|
||||||
this.getParent().layout();
|
this.updateAnchor.layout();
|
||||||
|
PageService.updateScrolledComposite(this);
|
||||||
if (this.listener != null) {
|
if (this.listener != null) {
|
||||||
this.listener.handleEvent(event);
|
this.listener.handleEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,25 +308,40 @@ public class WidgetFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text textInput(final Composite content) {
|
public Text textInput(final Composite content) {
|
||||||
return textInput(content, false);
|
return textInput(content, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Text textLabel(final Composite content) {
|
||||||
|
return textInput(content, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text passwordInput(final Composite content) {
|
public Text passwordInput(final Composite content) {
|
||||||
return textInput(content, true);
|
return textInput(content, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text textAreaInput(final Composite content) {
|
public Text textAreaInput(final Composite content, final boolean readonly) {
|
||||||
final Text textArea = new Text(content, SWT.LEFT | SWT.BORDER | SWT.MULTI);
|
return readonly
|
||||||
return textArea;
|
? new Text(content, SWT.LEFT | SWT.MULTI)
|
||||||
|
: new Text(content, SWT.LEFT | SWT.BORDER | SWT.MULTI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text textInput(final Composite content, final boolean password) {
|
public Text textInput(final Composite content, final boolean password, final boolean readonly) {
|
||||||
return new Text(content, (password)
|
return readonly
|
||||||
? SWT.LEFT | SWT.BORDER | SWT.PASSWORD
|
? new Text(content, SWT.LEFT | SWT.BORDER)
|
||||||
: SWT.LEFT | SWT.BORDER);
|
: new Text(content, (password)
|
||||||
|
? SWT.LEFT | SWT.BORDER | SWT.PASSWORD
|
||||||
|
: SWT.LEFT | SWT.BORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Text numberInput(final Composite content, final Consumer<String> numberCheck) {
|
public Text numberInput(final Composite content, final Consumer<String> numberCheck) {
|
||||||
|
return numberInput(content, numberCheck, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Text numberInput(final Composite content, final Consumer<String> numberCheck, final boolean readonly) {
|
||||||
|
if (readonly) {
|
||||||
|
return new Text(content, SWT.RIGHT | SWT.READ_ONLY);
|
||||||
|
}
|
||||||
|
|
||||||
final Text numberInput = new Text(content, SWT.RIGHT | SWT.BORDER);
|
final Text numberInput = new Text(content, SWT.RIGHT | SWT.BORDER);
|
||||||
if (numberCheck != null) {
|
if (numberCheck != null) {
|
||||||
numberInput.addListener(SWT.Verify, event -> {
|
numberInput.addListener(SWT.Verify, event -> {
|
||||||
|
@ -520,7 +535,11 @@ public class WidgetFactory {
|
||||||
selection = new MultiSelection(parent);
|
selection = new MultiSelection(parent);
|
||||||
break;
|
break;
|
||||||
case MULTI_COMBO:
|
case MULTI_COMBO:
|
||||||
selection = new MultiSelectionCombo(parent, this, actionLocTextPrefix);
|
selection = new MultiSelectionCombo(
|
||||||
|
parent,
|
||||||
|
this,
|
||||||
|
actionLocTextPrefix,
|
||||||
|
parent);
|
||||||
break;
|
break;
|
||||||
case MULTI_CHECKBOX:
|
case MULTI_CHECKBOX:
|
||||||
selection = new MultiSelectionCheckbox(parent);
|
selection = new MultiSelectionCheckbox(parent);
|
||||||
|
|
|
@ -298,7 +298,8 @@ sebserver.exam.form.endtime=End Time
|
||||||
sebserver.exam.form.status=Status
|
sebserver.exam.form.status=Status
|
||||||
sebserver.exam.form.type=Exam Type
|
sebserver.exam.form.type=Exam Type
|
||||||
sebserver.exam.form.supporter=Exam Supporter
|
sebserver.exam.form.supporter=Exam Supporter
|
||||||
sebserver.exam.form.supporter.add=Add as supporter for this exam
|
sebserver.exam.form.supporter.action.add=Add as supporter for this exam
|
||||||
|
sebserver.exam.form.supporter.action.remove=Remove supporter
|
||||||
|
|
||||||
sebserver.exam.type.UNDEFINED=Not Defined
|
sebserver.exam.type.UNDEFINED=Not Defined
|
||||||
sebserver.exam.type.MANAGED=Managed
|
sebserver.exam.type.MANAGED=Managed
|
||||||
|
|
|
@ -247,7 +247,14 @@ Text[BORDER]:focused, Text[MULTI][BORDER]:focused {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
Text:disabled, Text:read-only, Text[BORDER]:disabled, Text[MULTI]:disabled, Text[MULTI][BORDER]:disabled, Text[BORDER]:read-only, Text[MULTI]:read-only, Text[MULTI][BORDER]:read-only {
|
Text:disabled,
|
||||||
|
Text:read-only,
|
||||||
|
Text[BORDER]:disabled,
|
||||||
|
Text[BORDER]:read-only,
|
||||||
|
Text[MULTI]:disabled,
|
||||||
|
Text[MULTI]:read-only,
|
||||||
|
Text[MULTI][BORDER]:disabled,
|
||||||
|
Text[MULTI][BORDER]:read-only {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border: none;
|
border: none;
|
||||||
|
|
Loading…
Reference in a new issue