};
timer.schedule(500);
}
});
}
final TextItem resultCountItem = new TextItem("resultCount", MSG.common_title_groupsFound());
{
resultCountItem.setCanEdit(false);
resultCountItem.setWidth("100%");
}
final TextItem pageCountItem = new TextItem("pageCount", MSG.common_title_queryPagesParsed());
{
pageCountItem.setCanEdit(false);
pageCountItem.setWidth("100%");
}
final TextAreaItem adviceItem = new TextAreaItem("advice", MSG.common_title_suggest());
{
adviceItem.setWidth("100%");
adviceItem.setHeight(20);
String feedback = MSG.common_val_none();
adviceItem.setValue(feedback);
adviceItem.setTooltip(feedback);
adviceItem.setDisabled(true);
adviceItem.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
event.cancel();
cursorPosition = adviceItem.getSelectionRange()[0];
}
});
adviceItem.addChangedHandler(new ChangedHandler() {
@Override
public void onChanged(ChangedEvent event) {
adviceItem.setSelectionRange(cursorPosition, cursorPosition);
}
});
}
//Customize Search component
{
searchTextItem.setName(MSG.common_title_search());
searchTextItem.setTitle(MSG.view_admin_roles_filterResultsBelow());
searchTextItem.setWidth("100%");
searchTextItem.setTooltip(MSG.common_msg_typeToFilterResults());
}
final FormItemIcon loadingIcon = new FormItemIcon();
final FormItemIcon successIcon = new FormItemIcon();
final FormItemIcon failIcon = new FormItemIcon();
final FormItemIcon attentionIcon = new FormItemIcon();
String successIconPath = "[SKIN]/actions/ok.png";
String failedIconPath = "[SKIN]/actions/exclamation.png";
String loadingIconPath = "[SKIN]/loading.gif";
String attentionIconPath = "[SKIN]/Dialog/warn.png";
loadingIcon.setSrc(loadingIconPath);
successIcon.setSrc(successIconPath);
failIcon.setSrc(failedIconPath);
attentionIcon.setSrc(attentionIconPath);
final StaticTextItem groupQueryStatus = new StaticTextItem();
{
groupQueryStatus.setName("groupQueryStatus");
groupQueryStatus.setTitle(MSG.common_title_queryProgress());
groupQueryStatus.setDefaultValue(MSG.common_msg_loading());
groupQueryStatus.setIcons(loadingIcon);
}
availableGroupDetails.setItems(resultCountItem, pageCountItem, groupQueryStatus, adviceItem, searchTextItem);
// Ldap Group Settings region
final DynamicForm ldapGroupSettings = new DynamicForm();
{
ldapGroupSettings.setWidth(groupPanelWidth);
ldapGroupSettings.setHeight(groupPanelHeight);
ldapGroupSettings.setGroupTitle(MSG.view_adminRoles_ldapGroupsSettingsReadOnly());
ldapGroupSettings.setIsGroup(true);
ldapGroupSettings.setWrapItemTitles(false);
}
final TextItem groupSearch = new TextItem("groupSearch", MSG.view_admin_systemSettings_LDAPFilter_name());
{
groupSearch.setCanEdit(false);
groupSearch.setWidth("100%");
}
final TextItem groupMember = new TextItem("groupMember", MSG.view_admin_systemSettings_LDAPGroupMember_name());
{
groupMember.setCanEdit(false);
groupMember.setWidth("100%");
}
final CheckboxItem groupQueryPagingItem = new CheckboxItem("groupQueryEnable",
MSG.view_admin_systemSettings_LDAPGroupUsePaging_name());
{
groupQueryPagingItem.setCanEdit(false);
groupQueryPagingItem.setValue(false);
groupQueryPagingItem.setShowLabel(false);
groupQueryPagingItem.setShowTitle(true);
groupQueryPagingItem.setTitleOrientation(TitleOrientation.LEFT);
//You have to set this attribute
groupQueryPagingItem.setAttribute("labelAsTitle", true);
}
final TextItem groupQueryPagingCountItem = new TextItem("groupQueryCount",
MSG.view_adminRoles_ldapQueryPageSize());
{
groupQueryPagingCountItem.setCanEdit(false);
groupQueryPagingCountItem.setWidth("100%");
}
final CheckboxItem groupUsePosixGroupsItem = new CheckboxItem("groupUsePosixGroups",
MSG.view_admin_systemSettings_LDAPGroupUsePosixGroup_name());
{
groupUsePosixGroupsItem.setCanEdit(false);
groupUsePosixGroupsItem.setValue(false);
groupUsePosixGroupsItem.setShowLabel(false);
groupUsePosixGroupsItem.setShowTitle(true);
groupUsePosixGroupsItem.setTitleOrientation(TitleOrientation.LEFT);
//You have to set this attribute
groupUsePosixGroupsItem.setAttribute("labelAsTitle", true);
}
ldapGroupSettings.setItems(groupSearch, groupMember, groupQueryPagingItem, groupQueryPagingCountItem,
groupUsePosixGroupsItem);
// orient both panels next to each other
HLayout panel = new HLayout();
{
panel.addMember(availableGroupDetails);
DynamicForm spacerWrapper = new DynamicForm();
spacerWrapper.setItems(new SpacerItem());
panel.addMember(spacerWrapper);
panel.addMember(ldapGroupSettings);
}
availableFilterForm.addChild(panel);
final long ldapGroupSelectorRequestId = System.currentTimeMillis();
//launch operations to populate/refresh LDAP Group Query contents.
final Timer ldapPropertiesTimer = new Timer() {
public void run() {
//if system properties not set, launch request/update
String ldapGroupQuery = groupSearch.getValueAsString();
if ((ldapGroupQuery == null) || (ldapGroupQuery.trim().isEmpty())) {
GWTServiceLookup.getSystemService().getSystemSettings(new AsyncCallback<SystemSettings>() {
@Override
public void onFailure(Throwable caught) {
groupQueryStatus.setIcons(failIcon);
groupQueryStatus.setDefaultValue(MSG.view_adminRoles_failLdapGroupsSettings());
CoreGUI.getErrorHandler().handleError(MSG.view_adminRoles_failLdapGroupsSettings(), caught);
Log.debug(MSG.view_adminRoles_failLdapGroupsSettings());
}
@Override
public void onSuccess(SystemSettings settings) {
//retrieve relevant information once and update ui
String ldapGroupFilter = settings.get(SystemSetting.LDAP_GROUP_FILTER);
String ldapGroupMember = settings.get(SystemSetting.LDAP_GROUP_MEMBER);
String ldapGroupPagingEnabled = settings.get(SystemSetting.LDAP_GROUP_PAGING);
String ldapGroupPagingValue = settings.get(SystemSetting.LDAP_GROUP_QUERY_PAGE_SIZE);
String ldapGroupIsPosix = settings.get(SystemSetting.LDAP_GROUP_USE_POSIX);
groupSearch.setValue(ldapGroupFilter);
groupMember.setValue(ldapGroupMember);
groupQueryPagingItem.setValue(Boolean.valueOf(ldapGroupPagingEnabled));
groupQueryPagingCountItem.setValue(ldapGroupPagingValue);
groupUsePosixGroupsItem.setValue(Boolean.valueOf(ldapGroupIsPosix));
ldapGroupSettings.markForRedraw();
}
});
}