Package org.apache.uima.tools.cpm
Class CpmPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.apache.uima.tools.cpm.CpmPanel
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
,TabClosedListener
,FileSelectorListener
,TransportControlListener
public class CpmPanel
extends JPanel
implements ActionListener, FileSelectorListener, TabClosedListener, TransportControlListener
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
MetaDataPanel used for Collection Reader & AE selection and configuration.(package private) class
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
FieldsModifier and TypeFieldDescriptionprivate JButton
private JButton
private JFileChooser
private JPanel
private Vector
private JTabbedPaneWithCloseIcons
private TitledBorder
private CasInitializerDescription
private FileSelector
private long
private CpmPanel.ResetableMetaDataPanel
private TitledBorder
private JMenuItem
private CollectionReaderDescription
private long
private CpmPanel.ResetableMetaDataPanel
private TitledBorder
private JFileChooser
private JPanel
private Vector
private JTabbedPaneWithCloseIcons
private TitledBorder
private CpeDescription
private final ResourceManager
private int
private File
static final String
private boolean
private long
private JSplitPane
private CollectionProcessingEngine
private JButton
private JButton
private JButton
private JButton
private boolean
private boolean
private JMenuItem
private JFileChooser
private Timer
private Preferences
Stores user preferencesprivate static final String
private static final String
private JProgressBar
private Timer
private FileSelector
private JSplitPane
private JMenuItem
private JMenuItem
private JCheckBoxMenuItem
private boolean
private boolean
private static final long
private AbstractButton
private JLabel
private AbstractButton
private TransportControlPanel
private JMenuItem
Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
private void
private boolean
addAE
(CpeCasProcessor cpeCasProc) private void
addConsumer
(String consumerSpecifierFile) private boolean
addConsumer
(CpeCasProcessor cpeCasProc) void
private void
clearAll()
Resets the GUI to an empty state.private void
Marks all fields as not dirty.boolean
Ask user to confirm exist.void
void
void
void
private CpeDescription
Creates JMenuItems that should be added to the File menuprivate void
createParameterOverrides
(CasProcessorConfigurationParameterSettings aSettings, MetaDataPanel aPanel) Called by createCpeDescription to add configuration parameter overrides to the CpeDescription being constructed, based on the user's changes in the GUI.Creates JMenuItems that should be added to the View menuvoid
displayError
(String aErrorString) Displays an error message to the user.void
displayError
(Throwable aThrowable) Displays an error message to the user.private void
private void
doSaveCpeDescriptor
(File aFile) boolean
fileSelected
(JComponent source, String fileString) private Frame
private void
Initialize the file choosers.private boolean
isCasConsumerSpecifier
(ResourceSpecifier specifier) private boolean
isDirty()
Returns whether the GUI is dirty; that is, whether configuration settings have been modified since the last save.private String
makeUniqueCasProcessorName
(String baseName) void
private void
openCpeDescriptor
(File aFile) private boolean
private boolean
void
private void
void
private void
private void
private void
Prompt user for file to save CPE Descriptor to, and do the save.private void
setCasInitializerPanelVisible
(boolean visible) private void
setFrameEnabled
(boolean onOff) Called to lock the GUI while processing is occurring.private void
setSaveUsingImports
(boolean b) private void
void
tabClosed
(JTabbedPaneWithCloseIcons source, int tabPos) private void
Updates the configuration parameter settings in this.currentCpeDesc to match the current state of the GUI.private void
updateImport
(CpeComponentDescriptor descriptor, File cpeDescSaveFile) private void
updateImports
(File cpeDescSaveFile) private File
Utility method for convertion a URL to a File name, taking care of proper escaping.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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, 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, 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, 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, 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, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
HELP_MESSAGE
- See Also:
-
PREFS_CPE_DESCRIPTOR_FILE
- See Also:
-
PREFS_SAVE_USING_IMPORTS
- See Also:
-
openCpeDescMenuItem
-
saveCpeDescMenuItem
-
refreshMenuItem
-
clearAllMenuItem
-
mainSplitPane
-
readerInitializerSplitPane
-
collectionReaderPanel
-
collectionReaderTitledBorder
-
casInitializerPanel
-
casInitializerTitledBorder
-
readerFileSelector
-
casInitializerFileSelector
-
aeMainPanel
-
aeTabbedPane
-
moveAeRightButton
-
moveAeLeftButton
-
addAeButton
-
aeTitledBorder
-
consumersPanel
-
consumerTitledBorder
-
addConsumerButton
-
moveConsumerRightButton
-
moveConsumerLeftButton
-
consumerTabbedPane
-
aeSpecifiers
-
consumerSpecifiers
-
progressBar
-
transportControlPanel
-
startButton
-
stopButton
-
statusLabel
-
progressTimer
-
elapsedTime
private int elapsedTime -
performanceQueryTimer
-
collectionReaderDesc
-
casInitializerDesc
-
mCPE
-
indeterminateProgressPause
private boolean indeterminateProgressPause -
aeFileChooser
-
consumerFileChooser
-
openSaveFileChooser
-
fileChooserRootDir
-
collectionReaderLastFileSyncTimestamp
private long collectionReaderLastFileSyncTimestamp -
casInitializerLastFileSyncTimestamp
private long casInitializerLastFileSyncTimestamp -
lastFileSyncUserPromptTime
private long lastFileSyncUserPromptTime -
prefs
Stores user preferences -
mShuttingDown
private boolean mShuttingDown -
mPaused
private boolean mPaused -
selectedComponentsChanged
private boolean selectedComponentsChanged -
viewCasInitializerPanelMenuItem
-
currentCpeDesc
-
defaultResourceManager
-
saveUsingImports
private boolean saveUsingImports -
saveUsingImportMenuItem
-
-
Constructor Details
-
CpmPanel
public CpmPanel()
-
-
Method Details
-
initFileChoosers
private void initFileChoosers()Initialize the file choosers. This is called initially from the constructor but can be called again to reset the file choosers to their default state. -
getParentFrame
-
createFileMenuItems
Creates JMenuItems that should be added to the File menu- Returns:
- a List of JMenuItems
-
createViewMenuItems
Creates JMenuItems that should be added to the View menu- Returns:
- a List of JMenuItems
-
setCasInitializerPanelVisible
private void setCasInitializerPanelVisible(boolean visible) -
readPreferences
private void readPreferences() -
setSaveUsingImports
private void setSaveUsingImports(boolean b) -
startProcessing
private void startProcessing() -
updateCpeDescriptionParameterOverrides
Updates the configuration parameter settings in this.currentCpeDesc to match the current state of the GUI.- Throws:
Exception
-
createParameterOverrides
private void createParameterOverrides(CasProcessorConfigurationParameterSettings aSettings, MetaDataPanel aPanel) throws CpeDescriptorException Called by createCpeDescription to add configuration parameter overrides to the CpeDescription being constructed, based on the user's changes in the GUI.- Parameters:
aSettings
- the CasProcessorConfigurationParameterSettings element that will be modifiedaPanel
- the GUI panel representing settings for the CAS ProcessoraClearDirty
- whether to clear the dirty bit of each field. This should be set to true when this method is called during the act of saving the CPE descriptor.- Throws:
CpeDescriptorException
-
clearDirty
private void clearDirty()Marks all fields as not dirty. To be called when CPE descriptor is opened or saved. -
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
-
clearAll
private void clearAll()Resets the GUI to an empty state. -
createEmptyCpeDescription
-
saveCpeDescriptor
private void saveCpeDescriptor()Prompt user for file to save CPE Descriptor to, and do the save. -
doSaveCpeDescriptor
- Throws:
Exception
-
updateImports
- Parameters:
file
-- Throws:
Exception
-
updateImport
- Parameters:
descriptor
-cpeDescSaveFile
-- Throws:
Exception
-
urlToFile
Utility method for convertion a URL to a File name, taking care of proper escaping.- Parameters:
url
- a URL- Returns:
- File corresponding to that URL
- Throws:
URISyntaxException
-
displayProgress
private void displayProgress() -
confirmExit
public boolean confirmExit()Ask user to confirm exist. Return true if they confirm, false if not. -
checkForOutOfSyncFiles
public void checkForOutOfSyncFiles() -
refreshOutOfSyncFiles
public void refreshOutOfSyncFiles() -
displayError
Displays an error message to the user.- Parameters:
aErrorString
- error message to display
-
displayError
Displays an error message to the user.- Parameters:
aThrowable
- Throwable whose message is to be displayed.
-
populateCollectionReaderPanel
private boolean populateCollectionReaderPanel(CpeCollectionReaderIterator cpeColRdr) throws InvalidXMLException, IOException, ResourceConfigurationException -
populateCasInitializerPanel
private boolean populateCasInitializerPanel(CpeCollectionReaderCasInitializer cpeCasIni) throws InvalidXMLException, IOException, ResourceConfigurationException -
addAE
private void addAE(String aeSpecifierFile) throws CpeDescriptorException, InvalidXMLException, IOException, ResourceConfigurationException -
addAE
private boolean addAE(CpeCasProcessor cpeCasProc) throws CpeDescriptorException, InvalidXMLException, IOException, ResourceConfigurationException -
addConsumer
private void addConsumer(String consumerSpecifierFile) throws CpeDescriptorException, InvalidXMLException, IOException, ResourceConfigurationException -
addConsumer
private boolean addConsumer(CpeCasProcessor cpeCasProc) throws CpeDescriptorException, InvalidXMLException, IOException, ResourceConfigurationException -
makeUniqueCasProcessorName
-
removeAllAEsAndConsumers
private void removeAllAEsAndConsumers() -
fileSelected
- Specified by:
fileSelected
in interfaceFileSelectorListener
-
tabClosed
- Specified by:
tabClosed
in interfaceTabClosedListener
- Parameters:
source
- the JTabbedPaneWithCloseIcons control sending this eventtabPos
- position of the tab that was closed
-
controlStarted
public void controlStarted()- Specified by:
controlStarted
in interfaceTransportControlListener
-
controlPaused
public void controlPaused()- Specified by:
controlPaused
in interfaceTransportControlListener
-
controlResumed
public void controlResumed()- Specified by:
controlResumed
in interfaceTransportControlListener
-
controlStopped
public void controlStopped()- Specified by:
controlStopped
in interfaceTransportControlListener
-
resetScreen
private void resetScreen() -
setFrameEnabled
private void setFrameEnabled(boolean onOff) Called to lock the GUI while processing is occurring. We don't actually disable the JFrame, because we don't want to disable the stop/pause buttons. Instead we disable all of the controls that the user shouldn't mess with while processing is occurring.- Parameters:
onOff
- true to enable, false to disable
-
onCompletion
public void onCompletion() -
printStats
public void printStats() -
isDirty
private boolean isDirty()Returns whether the GUI is dirty; that is, whether configuration settings have been modified since the last save.- Returns:
- whether the GUI is dirty
-
openCpeDescriptor
private void openCpeDescriptor(File aFile) throws InvalidXMLException, IOException, CpeDescriptorException, ResourceConfigurationException -
isCasConsumerSpecifier
- Parameters:
specifier
-
-