BrightSide Workbench Full Report + Source Code
org.turro.zkoss.text.FileEditor Class Reference
Inheritance diagram for org.turro.zkoss.text.FileEditor:
Collaboration diagram for org.turro.zkoss.text.FileEditor:

Public Member Functions

String getEncoding ()
 
void setEncoding (String encoding)
 
File getFile ()
 
void setFile (File file)
 
void save ()
 
void saveAs () throws IOException
 
void afterCompose ()
 

Static Public Member Functions

static void editFile (File file)
 

Protected Attributes

File file
 
String encoding = null
 

Detailed Description

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

Definition at line 40 of file FileEditor.java.

Member Function Documentation

◆ afterCompose()

void org.turro.zkoss.text.FileEditor.afterCompose ( )

Definition at line 103 of file FileEditor.java.

103  {
104  try {
105  if(file != null) {
106  setValue(FileUtil.getContent(file, Strings.isBlank(encoding) ? ElephantContext.getEncoding() : encoding));
107  }
108  } catch (IOException ex) {
109  Logger.getLogger(FileEditor.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
110  }
111  }
Here is the call graph for this function:

◆ editFile()

static void org.turro.zkoss.text.FileEditor.editFile ( File  file)
static

Definition at line 42 of file FileEditor.java.

42  {
43  ElephantMenu.showEntity(
44  file, "fileToEdit",
45  "@Editor: " + file.getName(),
46  "/www/editor.zul");
47  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEncoding()

String org.turro.zkoss.text.FileEditor.getEncoding ( )

Definition at line 52 of file FileEditor.java.

52  {
53  return encoding;
54  }

◆ getFile()

File org.turro.zkoss.text.FileEditor.getFile ( )

Definition at line 60 of file FileEditor.java.

60  {
61  return file;
62  }

◆ save()

void org.turro.zkoss.text.FileEditor.save ( )

Definition at line 68 of file FileEditor.java.

68  {
69  try {
70  FileUtil.setContent(file, getText(), Strings.isBlank(encoding) ? ElephantContext.getEncoding() : encoding);
71  } catch (IOException ex) {
72  Logger.getLogger(FileEditor.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
73  }
74  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveAs()

void org.turro.zkoss.text.FileEditor.saveAs ( ) throws IOException

Definition at line 76 of file FileEditor.java.

76  {
77  InputDialog.getInput(
78  getPage(),
79  I_.get("Save as"),
80  new InputField[] {
81  new InputField("Name", getFile().getName(), null, 0)
82  }, new Command() {
83  @Override
84  public Object execute(Context context) {
85  InputField[] fields = (InputField[]) context.get("fields");
86  if(fields.length > 0) {
87  for(InputField f : fields) {
88  if("Name".equals(f.getLabel())) {
89  String path = FileUtil.getParentPath(file.getAbsolutePath());
90  if(path != null) {
91  file = new File(path + "/" + f.getValue());
92  save();
93  }
94  }
95  }
96  }
97  return null;
98  }
99  });
100  }
Here is the call graph for this function:

◆ setEncoding()

void org.turro.zkoss.text.FileEditor.setEncoding ( String  encoding)

Definition at line 56 of file FileEditor.java.

56  {
57  this.encoding = encoding;
58  }

◆ setFile()

void org.turro.zkoss.text.FileEditor.setFile ( File  file)

Definition at line 64 of file FileEditor.java.

64  {
65  this.file = file;
66  }

Member Data Documentation

◆ encoding

String org.turro.zkoss.text.FileEditor.encoding = null
protected

Definition at line 50 of file FileEditor.java.

◆ file

File org.turro.zkoss.text.FileEditor.file
protected

Definition at line 49 of file FileEditor.java.


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