cz.cuni.pogamut.posh.explorer
Class Explorer<T>

Package class diagram package Explorer
java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by cz.cuni.pogamut.posh.explorer.Explorer<T>
Type Parameters:
T - Type that is being crawled and also the type that will be returned in selection.
All Implemented Interfaces:
CrawlerListener<T>, ImageObserver, MenuContainer, Serializable, Accessible, ListCellRenderer

public abstract class Explorer<T>
extends JPanel
implements CrawlerListener<T>, ListCellRenderer

Panel for showing the results of crawling.

Author:
Honza
See Also:
Crawler, Serialized Form

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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
Explorer(Crawler<T> refreshCrawler)
           
 
Method Summary
 void crawledData(Crawler<T> crawler, Collection<T> data)
          Crawler has found new data, and they are now passed to the listeners.
protected abstract  Transferable createItemTransferable(T data)
          Create new Transferable from item data.
protected abstract  Transferable createNewItemTransferable()
          Create Transferable that is used when user drags and drops node representing new item somewhere (presumably to scene).
protected abstract  void deleteItem(T item)
          Delete item (e.g.
protected abstract  void displayItem(T item)
          Display item in the editor.
protected abstract  boolean filter(String query, boolean caseSensitive, T item)
          Method to filter items in the Explorer.
 void finished(Crawler<T> crawler, boolean error)
          Yay, crawler has finished!.
protected abstract  String getItemDescription(T item)
          Get description of an item (to be used in the tootltip text).
 Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
           
protected abstract  String getNewItemLabel()
          Get label for new item action.
protected abstract  String getRenderedLabel(T item)
          Get label of an result list item to be rendered.
 T getSelected()
           
 void recrawlElements()
           
 void started(Crawler<T> crawler)
          Crawling has started, the crawler is working.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintComponent, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printComponent, printChildren, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, checkImage, checkImage, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Explorer

public Explorer(Crawler<T> refreshCrawler)
Method Detail

getSelected

public T getSelected()

getNewItemLabel

protected abstract String getNewItemLabel()
Get label for new item action.

Returns:
String to be shown as first item in the list, basically synonym for add new item action.

filter

protected abstract boolean filter(String query,
                                  boolean caseSensitive,
                                  T item)
Method to filter items in the Explorer. Whe user types something into search box, explorer uses some implementation of this filter to determine which items should be shown in the result window.

Parameters:
query - String query, what user typed into search window
caseSensitive - Should the filtering be case sensitive?
item - Item that will be evaluated if it should be filtered out or not
Returns:
True if item should not be included (i.e. it should be filtered out) False if item should be included (shown in the result)

getRenderedLabel

protected abstract String getRenderedLabel(T item)
Get label of an result list item to be rendered.

Parameters:
item - Item that has survived filtration.
Returns:
name of the item to be displayed in the list.

getItemDescription

protected abstract String getItemDescription(T item)
Get description of an item (to be used in the tootltip text).

Parameters:
item - Item in the result list
Returns:
tooltip thaty should be shown when user hovers over the item.

createItemTransferable

protected abstract Transferable createItemTransferable(T data)
Create new Transferable from item data. Used in the explorer for Drag and drop operation.

Parameters:
data - data that will be transfered, can be null
Returns:
new transferable or null if data isn't suitable for transfer.

createNewItemTransferable

protected abstract Transferable createNewItemTransferable()
Create Transferable that is used when user drags and drops node representing new item somewhere (presumably to scene). When the transferable is asked for data, it queries the user for the data and returns new item.


displayItem

protected abstract void displayItem(T item)
Display item in the editor.

Parameters:
item - Item to be displayed

deleteItem

protected abstract void deleteItem(T item)
Delete item (e.g. Competence) from the plan, that may include some questions to the user ("Are you sure?") .

Parameters:
item - Item to be deleted.

getListCellRendererComponent

public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
Specified by:
getListCellRendererComponent in interface ListCellRenderer

started

public void started(Crawler<T> crawler)
Description copied from interface: CrawlerListener
Crawling has started, the crawler is working.

Specified by:
started in interface CrawlerListener<T>
Parameters:
crawler - crawler that has started executing.

crawledData

public void crawledData(Crawler<T> crawler,
                        Collection<T> data)
Description copied from interface: CrawlerListener
Crawler has found new data, and they are now passed to the listeners.

Specified by:
crawledData in interface CrawlerListener<T>
Parameters:
crawler - crawler that has crawled new data

finished

public void finished(Crawler<T> crawler,
                     boolean error)
Description copied from interface: CrawlerListener
Yay, crawler has finished!. No new data will be fed to the listener.

Specified by:
finished in interface CrawlerListener<T>
Parameters:
crawler - crawler that has finished.
error - did crawler finsih because of error?

recrawlElements

public void recrawlElements()


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.