KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > clipbuilder > html > web > html > Impl > ExtractorFilter > SimpleExtractorFilter


1 package org.jahia.clipbuilder.html.web.html.Impl.ExtractorFilter;
2
3 import org.jahia.clipbuilder.html.web.html.*;
4
5 /**
6  * Simple implementation of HTMLFilter.
7  *
8  *@author Tlili Khaled
9  */

10 public class SimpleExtractorFilter extends AbsctractExtractoreFilter {
11     private String JavaDoc selectedPart;
12     private final String JavaDoc NAME = "SimpleExtractorFilter";
13
14
15     /**
16      * Constructor for the SimpleHTMLFilter object
17      *
18      *@param key Description of Parameter
19      */

20     public SimpleExtractorFilter(String JavaDoc key) {
21         super("SimpleExtractorFilter");
22         addKeyPart(key);
23     }
24
25
26     /**
27      * Constructor for the SimpleHTMLFilter object
28      */

29     public SimpleExtractorFilter() {
30         super("SimpleExtractorFilter");
31
32     }
33
34
35     /**
36      * Sets the SelectedPart attribute of the SimpleHTMLFilter object
37      *
38      *@param selectedPart The new SelectedPart value
39      */

40     public void setSelectedPart(String JavaDoc selectedPart) {
41         this.selectedPart = selectedPart;
42     }
43
44
45
46     /**
47      * Gets the Name attribute of the SimpleExtractorFilter object
48      *
49      *@return The Name value
50      */

51     public String JavaDoc getName() {
52         return NAME.toString();
53     }
54
55
56
57     /**
58      * Gets the KeyPart attribute of the SimpleHTMLFilter object
59      *
60      *@return The KeyPart value
61      */

62     public String JavaDoc getKeyPart() {
63         return this.selectedPart;
64     }
65
66
67     /**
68      * Gets the SelectedPart attribute of the SimpleHTMLFilter object
69      *
70      *@param doc Description of Parameter
71      *@param action Description of Parameter
72      *@return The SelectedPart value
73      */

74     public String JavaDoc getSelectedPart(HTMLDocument doc, int action) {
75         String JavaDoc selectedPart = "";
76         String JavaDoc encoded = "";
77         String JavaDoc html = "";
78         if (action == ACTION_BUILD_KEY_PART) {
79             // don't update parameters values ang get selected part
80
html = doc.getTransformedDocumentAsString();
81         }
82         else if (action == ACTION_RETRIEVE_SELECTED_PART) {
83             // update parameters values ang get selected part
84
html = doc.getUserDocumentAsString();
85         }
86
87         return selectedPart;
88     }
89
90
91
92     /**
93      * Sets the Key attribute of the SimpleHTMLFilter object
94      *
95      *@param key The new Key value
96      */

97     public void addKeyPart(String JavaDoc key) {
98         this.setSelectedPart(key);
99     }
100
101 }
102
Popular Tags