19 package org.turro.documentation.model;
21 import java.util.ArrayList;
22 import java.util.List;
25 import org.turro.action.Contacts;
26 import org.turro.string.Strings;
27 import org.turro.documentation.DocumentDefinition;
28 import org.turro.documentation.DocumentDefinitions;
29 import org.turro.documentation.DocumentType;
30 import org.turro.elephant.util.Messages;
31 import org.turro.file.Document;
32 import org.turro.file.FileWrapper;
33 import org.turro.file.Folder;
34 import org.turro.i18n.I_;
35 import org.turro.plugin.contacts.IContact;
36 import org.turro.upload.Medias;
37 import org.turro.zkoss.dialog.DialogField;
38 import org.turro.zkoss.dialog.Dialogs;
39 import org.zkoss.bind.BindUtils;
40 import org.zkoss.bind.annotation.BindingParam;
41 import org.zkoss.bind.annotation.Command;
42 import org.zkoss.util.media.Media;
43 import org.zkoss.zul.Textbox;
53 private Map<String, List<Document>> documentMap;
60 this.contact = contact;
68 this.selected = selected;
70 BindUtils.postNotifyChange(
null,
null,
DefinitionsVM.this,
"documentKeys");
74 return selected !=
null ?
new ArrayList<>(documentMap.keySet()) :
null;
78 return documentMap.get(key);
82 if(
"*".equals(key))
return I_.
get(
"All");
89 public
void upload(@BindingParam("medias") Media medias[]) {
92 folder = folder.child(contact.
getId());
94 for(Media media : medias) {
101 public
void download(@BindingParam("document") Document document) {
105 @Command(
"deleteDoc")
106 public
void deleteDoc(@BindingParam("document") Document document) {
109 document.folder().removeEmpties();
121 BindUtils.postNotifyChange(
null,
null,
DefinitionsVM.this,
"model");
133 return new DefinitionTypeListbox();
136 String docdef = dialogs.<Textbox>getEditor(
"Documentation").getValue();
141 BindUtils.postNotifyChange(
null,
null,
DefinitionsVM.this,
"model");
Map< String, List< Document > > getDocumentsMap()
static DocumentDefinitions instance()
SortedSet< String > names()
void setSelected(DocumentDefinition selected)
void deleteDoc(@BindingParam("document") Document document)
void setContact(IContact contact)
String getKeyName(String key)
List< Document > getDocuments(String key)
DocumentDefinition getSelected()
void upload(@BindingParam("medias") Media medias[])
Set< DocumentDefinition > getModel()
List< String > getDocumentKeys()
void download(@BindingParam("document") Document document)
static Messages confirmDeletion()
Messages add(String word)
static String get(String msg)
static DialogField field(String label)
Dialogs width(String width)
Dialogs height(String height)
Dialogs onOk(Consumer< Dialogs > onOk)
static Dialogs title(String title)
Dialogs addField(DialogField field)