Class FilterBuilder
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- org.htmlparser.parserapplications.filterbuilder.FilterBuilder
-
- All Implemented Interfaces:
java.awt.datatransfer.ClipboardOwner,java.awt.dnd.DragGestureListener,java.awt.dnd.DragSourceListener,java.awt.dnd.DropTargetListener,java.awt.event.ActionListener,java.awt.event.MouseListener,java.awt.event.MouseMotionListener,java.awt.event.WindowListener,java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,java.util.EventListener,javax.accessibility.Accessible,javax.swing.RootPaneContainer,javax.swing.WindowConstants
public class FilterBuilder extends javax.swing.JFrame implements java.awt.event.WindowListener, java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.dnd.DragGestureListener, java.awt.dnd.DragSourceListener, java.awt.dnd.DropTargetListener, java.awt.datatransfer.ClipboardOwnerThe main program for the FilterBuilder programming system.ToDo:
- thread the attribute fetching
- CSS selector filter
- table row filter
- table column filter
- trigger filter
- undo
- handle bad URLs
- StringBean type secondary text output
- context sensitive menus
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.PointmBasePointThe relative position of the mouse while dragging.protected java.awt.ComponentmCurrentComponentKludge: Used by actionPerformed/filterAction to remember the filter menu item.protected java.awt.dnd.DragSourcemDragSourceEnables this component to be a Drag Source.protected java.awt.dnd.DropTargetmDropTargetThis component is a drop target.protected javax.swing.JPanelmMainPanelThe main panel GUI component.protected javax.swing.JScrollPanemMainScrollerThe main panel scrolling GUI component.protected booleanmMovedIf true selection moved.protected javax.swing.JDesktopPanemOutputThe output panel GUI component.protected java.util.VectormSelectionSelected commands.protected javax.swing.JTextFieldmURLFieldThe URL input GUI component.-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description FilterBuilder()Create an FilterBuilder programming environment.FilterBuilder(java.lang.String title)Creates a new instance of an FilterBuilder environment with the given title.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaboutAction()The action to take when "About" menu or button pressed.voidactionPerformed(java.awt.event.ActionEvent event)Handles menu and toolbar item choices.voidaddFilter(javax.swing.JMenu menu, javax.swing.JToolBar toolbar, java.lang.String class_name)Add a filter to the GUI.protected voidaddSelection(Filter filter)Add a filter to the current selection set.protected java.lang.StringclassFromFile(java.lang.String file)Extracts a java class name from a file name.protected voidclearSelection()Clear (empty) the current selection set.voidcollapseAction()The action to take when "Collapse" menu chosen.voidcollapseAllAction()The action to take when "Collapse" menu chosen.protected voidcopyAction()The action to take when "Copy" menu or button pressed.protected voidcutAction()The action to take when "Cut" menu or button pressed.protected voiddeleteAction()The action to take when "Delete" menu or button pressed.voiddeleteSelection()Delete the current selection set from the filters in the GUI.voiddragDropEnd(java.awt.dnd.DragSourceDropEvent event)This message goes to DragSourceListener, informing it that the dragging has ended.voiddragEnter(java.awt.dnd.DragSourceDragEvent event)This message goes to DragSourceListener, informing it that the dragging has entered the DropSite.voiddragEnter(java.awt.dnd.DropTargetDragEvent event)This is invoked when you are dragging over the DropSite.voiddragExit(java.awt.dnd.DragSourceEvent event)This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.voiddragExit(java.awt.dnd.DropTargetEvent event)Thi ss invoked when you are exit the DropSite without dropping.voiddragGestureRecognized(java.awt.dnd.DragGestureEvent event)A DragGestureRecognizer has detected a platform-dependent drag initiating gesture.voiddragOver(java.awt.dnd.DragSourceDragEvent event)This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.voiddragOver(java.awt.dnd.DropTargetDragEvent event)This is invoked when a drag operation is going on.voiddrop(java.awt.dnd.DropTargetDropEvent event)This is invoked when a drop has occurred.voiddropActionChanged(java.awt.dnd.DragSourceDragEvent event)This is invoked when the user changes the dropAction.voiddropActionChanged(java.awt.dnd.DropTargetDragEvent event)This is invoked if the user modifies the current drop gesture.protected voidexecuteAction()The action to take when "Execute" menu or button pressed.protected voidexitAction()The action to take when "Exit" menu or button pressed.voidexpandAction()The action to take when "Expand" menu chosen.voidexpandAllAction()The action to take when "Expand All" menu chosen.protected voidfetchAction()The action to take when "Fetch" menu pressed.protected voidfilterAction()The action to take when a filter menu or button pressed.protected voidfilteringAction()The action to take when "Filtering" menu pressed.protected java.awt.PointgetBasePoint()Gets the current base point of the mouse pointer.protected SubFilterListgetEnclosed(java.awt.Component component)Get the enclosed sub filter list if any.protected SubFilterListgetEnclosing(java.awt.Component component)Get the enclosing sub filter list if any.Filter[]getFilters()Retrieve the top level filters in the main window.protected Filter[]getSelection()Return the current selection set as an array.protected java.net.URLgetURL(java.lang.String spec)Get a url for the given resource specification.protected voidhintsAction()The action to take when "Hints" menu pressed.protected voidinsertFilters(Filter[] filters, java.awt.Point point, SubFilterList list)Adds a set of filters to the main panel or a sublist.protected voidinstructionsAction()The action to take when "Instructions" menu pressed.booleanisSingleSelection()Check if there is more than one filter selected.protected FilterlastSelected()Return the last filter added to the selection set.voidlostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)Notifies this object that it is no longer the owner of the contents of the clipboard.static voidmain(java.lang.String[] args)The entry point for this application.javax.swing.JButtonmakeFilterButton(java.lang.String class_name)Creates a new button for the given class.protected voidmakeMenuButton(java.lang.String name, java.lang.String description, java.lang.String text, int mnemonic, javax.swing.KeyStroke key, javax.swing.JToolBar toolbar, javax.swing.JMenu menu)Makes menu and toolbar items for commands.protected voidmakeProgram(java.lang.String name, java.lang.StringBuffer out, FilterBean bean)Makes a program like:voidmouseClicked(java.awt.event.MouseEvent event)Invoked when the mouse has been clicked on a component.voidmouseDragged(java.awt.event.MouseEvent event)Mouse drag notification.voidmouseEntered(java.awt.event.MouseEvent event)Invoked when the mouse enters a component.voidmouseExited(java.awt.event.MouseEvent event)Invoked when the mouse exits a component.voidmouseMoved(java.awt.event.MouseEvent event)Mouse move notification.voidmousePressed(java.awt.event.MouseEvent event)Invoked when a mouse button has been pressed on a component.voidmouseReleased(java.awt.event.MouseEvent event)Invoked when a mouse button has been released on a component.protected voidmoveSelection(java.awt.Point translation)Move the current selection set as a group.protected voidnewAction()The action to take when "New" menu or button pressed.voidopen(java.lang.String name)Read a workspace from file.protected voidopenAction()The action to take when "Open" menu or button pressed.protected voidpasteAction()The action to take when "Paste" menu or button pressed.voidrelayout()Redo the layout.protected voidremoveSelection(Filter filter)Remove a filter from the current selection set.voidsave(java.lang.String name)Save the workspace contents to file.protected voidsaveAction()The action to take when "Save" menu or button pressed.protected voidsaveasAction()The action to take when "Save As" menu or button pressed.protected booleanselectionContains(Filter filter)Check if the current selection set contains the given filter.protected voidselectSelection(boolean select)Select(highlight)/deselect the current selection set.java.lang.StringserializeSelection()Serialize the current selection set.protected voidsetBasePoint(java.awt.Point point)Sets the position of the mouse in the component.voidsetExpanded(Filter[] filters, boolean expanded, boolean recursive)Expand or collapse filters, possibly recursively.voidsetupDropTargets(Filter[] filters)Set up drop targets.voidsetupMouseListeners(Filter[] filters)Set up mouse listeners.voidshowContextMenu(java.awt.event.MouseEvent event)Show a pop up context menu.protected voidtutorialAction()The action to take when "Tutorial" menu pressed.voidwindowActivated(java.awt.event.WindowEvent event)Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events.voidwindowClosed(java.awt.event.WindowEvent event)Invoked when a window has been closed as the result of calling dispose on the window.voidwindowClosing(java.awt.event.WindowEvent event)Handles window closing event.voidwindowDeactivated(java.awt.event.WindowEvent event)Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents.voidwindowDeiconified(java.awt.event.WindowEvent event)Invoked when a window is changed from a minimized to a normal state.voidwindowIconified(java.awt.event.WindowEvent event)Invoked when a window is changed from a normal to a minimized state.voidwindowOpened(java.awt.event.WindowEvent event)Invoked the first time a window is made visible.-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
mBasePoint
protected java.awt.Point mBasePoint
The relative position of the mouse while dragging.
-
mSelection
protected java.util.Vector mSelection
Selected commands.
-
mMoved
protected boolean mMoved
If true selection moved.
-
mDropTarget
protected java.awt.dnd.DropTarget mDropTarget
This component is a drop target.
-
mDragSource
protected java.awt.dnd.DragSource mDragSource
Enables this component to be a Drag Source.
-
mCurrentComponent
protected java.awt.Component mCurrentComponent
Kludge: Used by actionPerformed/filterAction to remember the filter menu item.
-
mMainPanel
protected javax.swing.JPanel mMainPanel
The main panel GUI component.
-
mMainScroller
protected javax.swing.JScrollPane mMainScroller
The main panel scrolling GUI component.
-
mURLField
protected javax.swing.JTextField mURLField
The URL input GUI component.
-
mOutput
protected javax.swing.JDesktopPane mOutput
The output panel GUI component.
-
-
Constructor Detail
-
FilterBuilder
public FilterBuilder()
Create an FilterBuilder programming environment.
-
FilterBuilder
public FilterBuilder(java.lang.String title)
Creates a new instance of an FilterBuilder environment with the given title.- Parameters:
title- the title for the new frame.- See Also:
FilterBuilder()
-
-
Method Detail
-
makeMenuButton
protected void makeMenuButton(java.lang.String name, java.lang.String description, java.lang.String text, int mnemonic, javax.swing.KeyStroke key, javax.swing.JToolBar toolbar, javax.swing.JMenu menu)Makes menu and toolbar items for commands.- Parameters:
name- The name of the command.description- A description for the tooltip.text- The text for the menu.mnemonic- The navigation mnemonic.key- Accelerator key.toolbar- The toolbar to add the button to.menu- The menu to add the menu item to.
-
getURL
protected java.net.URL getURL(java.lang.String spec) throws java.net.MalformedURLExceptionGet a url for the given resource specification.- Parameters:
spec- The name of the resource.- Returns:
- The fully formed URL.
- Throws:
java.net.MalformedURLException- In the case that the document base or name of the resource cannot be turned into a URL.
-
makeFilterButton
public javax.swing.JButton makeFilterButton(java.lang.String class_name)
Creates a new button for the given class.- Parameters:
class_name- The name of the Filter class.- Returns:
- A fully functional button with name, tool tip, icon and drag recognizer.
-
addFilter
public void addFilter(javax.swing.JMenu menu, javax.swing.JToolBar toolbar, java.lang.String class_name)Add a filter to the GUI. Adds the filter specified by class_name to the menu, toolbar and starts listening for actions.- Parameters:
menu- The menu to add the filter to.toolbar- The toolbar to add the filter to.class_name- The class name for the filter wrapper. From the wrapper, the NodeFilter, description and icon can be obtained.
-
insertFilters
protected void insertFilters(Filter[] filters, java.awt.Point point, SubFilterList list)
Adds a set of filters to the main panel or a sublist. Sets up the GUI components as drop targets and mouse listeners, and performs a relayout to display them.- Parameters:
filters- The filter wrappers to add.point- The point at which to start adding (list == null).list- The list to add to (point not used), ornullfor the main panel.
-
setBasePoint
protected void setBasePoint(java.awt.Point point)
Sets the position of the mouse in the component.- Parameters:
point- The point where the mouse position is.
-
getBasePoint
protected java.awt.Point getBasePoint()
Gets the current base point of the mouse pointer. This value is used to offset the drag position to maintain the mouse position at the same relative position within the card while dragging.- Returns:
- The current base point of the mouse pointer.
-
getEnclosing
protected SubFilterList getEnclosing(java.awt.Component component)
Get the enclosing sub filter list if any.- Parameters:
component- The component that's supposedly enclosed.- Returns:
- The enclosing component or
nullotherwise.
-
getEnclosed
protected SubFilterList getEnclosed(java.awt.Component component)
Get the enclosed sub filter list if any.- Parameters:
component- The component that's supposedly enclosing the list.- Returns:
- The enclosed component or
nullotherwise.
-
makeProgram
protected void makeProgram(java.lang.String name, java.lang.StringBuffer out, FilterBean bean)Makes a program like:// Generated by FilterBuilder. http://htmlparser.org // [aced0005737200206f72672e68746d6c7061727365722e66696c746572732e416e6446696c74657224c30516b2b7b2120200015b000b6d5072656469636174657374001c5b4c6f72672f68746d6c7061727365722f4e6f646546696c7465723b78707572001c5b4c6f72672e68746d6c7061727365722e4e6f646546696c7465723b8f17479b1d5f7992020000787000000002737200246f72672e68746d6c7061727365722e66696c746572732e5461674e616d6546696c746572b28b2601a614890f0200014c00056d4e616d657400124c6a6176612f6c616e672f537472696e673b78707400044d455441737200296f72672e68746d6c7061727365722e66696c746572732e48617341747472696275746546696c74657296abdfb3b0714cda0200024c000a6d41747472696275746571007e00064c00066d56616c756571007e000678707400046e616d6570] import org.htmlparser.*; import org.htmlparser.filters.*; import org.htmlparser.beans.*; import org.htmlparser.util.*; public class Test { public static void main (String args[]) { TagNameFilter filter0 = new TagNameFilter (); filter0.setName ("META"); HasAttributeFilter filter1 = new HasAttributeFilter (); filter1.setAttributeName ("name"); NodeFilter[] array0 = new NodeFilter[2]; array0[0] = filter0; array0[1] = filter1; AndFilter filter2 = new AndFilter (); filter2.setPredicates (array0); NodeFilter[] array1 = new NodeFilter[1]; array1[0] = filter2; FilterBean bean = new FilterBean (); bean.setFilters (array1); if (0 != args.length) { bean.setURL (args[0]); System.out.println (bean.getNodes ().toHtml ()); } else System.out.println ("Usage: java -classpath .:htmlparser.jar Test"); } } - Parameters:
name- The name of the class.out- The buffer to append to.bean- The bean to extract the filters from to make the program.
-
classFromFile
protected java.lang.String classFromFile(java.lang.String file)
Extracts a java class name from a file name. ToDo: make this package-smart somehow.- Parameters:
file- The name of the file.- Returns:
- The name of the class.
-
save
public void save(java.lang.String name)
Save the workspace contents to file.- Parameters:
name- The name of the file to save it under.
-
newAction
protected void newAction()
The action to take when "New" menu or button pressed.
-
openAction
protected void openAction()
The action to take when "Open" menu or button pressed.
-
saveAction
protected void saveAction()
The action to take when "Save" menu or button pressed.
-
saveasAction
protected void saveasAction()
The action to take when "Save As" menu or button pressed.
-
exitAction
protected void exitAction()
The action to take when "Exit" menu or button pressed.
-
cutAction
protected void cutAction()
The action to take when "Cut" menu or button pressed.
-
copyAction
protected void copyAction()
The action to take when "Copy" menu or button pressed.
-
pasteAction
protected void pasteAction()
The action to take when "Paste" menu or button pressed.
-
deleteAction
protected void deleteAction()
The action to take when "Delete" menu or button pressed.
-
filterAction
protected void filterAction()
The action to take when a filter menu or button pressed.
-
fetchAction
protected void fetchAction()
The action to take when "Fetch" menu pressed.
-
executeAction
protected void executeAction()
The action to take when "Execute" menu or button pressed.
-
instructionsAction
protected void instructionsAction()
The action to take when "Instructions" menu pressed.
-
filteringAction
protected void filteringAction()
The action to take when "Filtering" menu pressed.
-
tutorialAction
protected void tutorialAction()
The action to take when "Tutorial" menu pressed.
-
hintsAction
protected void hintsAction()
The action to take when "Hints" menu pressed.
-
aboutAction
protected void aboutAction()
The action to take when "About" menu or button pressed.
-
expandAction
public void expandAction()
The action to take when "Expand" menu chosen.
-
collapseAction
public void collapseAction()
The action to take when "Collapse" menu chosen.
-
expandAllAction
public void expandAllAction()
The action to take when "Expand All" menu chosen.
-
collapseAllAction
public void collapseAllAction()
The action to take when "Collapse" menu chosen.
-
setupMouseListeners
public void setupMouseListeners(Filter[] filters)
Set up mouse listeners. Setsthisup to listen to each command in the list as a MouseListener. Recursively descends the tree adding to all contained elements also.- Parameters:
filters- The container with commands in it.
-
setupDropTargets
public void setupDropTargets(Filter[] filters)
Set up drop targets. Recursively descends the filter tree and sets up the filter lists as drop targets.- Parameters:
filters- The container with filters in it.
-
setExpanded
public void setExpanded(Filter[] filters, boolean expanded, boolean recursive)
Expand or collapse filters, possibly recursively.- Parameters:
filters- The list of filters to expand or collapse.expanded- Iftruethe filters are expanded, otherwise they are collapsed.recursive- Iftruethe filters are processed recursively.
-
getFilters
public Filter[] getFilters()
Retrieve the top level filters in the main window.- Returns:
- The top level filters.
-
relayout
public void relayout()
Redo the layout.
-
open
public void open(java.lang.String name)
Read a workspace from file. The current contents are erased.- Parameters:
name- The name of the file to open.
-
showContextMenu
public void showContextMenu(java.awt.event.MouseEvent event)
Show a pop up context menu. Shows a context sensitive popup menu at the location of the mouse event.- Parameters:
event- The mouse event that initiates the popup.
-
addSelection
protected void addSelection(Filter filter)
Add a filter to the current selection set.- Parameters:
filter- The filter to add.
-
removeSelection
protected void removeSelection(Filter filter)
Remove a filter from the current selection set.- Parameters:
filter- The filter to remove.
-
selectSelection
protected void selectSelection(boolean select)
Select(highlight)/deselect the current selection set.- Parameters:
select- Iftrueturn on highlighting, turn it off otherwise.
-
clearSelection
protected void clearSelection()
Clear (empty) the current selection set.
-
moveSelection
protected void moveSelection(java.awt.Point translation)
Move the current selection set as a group.- Parameters:
translation- The displacement to move them all by.
-
selectionContains
protected boolean selectionContains(Filter filter)
Check if the current selection set contains the given filter.- Parameters:
filter- The filter to check.- Returns:
trueif the filter is a member,falseotherwise.
-
lastSelected
protected Filter lastSelected()
Return the last filter added to the selection set.- Returns:
- The last filter added or
nullif the current selection set is empty.
-
getSelection
protected Filter[] getSelection()
Return the current selection set as an array.- Returns:
- The array of selected filters.
-
serializeSelection
public java.lang.String serializeSelection()
Serialize the current selection set.- Returns:
- The serialized form of the set of filters.
-
deleteSelection
public void deleteSelection()
Delete the current selection set from the filters in the GUI.
-
isSingleSelection
public boolean isSingleSelection()
Check if there is more than one filter selected.- Returns:
trueif only one filter is selected,falseotherwise.
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
Invoked when the mouse has been clicked on a component.- Specified by:
mouseClickedin interfacejava.awt.event.MouseListener- Parameters:
event- The mouse clicked event.
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent event)
Invoked when a mouse button has been released on a component.- Specified by:
mouseReleasedin interfacejava.awt.event.MouseListener- Parameters:
event- The mouse released event.
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent event)
Invoked when the mouse enters a component.- Specified by:
mouseEnteredin interfacejava.awt.event.MouseListener- Parameters:
event- The mouse entered event.
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent event)
Invoked when the mouse exits a component.- Specified by:
mouseExitedin interfacejava.awt.event.MouseListener- Parameters:
event- The mouse exited event.
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent event)
Invoked when a mouse button has been pressed on a component.- Specified by:
mousePressedin interfacejava.awt.event.MouseListener- Parameters:
event- The mouse pressed event.
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent event)
Mouse drag notification. Invoked when a mouse button is pressed on a component and then dragged. Mouse drag events will continue to be delivered to the component where the first originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).- Specified by:
mouseDraggedin interfacejava.awt.event.MouseMotionListener- Parameters:
event- The mouse drag event.
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent event)
Mouse move notification. Invoked when the mouse button has been moved on a component (with no buttons no down).- Specified by:
mouseMovedin interfacejava.awt.event.MouseMotionListener- Parameters:
event- The mouse moved event.
-
windowOpened
public void windowOpened(java.awt.event.WindowEvent event)
Invoked the first time a window is made visible. Not used.- Specified by:
windowOpenedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowClosing
public void windowClosing(java.awt.event.WindowEvent event)
Handles window closing event. Performs functionexitApplication().- Specified by:
windowClosingin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowClosed
public void windowClosed(java.awt.event.WindowEvent event)
Invoked when a window has been closed as the result of calling dispose on the window. Not used.- Specified by:
windowClosedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowIconified
public void windowIconified(java.awt.event.WindowEvent event)
Invoked when a window is changed from a normal to a minimized state. For many platforms, a minimized window is displayed as the icon specified in the window's iconImage property. Not used.- Specified by:
windowIconifiedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowDeiconified
public void windowDeiconified(java.awt.event.WindowEvent event)
Invoked when a window is changed from a minimized to a normal state. Not used.- Specified by:
windowDeiconifiedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowActivated
public void windowActivated(java.awt.event.WindowEvent event)
Invoked when the window is set to be the user's active window, which means the window (or one of its subcomponents) will receive keyboard events. Not used.- Specified by:
windowActivatedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
windowDeactivated
public void windowDeactivated(java.awt.event.WindowEvent event)
Invoked when a window is no longer the user's active window, which means that keyboard events will no longer be delivered to the window or its subcomponents. Not used.- Specified by:
windowDeactivatedin interfacejava.awt.event.WindowListener- Parameters:
event- The window event.
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
Handles menu and toolbar item choices.- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener- Parameters:
event- The action even that triggers this function.
-
lostOwnership
public void lostOwnership(java.awt.datatransfer.Clipboard clipboard, java.awt.datatransfer.Transferable contents)Notifies this object that it is no longer the owner of the contents of the clipboard.- Specified by:
lostOwnershipin interfacejava.awt.datatransfer.ClipboardOwner- Parameters:
clipboard- The clipboard that is no longer owned.contents- The contents which this owner had placed on the clipboard.
-
dragGestureRecognized
public void dragGestureRecognized(java.awt.dnd.DragGestureEvent event)
A DragGestureRecognizer has detected a platform-dependent drag initiating gesture. It is notifying this listener in order for it to initiate the action for the user.- Specified by:
dragGestureRecognizedin interfacejava.awt.dnd.DragGestureListener- Parameters:
event- The DragGestureEvent describing the gesture that has just occurred.
-
dragDropEnd
public void dragDropEnd(java.awt.dnd.DragSourceDropEvent event)
This message goes to DragSourceListener, informing it that the dragging has ended.- Specified by:
dragDropEndin interfacejava.awt.dnd.DragSourceListener- Parameters:
event- Details about the drop event.
-
dragEnter
public void dragEnter(java.awt.dnd.DragSourceDragEvent event)
This message goes to DragSourceListener, informing it that the dragging has entered the DropSite.- Specified by:
dragEnterin interfacejava.awt.dnd.DragSourceListener- Parameters:
event- Details about the drag event.
-
dragExit
public void dragExit(java.awt.dnd.DragSourceEvent event)
This message goes to DragSourceListener, informing it that the dragging has exited the DropSite.- Specified by:
dragExitin interfacejava.awt.dnd.DragSourceListener- Parameters:
event- Details about the drag event.
-
dragOver
public void dragOver(java.awt.dnd.DragSourceDragEvent event)
This message goes to DragSourceListener, informing it that the dragging is currently ocurring over the DropSite.- Specified by:
dragOverin interfacejava.awt.dnd.DragSourceListener- Parameters:
event- Details about the drag event.
-
dropActionChanged
public void dropActionChanged(java.awt.dnd.DragSourceDragEvent event)
This is invoked when the user changes the dropAction.- Specified by:
dropActionChangedin interfacejava.awt.dnd.DragSourceListener- Parameters:
event- Details about the drop action event.
-
dragEnter
public void dragEnter(java.awt.dnd.DropTargetDragEvent event)
This is invoked when you are dragging over the DropSite.- Specified by:
dragEnterin interfacejava.awt.dnd.DropTargetListener- Parameters:
event- Details about the drag event.
-
dragExit
public void dragExit(java.awt.dnd.DropTargetEvent event)
Thi ss invoked when you are exit the DropSite without dropping.- Specified by:
dragExitin interfacejava.awt.dnd.DropTargetListener- Parameters:
event- Details about the drag event.
-
dragOver
public void dragOver(java.awt.dnd.DropTargetDragEvent event)
This is invoked when a drag operation is going on.- Specified by:
dragOverin interfacejava.awt.dnd.DropTargetListener- Parameters:
event- Details about the drag event.
-
drop
public void drop(java.awt.dnd.DropTargetDropEvent event)
This is invoked when a drop has occurred.- Specified by:
dropin interfacejava.awt.dnd.DropTargetListener- Parameters:
event- The drop event.
-
dropActionChanged
public void dropActionChanged(java.awt.dnd.DropTargetDragEvent event)
This is invoked if the user modifies the current drop gesture.- Specified by:
dropActionChangedin interfacejava.awt.dnd.DropTargetListener- Parameters:
event- Details about the drop action change event.
-
main
public static void main(java.lang.String[] args)
The entry point for this application. Creates a new FilterBuilder and makes it visible.- Parameters:
args- [0] optional URL to operate on.
-
-