BrightSide Workbench Full Report + Source Code
org.turro.elephant.impl.context.DefaultElement Class Reference
Inheritance diagram for org.turro.elephant.impl.context.DefaultElement:
Collaboration diagram for org.turro.elephant.impl.context.DefaultElement:

Public Member Functions

 DefaultElement ()
 
void loadData () throws ServletException, IOException
 
String getStart ()
 
String getEnd ()
 
void startConstruction () throws ServletException, IOException
 
FoundList search (String value, boolean ignoreCase)
 
- Public Member Functions inherited from org.turro.elephant.impl.abstracts.AbstractElement
 AbstractElement ()
 
String getId ()
 
String getType ()
 
String getTitle ()
 
void setTitle (String title)
 
Collection< String > getMetas ()
 
void setMetas (Collection< String > metas)
 
ElContext getContext ()
 
IConstructor getConstructor ()
 
void setConfiguration (IConstructor constructor, ElContext context)
 
String getStartTitle ()
 
String getEndTitle ()
 
String getStartBody ()
 
String getEndBody ()
 
String getStartFooter ()
 
String getEndFooter ()
 
String getStartOption ()
 
String getEndOption ()
 
boolean canDisplay ()
 
boolean isSelectable ()
 
boolean isInRole ()
 
boolean canPrint ()
 
String getElementFolder ()
 
boolean isOriginalContext ()
 
void setRootCategories (ElContext root)
 
String getTypeName ()
 
AttributeSupport getAttributes ()
 
void applyChanges ()
 
void populateFromParent ()
 
void setDefaultMetas ()
 
void setConfiguration (Element conf, Element factory)
 

Protected Member Functions

String[] getLocaleResourceNames (String preferredLocale)
 

Protected Attributes

String currentResource
 
- Protected Attributes inherited from org.turro.elephant.impl.abstracts.AbstractElement
IConstructor constructor
 
ElContext context
 
AttributeSupport attrSupport
 
Element conf = null
 
String[] types
 
String title
 
Collection< String > metas
 

Detailed Description

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

Definition at line 44 of file DefaultElement.java.

Constructor & Destructor Documentation

◆ DefaultElement()

org.turro.elephant.impl.context.DefaultElement.DefaultElement ( )

Creates a new instance of DefaultElement

Definition at line 49 of file DefaultElement.java.

49  {
50  super();
51  }

Member Function Documentation

◆ getEnd()

String org.turro.elephant.impl.context.DefaultElement.getEnd ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 65 of file DefaultElement.java.

65  {
66  return "</div>";
67  }
Here is the caller graph for this function:

◆ getLocaleResourceNames()

String [] org.turro.elephant.impl.context.DefaultElement.getLocaleResourceNames ( String  preferredLocale)
protected

Definition at line 85 of file DefaultElement.java.

85  {
86  //ElContext elContext = ElContextMap.getContext(context.getPath());
87  WebResources resources = context.getResources();
88  List<String> names = resources.resourceNamesForLang(preferredLocale);
89  if(names.isEmpty()) {
90  for(String lang : context.getDefaultLocales()) {
91  if(!lang.equals(preferredLocale)) {
92  names = resources.resourceNamesForLang(lang);
93  }
94  if(!names.isEmpty()) break;
95  }
96  }
97  names.addAll(resources.globalResourceNames());
98  return names.toArray(new String[0]);
99  }
List< String > resourceNamesForLang(String lang)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getStart()

String org.turro.elephant.impl.context.DefaultElement.getStart ( )

Reimplemented from org.turro.elephant.impl.abstracts.AbstractElement.

Definition at line 60 of file DefaultElement.java.

60  {
61  return "<div class='default-element'>";
62  }
Here is the caller graph for this function:

◆ loadData()

void org.turro.elephant.impl.context.DefaultElement.loadData ( ) throws ServletException, IOException

This method loads element's data. It gets called within IConstructor.startConstruction() and before element's startConstruction() method.

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 54 of file DefaultElement.java.

54  {
55  super.loadData();
57  }
Here is the call graph for this function:

◆ search()

FoundList org.turro.elephant.impl.context.DefaultElement.search ( String  value,
boolean  ignoreCase 
)

This method is called by Elephant search implementation.

Parameters
valueValue to search.
ignoreCaseWhether to ignore case.
Returns
A list of coincidences.

Implements org.turro.elephant.search.ISearchable.

Definition at line 104 of file DefaultElement.java.

104  {
105  String res[] = getLocaleResourceNames(I_.api().usedLang());
106  FoundList fl = new FoundList();
107  BufferedReader br;
108  String line;
109  SearchFormatter sf;
110  for(int i = res.length -1 ; i >= 0; i--) {
111  currentResource = res[i];
112  try {
113  br = FileUtil.getBufferedFile(
114  ElephantContext.getRealPath(
116  ));
117  sf = new SearchFormatter(value, ignoreCase);
118  while((line = br.readLine()) != null) {
119  sf.processLine(line);
120  }
121  br.close();
122  if(sf.wasFound()) {
123  fl.addItem(
124  getId() == null ? "" : getId(),
125  (context.getPath().length() == 0 ? "/" : context.getPath()) + "#" + currentResource,
126  "<img src='" + ElephantContext.getRootResourcePath() + "/_internal/system/images/webpage.gif'/>",
127  context.getName(),
128  sf.getResult(),
129  (double)sf.getFound(),
130  value
131  );
132  }
133  } catch (IOException ex) {
134  Logger.getLogger(DefaultElement.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
135  }
136  }
137  return fl;
138  }
String[] getLocaleResourceNames(String preferredLocale)
Here is the call graph for this function:

◆ startConstruction()

void org.turro.elephant.impl.context.DefaultElement.startConstruction ( ) throws ServletException, IOException

This method start element's construction. It gets called within IConstructor.startConstruction().

Exceptions
javax.servlet.ServletException
java.io.IOException

Implements org.turro.elephant.context.IElement.

Definition at line 70 of file DefaultElement.java.

70  {
71  String res[] = getLocaleResourceNames(I_.api().usedLang());
72  PrintWriter out = getConstructor().getOut();
73  out.print(getStart());
74  for(int i = res.length -1 ; i >= 0; i--) {
75  currentResource = res[i];
76  out.print(getStartBody());
79  );
80  out.print(getEndBody());
81  }
82  out.print(getEnd());
83  }
Here is the call graph for this function:

Member Data Documentation

◆ currentResource

String org.turro.elephant.impl.context.DefaultElement.currentResource
protected

Definition at line 46 of file DefaultElement.java.


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