Skip to content
Snippets Groups Projects
Commit 65dd3f08 authored by buczekp's avatar buczekp
Browse files

[LMS-1311] added user settings dialog

SVN: 14167
parent effc4cb9
No related branches found
No related tags found
No related merge requests found
Showing
with 190 additions and 5 deletions
......@@ -715,6 +715,15 @@ public abstract class Dict
public static final String GRID_COLUMN_HAS_FILTER_HEADER = "GRID_COLUMN_HAS_FILTER_HEADER";
//
// User Settings Dialog
//
public static final String CHANGE_USER_SETTINGS_DIALOG_TITLE =
"change_user_settings_dialog_title";
public static final String USE_WILDCARD_SEARCH_MODE_LABEL = "use_wildcard_search_mode_label";
//
// Unclassified
//
......
......@@ -359,6 +359,12 @@ public class DisplaySettingsManager
updater.executeDelayed(delayMs);
}
public void storeSearchMode(boolean useWildcardSearchMode)
{
updateUseWildcardSearchMode(useWildcardSearchMode);
updater.executeDelayed(1); // 0 not allowed
}
private static List<ColumnSetting> createColumnsSettings(ColumnModel columnModel,
List<String> filteredColumnIdsList)
{
......@@ -442,4 +448,22 @@ public class DisplaySettingsManager
return sectionModifications.get(sectionDisplayTypeID);
}
/**
* @returns section settings for given display id<br>
*/
@SuppressWarnings("deprecation")
public final boolean isUseWildcardSearchMode()
{
return displaySettings.isUseWildcardSearchMode();
}
/**
* update section settings for given display id (modification date is updated automatically)
*/
@SuppressWarnings("deprecation")
private final void updateUseWildcardSearchMode(Boolean newValue)
{
displaySettings.setUseWildcardSearchMode(newValue);
}
}
......@@ -72,7 +72,7 @@ public class TopMenu extends LayoutContainer
PROPERTY_TYPES_MENU_ASSIGN_TO_MATERIAL_TYPE, PROPERTY_TYPES_MENU_ASSIGN_TO_DATA_SET_TYPE,
PROPERTY_TYPES_MENU_ASSIGN_TO_SAMPLE_TYPE,
USER_MENU_CHANGE_HOME_GROUP, USER_MENU_LOGOUT,
USER_MENU_CHANGE_HOME_GROUP, USER_MENU_CHANGE_SETTINGS, USER_MENU_LOGOUT,
VOCABULARY_MENU_BROWSE, VOCABULARY_MENU_NEW;
......
......@@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.Actio
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.TopMenu;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.TopMenuItem;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action.ChangeHomeGroupAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action.ChangeUserSettingsAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action.LogoutAction;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.SessionContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.dto.User;
......@@ -47,6 +48,8 @@ public final class LoggedUserMenu extends TopMenuItem
Menu submenu = new Menu();
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.USER_MENU_CHANGE_HOME_GROUP, viewContext,
new ChangeHomeGroupAction(viewContext, this)));
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.USER_MENU_CHANGE_SETTINGS, viewContext,
new ChangeUserSettingsAction(viewContext)));
submenu.add(new ActionMenu(TopMenu.ActionMenuKind.USER_MENU_LOGOUT, viewContext,
new LogoutAction(viewContext)));
setMenu(submenu);
......
/*
* Copyright 2009 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.user.action;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.user.ChangeUserSettingsDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
/**
* An {@link IDelegatedAction} that opens a {@link ChangeUserSettingsDialog}.
*
* @author Piotr Buczek
*/
public class ChangeUserSettingsAction implements IDelegatedAction
{
private final IViewContext<?> viewContext;
public ChangeUserSettingsAction(final IViewContext<?> viewContext)
{
this.viewContext = viewContext;
}
public void execute()
{
ChangeUserSettingsDialog dialog =
new ChangeUserSettingsDialog(viewContext, new IDelegatedAction()
{
public void execute()
{
// nothing to do
}
});
dialog.show();
}
}
/*
* Copyright 2008 ETH Zuerich, CISD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.user;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.GenericConstants;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.IViewContext;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.field.CheckBoxField;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.widget.AbstractSaveDialog;
import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDelegatedAction;
/**
* {@link Window} containing form for changing logged user settings.
*
* @author Piotr Buczek
*/
public class ChangeUserSettingsDialog extends AbstractSaveDialog
{
public static final String DIALOG_ID =
GenericConstants.ID_PREFIX + "change-user-settings-dialog";
private final IViewContext<?> viewContext;
private final CheckBoxField useWildcardSearchModeCheckbox;
public ChangeUserSettingsDialog(final IViewContext<?> viewContext,
final IDelegatedAction saveCallback)
{
super(viewContext, viewContext.getMessage(Dict.CHANGE_USER_SETTINGS_DIALOG_TITLE),
saveCallback);
this.viewContext = viewContext;
useWildcardSearchModeCheckbox = createUseWildcardSearchModeField();
addField(useWildcardSearchModeCheckbox);
}
private final CheckBoxField createUseWildcardSearchModeField()
{
CheckBoxField field =
new CheckBoxField(viewContext.getMessage(Dict.USE_WILDCARD_SEARCH_MODE_LABEL), true);
field.setValue(viewContext.getDisplaySettingsManager().isUseWildcardSearchMode());
field
.setTitle("Wildcard search treats '*' and '?' as wildcards.\n"
+ "It requires adding a '*' at the beginning and the end of searched text for contains search.");
return field;
}
@Override
protected void save(AsyncCallback<Void> saveCallback)
{
boolean useWildcardSearchMode = extractUseWildcardSearchMode();
viewContext.getDisplaySettingsManager().storeSearchMode(useWildcardSearchMode);
}
private boolean extractUseWildcardSearchMode()
{
return useWildcardSearchModeCheckbox.getValue();
}
}
......@@ -27,14 +27,14 @@ import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Class storing personalised 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
* THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS. In all cases deserialisation 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.
* <p>
* NOTE: This class has to be Java serializable and GWT serializable.
* <p>
* NOTE: Object of this class should be alwayes managed by DisplaySettingsManager on client side.
* NOTE: Object of this class should be always managed by DisplaySettingsManager on client side.
*
* @author Franz-Josef Elmer
* @author Franz-Josef Elmer
*/
public class DisplaySettings implements Serializable, IsSerializable
{
......@@ -45,6 +45,9 @@ public class DisplaySettings implements Serializable, IsSerializable
private Map<String, Boolean> sectionSettings = new HashMap<String, Boolean>();
// for new users with clean display settings basic search mode will be used by default
private boolean useWildcardSearchMode = false;
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public final Map<String, List<ColumnSetting>> getColumnSettings()
......@@ -63,6 +66,13 @@ public class DisplaySettings implements Serializable, IsSerializable
return sectionSettings;
}
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public boolean isUseWildcardSearchMode()
{
return useWildcardSearchMode;
}
// for serialization
@SuppressWarnings("unused")
......@@ -77,4 +87,11 @@ public class DisplaySettings implements Serializable, IsSerializable
this.sectionSettings = sectionSettings;
}
/** @deprecated Should be used only by DisplaySettingsManager. */
@Deprecated
public void setUseWildcardSearchMode(boolean useWildcardSearchMode)
{
this.useWildcardSearchMode = useWildcardSearchMode;
}
}
......@@ -296,6 +296,7 @@ var common = {
// menu user
USER_MENU_CHANGE_HOME_GROUP: "Home Group",
USER_MENU_CHANGE_SETTINGS: "Settings",
USER_MENU_LOGOUT: "Logout",
menu_compute: "Perform",
......@@ -324,9 +325,15 @@ var common = {
confirm_title: "Confirmation",
confirm_close_msg: "All unsaved changes will be lost. Are you sure?",
change_user_home_group_dialog_title: "Change Home Group",
//
// User Settings Dialog
//
change_user_home_group_dialog_title: "Change Home Group",
change_user_settings_dialog_title: "Change Settings",
use_wildcard_search_mode_label: "Use wildcard search mode",
//
// 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