BrightSide Workbench Full Report + Source Code
org.turro.documentation.model.DefinitionsVM Class Reference

Public Member Functions

IContact getContact ()
 
void setContact (IContact contact)
 
DocumentDefinition getSelected ()
 
void setSelected (DocumentDefinition selected)
 
List< String > getDocumentKeys ()
 
List< Document > getDocuments (String key)
 
String getKeyName (String key)
 
void upload (@BindingParam("medias") Media medias[])
 
void download (@BindingParam("document") Document document)
 
void deleteDoc (@BindingParam("document") Document document)
 
void delete ()
 
void create ()
 
void save ()
 
Set< DocumentDefinitiongetModel ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 49 of file DefinitionsVM.java.

Member Function Documentation

◆ create()

void org.turro.documentation.model.DefinitionsVM.create ( )

Definition at line 127 of file DefinitionsVM.java.

127  {
128  Dialogs.title(I_.get("Create"))
129  .width("400px")
130  .height("500px")
131  .addField(DialogField.field("Documentation"))
132  .addField(DialogField.field("Type").onEditor(() -> {
133  return new DefinitionTypeListbox();
134  }))
135  .onOk((dialogs) -> {
136  String docdef = dialogs.<Textbox>getEditor("Documentation").getValue();
137  if(!Strings.isBlank(docdef) && !DocumentDefinitions.instance().names().contains(docdef)) {
138  DocumentType dt = dialogs.<DefinitionTypeListbox>getEditor("Type").getObjectValue();
139  DocumentDefinition dd = new DocumentDefinition(docdef, dt);
140  DocumentDefinitions.instance().add(dd);
141  BindUtils.postNotifyChange(null, null, DefinitionsVM.this, "model");
142  }
143  })
144  .emptyCancel()
145  .show();
146  }
Here is the call graph for this function:

◆ delete()

void org.turro.documentation.model.DefinitionsVM.delete ( )

Definition at line 115 of file DefinitionsVM.java.

115  {
116  if(selected.canDelete()) {
117  Messages.confirmDeletion().add(selected.getName()).show(() -> {
118  selected.getFolder().clean();
119  DocumentDefinitions.instance().remove(selected);
120  selected = null;
121  BindUtils.postNotifyChange(null, null, DefinitionsVM.this, "model");
122  });
123  }
124  }
Here is the call graph for this function:

◆ deleteDoc()

void org.turro.documentation.model.DefinitionsVM.deleteDoc ( @BindingParam("document") Document  document)

Definition at line 106 of file DefinitionsVM.java.

106  {
107  Messages.confirmDeletion().add(document.name()).show(() -> {
108  document.delete();
109  document.folder().removeEmpties();
110  setSelected(selected);
111  });
112  }
void setSelected(DocumentDefinition selected)
Here is the call graph for this function:

◆ download()

void org.turro.documentation.model.DefinitionsVM.download ( @BindingParam("document") Document  document)

Definition at line 101 of file DefinitionsVM.java.

101  {
102  new FileWrapper(document.document()).download();
103  }
Here is the call graph for this function:

◆ getContact()

IContact org.turro.documentation.model.DefinitionsVM.getContact ( )

Definition at line 55 of file DefinitionsVM.java.

55  {
56  return contact;
57  }

◆ getDocumentKeys()

List<String> org.turro.documentation.model.DefinitionsVM.getDocumentKeys ( )

Definition at line 73 of file DefinitionsVM.java.

73  {
74  return selected != null ? new ArrayList<>(documentMap.keySet()) : null;
75  }

◆ getDocuments()

List<Document> org.turro.documentation.model.DefinitionsVM.getDocuments ( String  key)

Definition at line 77 of file DefinitionsVM.java.

77  {
78  return documentMap.get(key);
79  }

◆ getKeyName()

String org.turro.documentation.model.DefinitionsVM.getKeyName ( String  key)

Definition at line 81 of file DefinitionsVM.java.

81  {
82  if("*".equals(key)) return I_.get("All");
83  IContact folder = Contacts.getContactById(key);
84  if(Contacts.isValid(folder)) return folder.getFullName();
85  return "!";
86  }
Here is the call graph for this function:

◆ getModel()

Set<DocumentDefinition> org.turro.documentation.model.DefinitionsVM.getModel ( )

Definition at line 153 of file DefinitionsVM.java.

153  {
154  return DocumentDefinitions.instance();
155  }
Here is the call graph for this function:

◆ getSelected()

DocumentDefinition org.turro.documentation.model.DefinitionsVM.getSelected ( )

Definition at line 63 of file DefinitionsVM.java.

63  {
64  return selected;
65  }

◆ save()

void org.turro.documentation.model.DefinitionsVM.save ( )

Definition at line 149 of file DefinitionsVM.java.

149  {
150  DocumentDefinitions.instance().save();
151  }
Here is the call graph for this function:

◆ setContact()

void org.turro.documentation.model.DefinitionsVM.setContact ( IContact  contact)

Definition at line 59 of file DefinitionsVM.java.

59  {
60  this.contact = contact;
61  }

◆ setSelected()

void org.turro.documentation.model.DefinitionsVM.setSelected ( DocumentDefinition  selected)

Definition at line 67 of file DefinitionsVM.java.

67  {
68  this.selected = selected;
69  this.documentMap = selected.getDocumentsMap();
70  BindUtils.postNotifyChange(null, null, DefinitionsVM.this, "documentKeys");
71  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ upload()

void org.turro.documentation.model.DefinitionsVM.upload ( @BindingParam("medias") Media  medias[])

Definition at line 89 of file DefinitionsVM.java.

89  {
90  Folder folder = selected.getFolder();
91  if(contact != null) {
92  folder = folder.child(contact.getId());
93  }
94  for(Media media : medias) {
95  Medias.toFolder(media, folder);
96  }
97  setSelected(selected);
98  }
Here is the call graph for this function:

The documentation for this class was generated from the following file: