19 package org.turro.zkoss.text;
22 import java.util.HashMap;
23 import org.turro.string.Strings;
24 import org.turro.command.Command;
25 import org.turro.command.Context;
26 import org.turro.elephant.context.ElephantContext;
27 import org.turro.i18n.I_;
28 import org.turro.zkoss.dialog.SelectionDialog;
29 import org.zkoss.zk.ui.Executions;
30 import org.zkoss.zk.ui.IdSpace;
31 import org.zkoss.zk.ui.select.Selectors;
32 import org.zkoss.zk.ui.select.annotation.Listen;
33 import org.zkoss.zk.ui.select.annotation.Wire;
34 import org.zkoss.zul.Checkbox;
35 import org.zkoss.zul.Div;
36 import org.zkoss.zul.Listbox;
37 import org.zkoss.zul.Textbox;
43 public class Link extends Div implements IdSpace {
46 private String fileFolder;
47 private boolean readOnlyRepository =
false, noTreeRepository =
false;
49 @Wire
private Textbox link;
50 @Wire
private Textbox content;
51 @Wire
private Checkbox newTab;
52 @Wire
private Listbox cssClass;
55 HashMap args =
new HashMap();
57 args.put(
"i_",
I_.
api());
58 args.put(
"i",
I_.
map());
60 Executions.createComponents(
"/WEB-INF/_zul/bs/comps/editor/link.zul",
this, args);
61 Selectors.wireComponents(
this,
this,
false);
62 Selectors.wireEventListeners(
this,
this);
63 this.wikiElement = wikiElement;
72 this.fileFolder = fileFolder;
76 this.readOnlyRepository = readOnlyRepository;
80 this.noTreeRepository = noTreeRepository;
86 String sclass = cssClass.getSelectedItem() ==
null ?
"" : cssClass.getSelectedItem().getLabel();
88 if(!Strings.isBlank(sclass)) {
91 if(newTab.isChecked()) {
94 return wikiElement.
render();
97 @Listen(
"onClick = #findfile")
107 public Object execute(Context context) {
111 content.setValue(result.getName());
118 private void initiate() {
120 if(!Strings.isBlank(slink)) {
121 link.setValue(slink.replaceAll(
"\\\\\\:",
"\\:"));
123 content.setDisabled(!wikiElement.
isCreating());
124 newTab.setChecked(wikiElement.
getAttributes().containsKey(
"&target"));
static String getRelativePath(String path)
static String getRootWebPath()
static I18nByKey byKeyMap()
static String get(String msg)
static I18nApiWrapper api()
static I18nMapWrapper map()
static I18nCompatibilityMap compatibilityMap()
static void showComponent(Page page, String title, Component component, String width, String height, final Command command)
Link(WikiElement wikiElement)
void setReadOnlyRepository(boolean readOnlyRepository)
void setFileFolder(String fileFolder)
void setNoTreeRepository(boolean noTreeRepository)
void setFilter(String filter)
void selectFolder(String folder)
void setNoTreeRepository(boolean noTreeRepository)
void setReadOnlyRepository(boolean readOnlyRepository)
void addNoValuedAttribute(String value)
HashMap< String, String > getAttributes()
void addClass(String sclass)
String getFistNoneValued()
void setContent(String content)