Skip to content
Snippets Groups Projects
Commit 1fa5a3a3 authored by buczekp's avatar buczekp
Browse files

minor: added flag 'reopen last tab' to display settings

SVN: 20267
parent bcace31c
No related branches found
No related tags found
No related merge requests found
...@@ -322,11 +322,8 @@ public class Client implements EntryPoint, ValueChangeHandler<String> ...@@ -322,11 +322,8 @@ public class Client implements EntryPoint, ValueChangeHandler<String>
GWTUtils.setConfirmExitMessage(); GWTUtils.setConfirmExitMessage();
} }
DisplaySettings displaySettings = String lastHistoryOrNull = tryGetLastHistoryToken();
viewContext.getModel().getSessionContext().getDisplaySettings(); if (lastHistoryOrNull != null)
String lastHistoryOrNull = displaySettings.getLastHistoryTokenOrNull();
if (viewContext.isSimpleMode() == false && StringUtils.isBlank(History.getToken())
&& StringUtils.isBlank(lastHistoryOrNull) == false)
{ {
History.newItem(lastHistoryOrNull); History.newItem(lastHistoryOrNull);
} else } else
...@@ -335,6 +332,24 @@ public class Client implements EntryPoint, ValueChangeHandler<String> ...@@ -335,6 +332,24 @@ public class Client implements EntryPoint, ValueChangeHandler<String>
} }
} }
} }
@SuppressWarnings("deprecation")
private String tryGetLastHistoryToken()
{
if (viewContext.isSimpleMode() == false && StringUtils.isBlank(History.getToken()))
{
DisplaySettings displaySettings =
viewContext.getModel().getSessionContext().getDisplaySettings();
if (displaySettings.isIgnoreLastHistoryToken())
{
return null;
} else
{
return displaySettings.getLastHistoryTokenOrNull();
}
}
return null;
}
} }
/** /**
......
...@@ -861,6 +861,10 @@ public abstract class Dict ...@@ -861,6 +861,10 @@ public abstract class Dict
public static final String DEBUGGING_MODE_INFO = "debugging_mode_info"; public static final String DEBUGGING_MODE_INFO = "debugging_mode_info";
public static final String REOPEN_LAST_TAB_ON_LOGIN_LABEL = "reopen_last_tab_on_login_label";
public static final String REOPEN_LAST_TAB_ON_LOGIN_INFO = "reopen_last_tab_on_login_info";
// //
// Help Info // Help Info
// //
......
...@@ -492,6 +492,18 @@ public class DisplaySettingsManager ...@@ -492,6 +492,18 @@ public class DisplaySettingsManager
displaySettings.setDebuggingModeEnabled(isDebugging); displaySettings.setDebuggingModeEnabled(isDebugging);
} }
@SuppressWarnings("deprecation")
public final boolean isReopenLastTabOnLogin()
{
return displaySettings.isIgnoreLastHistoryToken() == false;
}
@SuppressWarnings("deprecation")
public final void setReopenLastTabOnLogin(boolean isReopen)
{
displaySettings.setIgnoreLastHistoryToken(isReopen == false);
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public final RealNumberFormatingParameters getRealNumberFormatingParameters() public final RealNumberFormatingParameters getRealNumberFormatingParameters()
{ {
......
...@@ -31,6 +31,7 @@ class LastHistoryTokenUpdater ...@@ -31,6 +31,7 @@ class LastHistoryTokenUpdater
this.viewContext = viewContext; this.viewContext = viewContext;
} }
@SuppressWarnings("deprecation")
public void update(String historyToken) public void update(String historyToken)
{ {
DisplaySettings displaySettings = DisplaySettings displaySettings =
......
...@@ -66,6 +66,8 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog ...@@ -66,6 +66,8 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog
private final SpaceSelectionWidget homeSpaceField; private final SpaceSelectionWidget homeSpaceField;
private final CheckBoxField reopenLastTabField;
private final CheckBoxField useWildcardSearchModeCheckbox; private final CheckBoxField useWildcardSearchModeCheckbox;
private final FieldSet formatingFields; private final FieldSet formatingFields;
...@@ -90,6 +92,7 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog ...@@ -90,6 +92,7 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog
// setHeight(250); // setHeight(250);
addField(homeSpaceField = createHomeGroupField()); addField(homeSpaceField = createHomeGroupField());
addField(reopenLastTabField = createReopenLastTabOnLoginField());
addField(useWildcardSearchModeCheckbox = createUseWildcardSearchModeField()); addField(useWildcardSearchModeCheckbox = createUseWildcardSearchModeField());
formatingFields = createRealFormatingFieldSet(); formatingFields = createRealFormatingFieldSet();
precisionField = createPrecisionField(); precisionField = createPrecisionField();
...@@ -118,6 +121,19 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog ...@@ -118,6 +121,19 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog
return field; return field;
} }
private CheckBoxField createReopenLastTabOnLoginField()
{
CheckBoxField field =
new CheckBoxField(viewContext.getMessage(Dict.REOPEN_LAST_TAB_ON_LOGIN_LABEL),
false);
AbstractImagePrototype infoIcon =
AbstractImagePrototype.create(viewContext.getImageBundle().getInfoIcon());
FieldUtil.addInfoIcon(field, viewContext.getMessage(Dict.REOPEN_LAST_TAB_ON_LOGIN_INFO),
infoIcon.createImage());
field.setValue(viewContext.getDisplaySettingsManager().isReopenLastTabOnLogin());
return field;
}
private final CheckBoxField createUseWildcardSearchModeField() private final CheckBoxField createUseWildcardSearchModeField()
{ {
CheckBoxField field = CheckBoxField field =
...@@ -140,6 +156,7 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog ...@@ -140,6 +156,7 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog
formatingParameters.setFormatingEnabled(formatingFields.isExpanded()); formatingParameters.setFormatingEnabled(formatingFields.isExpanded());
formatingParameters.setPrecision(precisionField.getValue().intValue()); formatingParameters.setPrecision(precisionField.getValue().intValue());
formatingParameters.setScientific(scientificFormatingField.getValue()); formatingParameters.setScientific(scientificFormatingField.getValue());
DisplaySettingsManager displaySettingsManager = viewContext.getDisplaySettingsManager(); DisplaySettingsManager displaySettingsManager = viewContext.getDisplaySettingsManager();
boolean useWildcardSearchMode = extractUseWildcardSearchMode(); boolean useWildcardSearchMode = extractUseWildcardSearchMode();
displaySettingsManager.updateUseWildcardSearchMode(useWildcardSearchMode); displaySettingsManager.updateUseWildcardSearchMode(useWildcardSearchMode);
...@@ -147,6 +164,9 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog ...@@ -147,6 +164,9 @@ public class ChangeUserSettingsDialog extends AbstractSaveDialog
boolean debuggingModeEnabled = debuggingModeField.getValue(); boolean debuggingModeEnabled = debuggingModeField.getValue();
displaySettingsManager.setDebuggingModeEnabled(debuggingModeEnabled); displaySettingsManager.setDebuggingModeEnabled(debuggingModeEnabled);
boolean restoreLastTab = reopenLastTabField.getValue();
displaySettingsManager.setReopenLastTabOnLogin(restoreLastTab);
displaySettingsManager.storeSettings(); displaySettingsManager.storeSettings();
} }
......
...@@ -24,7 +24,7 @@ import java.util.Map; ...@@ -24,7 +24,7 @@ import java.util.Map;
import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable; import ch.systemsx.cisd.openbis.generic.shared.basic.ISerializable;
/** /**
* Class storing personalised display settings. This class implements {@link Serializable} not only * Class storing personalized display settings. This class implements {@link Serializable} not only
* for transferring it's content remotely but also to store it in the database. Thus, CHANGES IN * for transferring it's content remotely but also to store it in the database. Thus, CHANGES IN
* THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS. In all cases deserialization leads to an * THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS. In all cases deserialization leads to an
* exception the default settings is used. * exception the default settings is used.
...@@ -60,6 +60,8 @@ public class DisplaySettings implements ISerializable ...@@ -60,6 +60,8 @@ public class DisplaySettings implements ISerializable
private String lastHistoryTokenOrNull; private String lastHistoryTokenOrNull;
private boolean ignoreLastHistoryToken = false;
private RealNumberFormatingParameters realNumberFormatingParameters = private RealNumberFormatingParameters realNumberFormatingParameters =
new RealNumberFormatingParameters(); new RealNumberFormatingParameters();
...@@ -225,14 +227,32 @@ public class DisplaySettings implements ISerializable ...@@ -225,14 +227,32 @@ public class DisplaySettings implements ISerializable
debugging = isDebugging; debugging = isDebugging;
} }
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public String getLastHistoryTokenOrNull() public String getLastHistoryTokenOrNull()
{ {
return lastHistoryTokenOrNull; return lastHistoryTokenOrNull;
} }
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public void setLastHistoryTokenOrNull(String lastHistoryOrNull) public void setLastHistoryTokenOrNull(String lastHistoryOrNull)
{ {
this.lastHistoryTokenOrNull = lastHistoryOrNull; this.lastHistoryTokenOrNull = lastHistoryOrNull;
} }
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public boolean isIgnoreLastHistoryToken()
{
return ignoreLastHistoryToken;
}
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public void setIgnoreLastHistoryToken(boolean ignoreLastHistoryToken)
{
this.ignoreLastHistoryToken = ignoreLastHistoryToken;
}
} }
...@@ -487,6 +487,8 @@ var common = { ...@@ -487,6 +487,8 @@ var common = {
real_number_formating_precision: "Precision", real_number_formating_precision: "Precision",
debugging_mode: "Enable Debugging Mode", debugging_mode: "Enable Debugging Mode",
debugging_mode_info: "This mode is for advanced users. When enabled information like detailed error messages useful e.g. when debugging scripts invoked by openbis will be shown.", debugging_mode_info: "This mode is for advanced users. When enabled information like detailed error messages useful e.g. when debugging scripts invoked by openbis will be shown.",
reopen_last_tab_on_login_label: "Reopen Last Tab",
reopen_last_tab_on_login_info: "Check to reopen last opened tab after login. Note, that it works only if you enter openBIS with URL to the welcome page.",
// //
// Role View // Role View
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment