|
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 javax.swing.JPanel org.htmlparser.lexerapplications.thumbelina.Thumbelina
public class Thumbelina
View images behind thumbnails.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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 boolean |
mActive
Activity state. |
protected JCheckBox |
mBackgroundToggle
Background thread checkbox in status bar. |
protected String |
mCurrentURL
The URL being currently being examined. |
protected boolean |
mDiscardCGI
If true , does not follow links containing cgi calls. |
protected boolean |
mDiscardQueries
If true , does not follow links containing queries (?). |
protected JList |
mHistory
History list. |
protected JScrollPane |
mHistoryScroller
Scroller for the history list. |
protected JSplitPane |
mMainArea
Main panel in central area. |
protected PicturePanel |
mPicturePanel
The central area for pictures. |
protected JScrollPane |
mPicturePanelScroller
Scroller for the picture panel. |
protected JPanel |
mPowerBar
Status bar. |
protected PropertyChangeSupport |
mPropertySupport
Bound property support. |
protected JProgressBar |
mQueueProgress
Image request queue monitor in status bar. |
protected JLabel |
mQueueSize
URL queue size display in status bar. |
protected JProgressBar |
mReadyProgress
Image ready queue monitor in status bar. |
protected HashMap<String,URL> |
mRequested
Images requested. |
protected JCheckBox |
mRunToggle
Sequencer thread toggle in status bar. |
protected Sequencer |
mSequencer
The picture sequencer. |
protected JSlider |
mSpeedSlider
Sequencer speed slider in status bar. |
protected Thread |
mThread
Background thread. |
protected HashMap<String,URL> |
mTracked
Images being tracked currently. |
protected JTextField |
mUrlText
URL report in status bar. |
protected HashMap<String,URL> |
mVisited
URL's visited. |
protected JLabel |
mVisitedSize
URL visited count display in status bar. |
protected static URL[][] |
NONE
Value returned when no links are discovered. |
static String |
PROP_CURRENT_URL_PROPERTY
Property name for current URL binding. |
static String |
PROP_URL_QUEUE_PROPERTY
Property name for queue size binding. |
static String |
PROP_URL_VISITED_PROPERTY
Property name for visited URL size binding. |
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 | |
---|---|
Thumbelina()
Creates a new instance of Thumbelina. |
|
Thumbelina(String url)
Creates a new instance of Thumbelina. |
|
Thumbelina(URL url)
Creates a new instance of Thumbelina. |
Method Summary | |
---|---|
void |
addHistory(String url)
Adds the given url to the history list. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
void |
append(ArrayList list)
Append the given URLs to the queue. |
void |
append(URL url)
Append the given URL to the queue. |
protected URL[][] |
extractImageLinks(Lexer lexer,
URL docbase)
Get the links of an element of a document. |
protected void |
fetch(URL[] images)
Fetch images. |
protected ArrayList<URL> |
filter(URL[] urls)
Filter URLs and add to queue. |
boolean |
getBackgroundThreadActive()
Gets the state of the background thread. |
String |
getCurrentURL()
Return the URL currently being examined. |
boolean |
getHistoryListVisible()
Gets the state of history list visibility. |
protected URL[][] |
getImageLinks(URL url)
Get the image links from the current URL. |
PicturePanel |
getPicturePanel()
Get the picture panel object encapsulated by this Thumbelina. |
ArrayList<URL> |
getQueue()
Getter for property queue. |
int |
getQueueSize()
Getter for property queue. |
boolean |
getSequencerActive()
Gets the state of the sequencer thread. |
int |
getSpeed()
Get the sequencer delay time. |
boolean |
getStatusBarVisible()
Gets the state of status bar visibility. |
protected static void |
help()
Provide command line help. |
boolean |
isDiscardCGI()
Getter for property discardCGI. |
boolean |
isDiscardQueries()
Getter for property discardQueries. |
protected boolean |
isImage(String url)
Check if the url looks like an image. |
void |
itemStateChanged(ItemEvent event)
Handle checkbox events from the status bar. |
static void |
main(String[] args)
Mainline. |
protected void |
memCheck()
Check for low memory situation. |
void |
open(String ref)
Open a URL. |
void |
pictureReady(Picture picture)
Notification for a picture ready for use (loaded into memory). |
void |
pictureReceived(Picture picture)
Notification for a download completed. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
void |
reset()
Reset this Thumbelina. |
void |
run()
The main processing loop. |
void |
setBackgroundThreadActive(boolean active)
Sets the state of the background thread activity. |
protected void |
setCurrentURL(String url)
Set the current URL being examined. |
void |
setDiscardCGI(boolean discard)
Setter for property discardCGI. |
void |
setDiscardQueries(boolean discard)
Setter for property discardQueries. |
void |
setHistoryListVisible(boolean visible)
Sets the history list visibility. |
void |
setSequencerActive(boolean active)
Sets the sequencer activity state. |
void |
setSpeed(int speed)
Set the sequencer delay time. |
void |
setStatusBarVisible(boolean visible)
Sets the status bar visibility. |
void |
stateChanged(ChangeEvent event)
Handles the speed slider events. |
protected void |
updateQueueSize(int original,
int current)
Apply a change in 'to be examined' URL list size. |
protected void |
updateVisitedSize(int original,
int current)
Apply a change in 'visited' URL list size. |
void |
valueChanged(ListSelectionEvent event)
Handles the history list events. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String PROP_CURRENT_URL_PROPERTY
public static final String PROP_URL_QUEUE_PROPERTY
public static final String PROP_URL_VISITED_PROPERTY
protected HashMap<String,URL> mVisited
protected HashMap<String,URL> mRequested
protected HashMap<String,URL> mTracked
protected Thread mThread
protected boolean mActive
true
means processing URLS, false
not.
protected Sequencer mSequencer
protected PicturePanel mPicturePanel
protected static final URL[][] NONE
protected PropertyChangeSupport mPropertySupport
protected String mCurrentURL
protected boolean mDiscardCGI
true
, does not follow links containing cgi calls.
protected boolean mDiscardQueries
true
, does not follow links containing queries (?).
protected JCheckBox mBackgroundToggle
protected JList mHistory
protected JScrollPane mPicturePanelScroller
protected JScrollPane mHistoryScroller
protected JSplitPane mMainArea
protected JPanel mPowerBar
protected JProgressBar mQueueProgress
protected JProgressBar mReadyProgress
protected JCheckBox mRunToggle
protected JSlider mSpeedSlider
protected JTextField mUrlText
protected JLabel mQueueSize
protected JLabel mVisitedSize
Constructor Detail |
---|
public Thumbelina()
public Thumbelina(String url) throws MalformedURLException
url
- Single URL to enter into the 'to follow' list.
MalformedURLException
- If the url is malformed.public Thumbelina(URL url)
url
- URL to enter into the 'to follow' list.Method Detail |
---|
protected void memCheck()
public void reset()
public void append(URL url)
url
- The url to add.public void append(ArrayList list)
list
- The list of URL objects to add.protected ArrayList<URL> filter(URL[] urls)
urls
- The list of URL's to add to the 'to visit' list.
public boolean getStatusBarVisible()
true
if the status bar is visible.public void setStatusBarVisible(boolean visible)
visible
- The new visibility state.
If true
, the status bar will be unhidden.public boolean getHistoryListVisible()
true
if the history list is visible.public void setHistoryListVisible(boolean visible)
visible
- The new visibility state.
If true
, the history list will be unhidden.public boolean getSequencerActive()
true
if the thread is pumping images.public void setSequencerActive(boolean active)
active
- The new activity state.
If true
, the sequencer will be turned on.
This may alter the speed setting if it is set to zero.public boolean getBackgroundThreadActive()
true
if the thread is examining web pages.public void setBackgroundThreadActive(boolean active)
active
- If true
,
the background thread will be turned on.public int getSpeed()
public void setSpeed(int speed)
speed
- The sequencer delay in milliseconds.public boolean isDiscardCGI()
public void setDiscardCGI(boolean discard)
discard
- New value of property discardCGI.public boolean isDiscardQueries()
public void setDiscardQueries(boolean discard)
discard
- New value of property discardQueries.protected boolean isImage(String url)
url
- The usrl to check for image characteristics.
true
if the url ends in a recognized image
extension.protected URL[][] extractImageLinks(Lexer lexer, URL docbase) throws IOException, ParserException
lexer
- The fully conditioned lexer, ready to rock.docbase
- The url to read.
IOException
- If the underlying infrastructure throws it.
ParserException
- If there is a problem parsing the url.protected URL[][] getImageLinks(URL url)
url
- The URL to get the links from
public PicturePanel getPicturePanel()
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in class Container
listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in class Component
listener
- The PropertyChangeListener to be removed.public String getCurrentURL()
protected void setCurrentURL(String url)
url
- The url that is being examined.protected void updateQueueSize(int original, int current)
PROP_URL_QUEUE_PROPERTY
property
and updates the status bar.
original
- The original size of the list.current
- The new size of the list.protected void updateVisitedSize(int original, int current)
PROP_URL_VISITED_PROPERTY
property and updates the status bar.
original
- The original size of the list.current
- The new size of the list.protected void fetch(URL[] images)
images
- The list of images to fetch.public void pictureReceived(Picture picture)
PictureListener
pictureReceived
in interface PictureListener
picture
- The picture for which download has finished.public void pictureReady(Picture picture)
PictureListener
pictureReady
in interface PictureListener
public void run()
run
in interface Runnable
public void itemStateChanged(ItemEvent event)
itemStateChanged
in interface ItemListener
event
- The event describing the checkbox event.public void stateChanged(ChangeEvent event)
stateChanged
in interface ChangeListener
event
- The event describing the slider activity.public void valueChanged(ListSelectionEvent event)
valueChanged
in interface ListSelectionListener
event
- The event describing the list activity.public void addHistory(String url)
url
- The URL to add to the history list.public void open(String ref)
ref
- The URL to add.protected static void help()
public static void main(String[] args)
args
- the command line arguments.
Can be one or more forms of -help to get command line help,
or a URL to prime the program with.
Checks for JDK 1.4 and if not found runs in crippled mode
(no ThumbelinaFrame).public ArrayList<URL> getQueue()
public int getQueueSize()
PROP_URL_QUEUE_PROPERTY
property.
|
© 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. |