|
HTML Parser Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent org.htmlparser.parserapplications.filterbuilder.Filter
public abstract class Filter
Base class for all filters. Provides common functionality applicable to all filters.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected static Hashtable |
mWrappers
Map from cilter class to wrapper. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Filter()
Create a filter. |
Method Summary | |
---|---|
static String |
deconstitute(Filter[] filters)
Returns a string serialization of the filters. |
static byte[] |
deserialize(String string)
Convert a sequence of hexadecimal characters back into a byte array. |
abstract String |
getDescription()
Get the name of the filter. |
protected static SubFilterList |
getEnclosed(Component component)
Get the enclosed sub filter list if any. |
Icon |
getIcon()
Get the icon for the filter. |
abstract String |
getIconSpec()
Get the resource name for the icon. |
abstract NodeFilter |
getNodeFilter()
Get the underlying node filter object. |
abstract NodeFilter[] |
getSubNodeFilters()
Get the underlying node filter's subordinate filters. |
static Filter |
instantiate(String class_name)
Create a new filter from the class name. |
static void |
newline(StringBuffer out)
Append a newline to the buffer. |
static byte[] |
pickle(Object object)
Serialize an object to a byte array. |
static Filter[] |
reconstitute(String string,
Parser context)
Returns the filters represented by the string. |
static String |
serialize(byte[] data)
Serialize a byte array to a String. |
void |
setExpanded(boolean expanded)
Set the expanded state for the component. |
abstract void |
setNodeFilter(NodeFilter filter,
Parser context)
Assign the underlying node filter for this wrapper. |
void |
setSelected(boolean selected)
Set the 'selected look' for the component. |
abstract void |
setSubNodeFilters(NodeFilter[] filters)
Assign the underlying node filter's subordinate filters. |
static void |
spaces(StringBuffer out,
int count)
Append count spaces to the buffer. |
abstract String |
toJavaCode(StringBuffer out,
int[] context)
Convert this filter into Java code. |
String |
toString()
Returns a string representation of this component and its values. |
static Object |
unpickle(byte[] data)
Reconstitute a serialized object. |
static Filter |
wrap(NodeFilter filter,
Parser context)
Returns a wrapped filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.htmlparser.NodeFilter |
---|
accept |
Field Detail |
---|
protected static Hashtable mWrappers
Constructor Detail |
---|
public Filter()
getDescription()
,
and an icon, returned by getIcon()
.
Method Detail |
---|
public static Filter instantiate(String class_name)
class_name
- The class to instatiate.
public abstract String getDescription()
public abstract NodeFilter getNodeFilter()
public abstract void setNodeFilter(NodeFilter filter, Parser context)
filter
- The filter to wrap.context
- The parser to use for conditioning this filter.
Some filters need contextual information to provide to the user,
i.e. for tag names or attribute names or values,
so the Parser context is provided.public abstract NodeFilter[] getSubNodeFilters()
public abstract void setSubNodeFilters(NodeFilter[] filters)
filters
- The filters to insert into the underlying node filter.public abstract String toJavaCode(StringBuffer out, int[] context)
out
- The output buffer.context
- Three integers as follows:
public Icon getIcon()
getIconSpec()
as an icon.
public abstract String getIconSpec()
public String toString()
toString
in class Component
public static byte[] pickle(Object object) throws IOException
object
- The object to be pickled.
IOException
- If the output stream complains (unlikely).public static Object unpickle(byte[] data) throws IOException, ClassNotFoundException
data
- The pickled object.
IOException
- If the input stream complains.
ClassNotFoundException
- If the serialized object class cannot
be located.public static String serialize(byte[] data)
data
- The serialized object as a byte array.
public static byte[] deserialize(String string)
string
- The string to convert (must be correct hex characters).
public static String deconstitute(Filter[] filters) throws IOException
filters
- The list of filters to serialize.
IOException
- If serialization fails.public static Filter[] reconstitute(String string, Parser context)
string
- The string with serialized node filters.context
- The context from which to extract meaningful values
for GUI choices (which aren't serialized).
wrap(org.htmlparser.NodeFilter, org.htmlparser.Parser)
protected static SubFilterList getEnclosed(Component component)
component
- The component that's supposedly enclosing the list.
null
otherwise.public static Filter wrap(NodeFilter filter, Parser context)
filter
- A filter to be wrapped by GUI components.context
- The context within which to wrap the object.
Some wrappers need context to set up useful choices for the user.
public void setSelected(boolean selected)
selected
- If true
, 'select' this component,
otherwise 'deselect' it.public void setExpanded(boolean expanded)
expanded
- If true
, 'expand' this component,
otherwise 'collapse' it.public static void spaces(StringBuffer out, int count)
out
- The buffer to append to.count
- The number of spaces to append.public static void newline(StringBuffer out)
out
- The buffer to append to.
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HTML Parser is an open source library released under Common Public License. |