BrightSide Workbench Full Report + Source Code
org.turro.zkoss.text.WikiElement Class Reference

Public Member Functions

 WikiElement (int selectionStart, InputElement input, String tag)
 
 WikiElement (int selectionStart, int selectionEnd, InputElement input)
 
 WikiElement (int selectionStart, int selectionEnd, InputElement input, String avoid[])
 
void forgetAndCreate (String newTag)
 
void setContent (String content)
 
boolean inside ()
 
boolean isTag (String tag)
 
boolean isCreating ()
 
HashMap< String, String > getAttributes ()
 
void addNoValuedAttribute (String value)
 
String getFistNoneValued ()
 
void addClass (String sclass)
 
void removeValuedAttributes ()
 
boolean render ()
 
boolean renderImage (File image)
 

Static Public Attributes

static final String[] NON_BLOCK_ELEMENTS = { "img" }
 

Detailed Description

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

Definition at line 32 of file WikiElement.java.

Constructor & Destructor Documentation

◆ WikiElement() [1/3]

org.turro.zkoss.text.WikiElement.WikiElement ( int  selectionStart,
InputElement  input,
String  tag 
)

Definition at line 43 of file WikiElement.java.

43  {
44  this.selectionStart = selectionStart;
45  this.selectionEnd = selectionStart;
46  this.input = input;
47  this.avoid = null;
48  this.text = input.getText();
49  initializeTag(tag);
50  }

◆ WikiElement() [2/3]

org.turro.zkoss.text.WikiElement.WikiElement ( int  selectionStart,
int  selectionEnd,
InputElement  input 
)

Definition at line 52 of file WikiElement.java.

52  {
53  this(selectionStart, selectionEnd, input, null);
54  }

◆ WikiElement() [3/3]

org.turro.zkoss.text.WikiElement.WikiElement ( int  selectionStart,
int  selectionEnd,
InputElement  input,
String  avoid[] 
)

Definition at line 56 of file WikiElement.java.

56  {
57  this.selectionStart = selectionStart;
58  this.selectionEnd = selectionEnd;
59  this.input = input;
60  this.avoid = avoid;
61  this.text = input.getText();
62  initialize();
63  }

Member Function Documentation

◆ addClass()

void org.turro.zkoss.text.WikiElement.addClass ( String  sclass)

Definition at line 104 of file WikiElement.java.

104  {
105  String classes = attributes.get("&class");
106  if(classes != null) {
107  if(!classes.contains(sclass)) {
108  classes += " " + sclass;
109  }
110  } else {
111  classes = sclass;
112  }
113  attributes.put("&class", classes);
114  }
Here is the caller graph for this function:

◆ addNoValuedAttribute()

void org.turro.zkoss.text.WikiElement.addNoValuedAttribute ( String  value)

Definition at line 91 of file WikiElement.java.

91  {
92  attributes.put(value, "no-value");
93  }
Here is the caller graph for this function:

◆ forgetAndCreate()

void org.turro.zkoss.text.WikiElement.forgetAndCreate ( String  newTag)

Definition at line 65 of file WikiElement.java.

65  {
66  this.tag = newTag;
67  attributes.clear();
68  creating = true;
69  }
Here is the caller graph for this function:

◆ getAttributes()

HashMap<String, String> org.turro.zkoss.text.WikiElement.getAttributes ( )

Definition at line 87 of file WikiElement.java.

87  {
88  return attributes;
89  }
Here is the caller graph for this function:

◆ getFistNoneValued()

String org.turro.zkoss.text.WikiElement.getFistNoneValued ( )

Definition at line 95 of file WikiElement.java.

95  {
96  for(String s : attributes.keySet()) {
97  if(attributes.get(s).equals("no-value")) {
98  return s;
99  }
100  }
101  return "";
102  }

◆ inside()

boolean org.turro.zkoss.text.WikiElement.inside ( )

Definition at line 75 of file WikiElement.java.

75  {
76  return !Strings.isBlank(tag);
77  }
Here is the caller graph for this function:

◆ isCreating()

boolean org.turro.zkoss.text.WikiElement.isCreating ( )

Definition at line 83 of file WikiElement.java.

83  {
84  return creating;
85  }

◆ isTag()

boolean org.turro.zkoss.text.WikiElement.isTag ( String  tag)

Definition at line 79 of file WikiElement.java.

79  {
80  return this.tag == null ? false : this.tag.equals(tag);
81  }
Here is the caller graph for this function:

◆ removeValuedAttributes()

void org.turro.zkoss.text.WikiElement.removeValuedAttributes ( )

Definition at line 116 of file WikiElement.java.

116  {
117  Iterator<String> it = attributes.keySet().iterator();
118  while(it.hasNext()) {
119  String v = attributes.get(it.next());
120  if(!"no-value".equals(v)) {
121  it.remove();
122  }
123  }
124  }

◆ render()

boolean org.turro.zkoss.text.WikiElement.render ( )

Definition at line 170 of file WikiElement.java.

170  {
171  int pointer = creating ? selectionStart : startElement;
172  if(!Strings.isBlank(tag)) {
173  if(!creating) {
174  input.setSelectedText(pointer, endElement + 1, "", false);
175  }
176  String tagString = elementString();
177  input.setSelectedText(pointer, pointer, tagString, false);
178  if(creating) {
179  if(!Strings.isBlank(content)) {
180  pointer += tagString.length();
181  input.setSelectedText(pointer, pointer, content, false);
182  pointer += content.length();
183  }
184  input.setSelectedText(pointer, pointer, "[/" + tag + "]", false);
185  }
186  return true;
187  }
188  return false;
189  }
Here is the caller graph for this function:

◆ renderImage()

boolean org.turro.zkoss.text.WikiElement.renderImage ( File  image)

Definition at line 225 of file WikiElement.java.

225  {
226  if(image != null) {
227  int pointer = creating ? selectionStart : startElement;
228  if(!Strings.isBlank(tag)) {
229  if(!creating) {
230  input.setSelectedText(pointer, endElement + 1, "", false);
231  }
232  String tagString = imageString(image);
233  input.setSelectedText(pointer, pointer, tagString, false);
234  }
235  return true;
236  }
237  return false;
238  }
Here is the caller graph for this function:

◆ setContent()

void org.turro.zkoss.text.WikiElement.setContent ( String  content)

Definition at line 71 of file WikiElement.java.

71  {
72  this.content = content;
73  }
Here is the caller graph for this function:

Member Data Documentation

◆ NON_BLOCK_ELEMENTS

final String [] org.turro.zkoss.text.WikiElement.NON_BLOCK_ELEMENTS = { "img" }
static

Definition at line 35 of file WikiElement.java.


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