◆ afterCompose()
void org.turro.zkoss.text.CodemirrorEditor.afterCompose |
( |
| ) |
|
Definition at line 156 of file CodemirrorEditor.java.
159 setSyntax(!Strings.isBlank(forcedSyntax) ? forcedSyntax : FileUtil.getExtension(
file).toLowerCase());
160 if(FileUtil.getExtension(
file).toLowerCase().equals(
"properties")) {
161 setValue(FileUtil.getPropertiesContent(
file, Strings.isBlank(
encoding) ? ElephantContext.getEncoding() :
encoding));
163 setValue(FileUtil.getContent(
file, Strings.isBlank(
encoding) ? ElephantContext.getEncoding() :
encoding));
166 }
catch (IOException ex) {
167 Logger.getLogger(CodemirrorEditor.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ getEncoding()
String org.turro.zkoss.text.CodemirrorEditor.getEncoding |
( |
| ) |
|
◆ getFile()
File org.turro.zkoss.text.CodemirrorEditor.getFile |
( |
| ) |
|
◆ newFile()
void org.turro.zkoss.text.CodemirrorEditor.newFile |
( |
final File |
folder, |
|
|
final Command |
command |
|
) |
| throws IOException |
Definition at line 127 of file CodemirrorEditor.java.
128 InputDialog.getInput(
132 new InputField(
"Name",
"", null, 0)
135 public Object execute(Context context) {
136 InputField[] fields = (InputField[]) context.get(
"fields");
137 if(fields.length > 0) {
138 for(InputField f : fields) {
139 if(
"Name".equals(f.getLabel())) {
140 String path = folder.getAbsolutePath();
142 file =
new File(path +
"/" + f.getValue());
144 context.put(
"file",
file);
145 if(command !=
null) command.execute(context);
◆ save()
void org.turro.zkoss.text.CodemirrorEditor.save |
( |
| ) |
|
Definition at line 73 of file CodemirrorEditor.java.
75 if(!
file.getParentFile().exists()) {
76 file.getParentFile().mkdirs();
78 if(FileUtil.getExtension(
file).toLowerCase().equals(
"properties")) {
79 FileUtil.setPropertiesContent(
file, getValue(), Strings.isBlank(
encoding) ? ElephantContext.getEncoding() :
encoding);
81 FileUtil.setContent(
file, getValue(), Strings.isBlank(
encoding) ? ElephantContext.getEncoding() :
encoding);
83 }
catch (IOException ex) {
84 Logger.getLogger(CodemirrorEditor.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(
null), ex);
◆ saveAs()
void org.turro.zkoss.text.CodemirrorEditor.saveAs |
( |
final Command |
command | ) |
throws IOException |
Definition at line 88 of file CodemirrorEditor.java.
93 new InputField(
"Name", getFile().getName(), null, 0),
94 new InputField(
"Override", Boolean.valueOf(Boolean.TRUE), null, 0)
97 public Object execute(Context context) {
98 InputField[] fields = (InputField[]) context.get(
"fields");
99 if(fields.length > 0) {
101 boolean override =
false;
102 for(InputField f : fields) {
103 if(
"Name".equals(f.getLabel())) {
104 name = (String) f.getValue();
105 }
else if(
"Override".equals(f.getLabel())) {
106 override = (Boolean) f.getValue();
109 if(!Strings.isBlank(name)) {
110 String path = FileUtil.getParentPath(
file.getAbsolutePath());
112 if(
override && !path.contains(
"/site")) {
115 file =
new File(path +
"/" + name);
117 context.put(
"file",
file);
118 if(command !=
null) command.execute(context);
◆ setDisabled()
void org.turro.zkoss.text.CodemirrorEditor.setDisabled |
( |
boolean |
value | ) |
|
◆ setEncoding()
void org.turro.zkoss.text.CodemirrorEditor.setEncoding |
( |
String |
encoding | ) |
|
◆ setFile()
void org.turro.zkoss.text.CodemirrorEditor.setFile |
( |
File |
file | ) |
|
◆ setForcedSyntax()
void org.turro.zkoss.text.CodemirrorEditor.setForcedSyntax |
( |
String |
forcedSyntax | ) |
|
◆ setText()
void org.turro.zkoss.text.CodemirrorEditor.setText |
( |
String |
value | ) |
|
◆ encoding
String org.turro.zkoss.text.CodemirrorEditor.encoding = null |
|
protected |
◆ file
File org.turro.zkoss.text.CodemirrorEditor.file |
|
protected |
The documentation for this class was generated from the following file: