Skip to content

Commit

Permalink
Open folder picker icon
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Apr 23, 2024
1 parent 642a5d6 commit 886988d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public ImportFoldersDS() {
DataSourceTextField provider = new DataSourceTextField("provider");
DataSourceIntegerField docs = new DataSourceIntegerField("docs");
DataSourceImageField enabled = new DataSourceImageField("eenabled");
DataSourceTextField targetFolderId = new DataSourceTextField("targetFolderId");

setFields(id, src, type, provider, enabled, docs);
setFields(id, targetFolderId, src, type, provider, enabled, docs);
setDataURL("data/importfolders.xml?locale=" + I18N.getLocale());
setClientOnly(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,7 @@ public static StaticTextItem newSafePasswordItem(String name, String title, Stri
if (changedHandler != null)
changedHandler.onChanged(null);
});
clear.setPrompt(I18N.message("clear"));

FormItemIcon edit = new FormItemIcon();
edit.setName("edit");
Expand Down Expand Up @@ -2079,7 +2080,7 @@ public static SelectItem newAttributeSetSelector() {
public static SelectItem newAttributesSelector(String context) {
return newAttributesSelector(context, false);
}

public static SelectItem newAttributesSelector(String context, boolean sections) {
final SelectItem selectItem = new SelectItem("attributes", I18N.message("attributes"));
selectItem.setMultiple(true);
Expand All @@ -2100,7 +2101,7 @@ public static SelectItem newAttributesSelector(String context, boolean sections)
public static SelectItem newAttributesSelector() {
return newAttributesSelector(null);
}

public static SelectItem newAttributesSelector(boolean sections) {
return newAttributesSelector(null, sections);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.logicaldoc.gui.common.client.beans.GUIFolder;
import com.logicaldoc.gui.common.client.data.FoldersDS;
import com.logicaldoc.gui.common.client.i18n.I18N;
import com.logicaldoc.gui.frontend.client.document.DocumentsPanel;
import com.logicaldoc.gui.frontend.client.folder.FolderSearchDialog;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
import com.smartgwt.client.widgets.form.fields.PickerIcon;
Expand Down Expand Up @@ -53,26 +54,37 @@ public FolderSelector(String name, List<FormItemIcon> additionalIcons) {
setFolder(Long.parseLong(item.getAttributeAsString("folderId")), item.getAttributeAsString("name"));
});

PickerIcon search = new PickerIcon(PickerIcon.SEARCH, event -> {
FolderSearchDialog dialog = new FolderSearchDialog(FolderSelector.this);
dialog.show();
});
PickerIcon search = new PickerIcon(PickerIcon.SEARCH,
event -> new FolderSearchDialog(FolderSelector.this).show());
search.setPrompt(I18N.message("search"));
search.setWidth(12);
search.setHeight(12);

PickerIcon pick = new PickerIcon(PickerIcon.COMBO_BOX, event ->
menu.showContextMenu());
PickerIcon pick = new PickerIcon(PickerIcon.COMBO_BOX, event -> menu.showContextMenu());

FormItemIcon open = new FormItemIcon();
open.setName("open");
open.setWidth(12);
open.setHeight(12);
open.setSrc("[SKIN]/folder.png");
open.setPrompt(I18N.message("openfolder"));
open.addFormItemClickHandler(click -> {
if (getFolderId() != null)
DocumentsPanel.get().openInFolder(getFolderId(), null);
});

PickerIcon clear = new PickerIcon(PickerIcon.CLEAR, event -> {
clearValue();
setFolder(null, null);
});
clear.setPrompt(I18N.message("clear"));
clear.setWidth(12);
clear.setHeight(12);

List<FormItemIcon> icons = new ArrayList<>();
icons.add(pick);
icons.add(search);
icons.add(open);
icons.add(clear);
if (additionalIcons != null && !additionalIcons.isEmpty()) {
icons.addAll(additionalIcons);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public void onDraw() {

ListGridField id = new ListGridField("id", 50);
id.setHidden(true);

ListGridField targetFolderId = new ListGridField("targetFolderId", I18N.message("targetid") ,50);
targetFolderId.setHidden(true);

ListGridField src = new ListGridField("src", I18N.message("source"), 300);
src.setCanFilter(true);
Expand All @@ -98,7 +101,7 @@ public void onDraw() {
list.setAutoFetchData(true);
list.setWidth100();
list.setHeight100();
list.setFields(enabled, id, src, type, importedDocs);
list.setFields(enabled, id, targetFolderId, src, type, importedDocs);
list.setSelectionType(SelectionStyle.SINGLE);
list.setShowRecordComponents(true);
list.setShowRecordComponentsByCell(true);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 886988d

Please sign in to comment.