BrightSide Workbench Full Report + Source Code
org.turro.elephant.configuration.FilesComposer Class Reference
Inheritance diagram for org.turro.elephant.configuration.FilesComposer:
Collaboration diagram for org.turro.elephant.configuration.FilesComposer:

Public Member Functions

void onSelectFile (Event event)
 
void onSave (Event event)
 
void onSaveAs (Event event)
 
void onNewFile (Event event)
 
void onDelFile (Event event)
 
void onFomantic (UploadEvent event) throws Exception
 
void onChange (Event event)
 
void doFinally () throws Exception
 

Detailed Description

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

Definition at line 50 of file FilesComposer.java.

Member Function Documentation

◆ doFinally()

void org.turro.elephant.configuration.FilesComposer.doFinally ( ) throws Exception

Definition at line 168 of file FilesComposer.java.

168  {
169  save.setDisabled(true);
170  save.setAutodisable("+self,+saveAs");
171  saveAs.setDisabled(true);
172  saveAs.setAutodisable("+self,+save");
173  }

◆ onChange()

void org.turro.elephant.configuration.FilesComposer.onChange ( Event  event)

Definition at line 159 of file FilesComposer.java.

159  {
160  save.setDisabled(false);
161  if(filesTree.getSelectedFile() != null &&
162  filesTree.getSelectedFile().isDynamicLoad()) {
163  saveAs.setDisabled(false);
164  }
165  }
Here is the call graph for this function:

◆ onDelFile()

void org.turro.elephant.configuration.FilesComposer.onDelFile ( Event  event)

Definition at line 136 of file FilesComposer.java.

136  {
137  final FilesItem folder = filesTree.getSelectedFileParent();
138  final FilesItem file = filesTree.getSelectedFile();
139  Messages.confirmDeletion().add(file.getLabel()).show(() -> {
140  if(Document.from(file.getCurrentFile()).delete()) {
141  folder.refresh();
142  filesTree.setSelectedItem(folder);
143  }
144  });
145  }
Here is the call graph for this function:

◆ onFomantic()

void org.turro.elephant.configuration.FilesComposer.onFomantic ( UploadEvent  event) throws Exception

Definition at line 148 of file FilesComposer.java.

148  {
149  Folder fomantic = Folder.from(ElephantContext.getRealPath("/_internal/js/semantic-ui"));
150  fomantic.ensure();
151  for(Media media : event.getMedias()) {
152  Medias.toFolder(media, fomantic.folder());
153  Compress.unzip(fomantic.path().resolve(media.getName()), fomantic.path());
154  Document.from(fomantic.path().resolve(media.getName())).delete();
155  }
156  }
Here is the call graph for this function:

◆ onNewFile()

void org.turro.elephant.configuration.FilesComposer.onNewFile ( Event  event)

Definition at line 115 of file FilesComposer.java.

115  {
116  try {
117  final FilesItem folder = filesTree.getSelectedFolder();
118  if(folder != null) {
119  editor.newFile(folder.getCurrentFile(), new Command() {
120  @Override
121  public Object execute(Context context) {
122  save.setDisabled(false);
123  saveAs.setDisabled(false);
124  folder.refresh();
125  filesTree.selectFile((File) context.get("file"), folder);
126  return null;
127  }
128  });
129  }
130  } catch (IOException ex) {
131  Logger.getLogger(FilesComposer.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
132  }
133  }
void selectFile(File file, Treeitem parent)
Definition: FilesTree.java:51
void newFile(final File folder, final Command command)
Here is the call graph for this function:

◆ onSave()

void org.turro.elephant.configuration.FilesComposer.onSave ( Event  event)

Definition at line 91 of file FilesComposer.java.

91  {
92  editor.save();
93  }
Here is the call graph for this function:

◆ onSaveAs()

void org.turro.elephant.configuration.FilesComposer.onSaveAs ( Event  event)

Definition at line 96 of file FilesComposer.java.

96  {
97  try {
98  editor.saveAs(new Command() {
99  @Override
100  public Object execute(Context context) {
101  save.setDisabled(false);
102  saveAs.setDisabled(false);
103  FilesItem selectedParent = filesTree.getSelectedFileParent();
104  selectedParent.refresh();
105  filesTree.selectFile((File) context.get("file"), selectedParent);
106  return null;
107  }
108  });
109  } catch (IOException ex) {
110  Logger.getLogger(FilesComposer.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
111  }
112  }
void saveAs(final Command command)
Here is the call graph for this function:

◆ onSelectFile()

void org.turro.elephant.configuration.FilesComposer.onSelectFile ( Event  event)

Definition at line 71 of file FilesComposer.java.

71  {
72  save.setDisabled(true);
73  saveAs.setDisabled(true);
74  File file = filesTree.getSelectedFile().getCurrentFile();
75  if(file != null && (file.isFile() || !file.exists())) {
76  fileName.setValue(file.getName());
77  editor.setEncoding(guessEncoding(file));
78  editor.setFile(file);
79  editor.afterCompose();
80  editor.setDisabled(false);
81  } else {
82  fileName.setValue(null);
83  editor.setText("");
84  editor.setEncoding(null);
85  editor.setDisabled(true);
86  filesTree.getSelectedItem().setOpen(true);
87  }
88  }
Here is the call graph for this function:

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