public class ExercisesListView extends View implements AlgorithmExerciseProvider
AlgorithmExercise
s and operates as an AlgorithmExerciseProvider
.
ExercisesListView(LanguageFile, String)
to specify a language file from which
labels, tooltips and messages are read by the given language id. The following language labels are available:
Resources.LANGUAGE_FILE
.javax.swing.JComponent.AccessibleJComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ExercisesListView(LanguageFile langFile,
java.lang.String langID)
Creates a new exercises list.
|
Modifier and Type | Method and Description |
---|---|
void |
afterProcessingExercise(AlgorithmExercise<?> exercise,
AlgorithmExercise.ExamResult result,
java.lang.String lastSolution)
Is invoked when the exercise is processed.
|
void |
afterSolvingExercise(AlgorithmExercise<?> exercise,
boolean succeeded,
java.lang.String solution)
Is invoked every time the user has entered a new solution of the exercise.
|
void |
beforeProcessingExercise(AlgorithmExercise<?> exercise,
AlgorithmStep step)
Is invoked when the exercise of the current step in the algorithm is loaded and should be presented to the user.
|
void |
beginExam()
Is invoked when the exam is started meaning more precisely when the algorithm is started in exercise mode.
|
protected void |
close()
Closes the exercises list view.
|
void |
endExam(boolean canceled)
Is invoked when the exam is completed meaning more precisely when the algorithm is stopped or its execution is completed.
|
void |
removeAll()
The components of an exercises list may not be removed meaning this method does nothing!
|
protected void |
repaintComponent()
Repaints the component.
|
void |
reset()
Resets the view which means sets the initial state of the view.
|
void |
setHandler(AlgorithmExerciseHandler handler)
Sets the handler of the exercise mode.
|
void |
setVisible(boolean visible)
Sets whether the exercises list should be visible.
|
addHeaderBarComponent, addHeaderBarSeparator, addImpl, autoRepaint, beforeRemove, extendTitle, getAutoRepaint, getContentPanel, getTitle, highlight, highlight, isClosable, isVisible, loadConfiguration, loadConfiguration, readConfigurationData, removeHeaderBarComponent, saveConfiguration, saveConfiguration, setAutoRepaint, setBorder, setCloseButtonToolTip, setLayout, toString, writeConfigurationData
isRepaintDisabled, repaint, setRepaintDisabled
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
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, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isVisible
public ExercisesListView(LanguageFile langFile, java.lang.String langID)
LanguageFile
and a language id to display language dependent
messages and tooltips in the evaluation panel. The following language labels are available:
langFile
- the language file or null
if the list should not use language dependent labels, tooltips or messages (in this case the predefined labels, tooltips and messages are shown)langID
- the language idpublic void removeAll()
public void setVisible(boolean visible)
setVisible
in interface AlgorithmExerciseProvider
setVisible
in class View
visible
- true
if the exercises list should be visible otherwise false
public void setHandler(AlgorithmExerciseHandler handler)
AlgorithmExerciseProvider
setHandler
in interface AlgorithmExerciseProvider
handler
- the handlerpublic void beginExam()
AlgorithmExerciseProvider
beginExam
in interface AlgorithmExerciseProvider
public void endExam(boolean canceled)
AlgorithmExerciseProvider
endExam
in interface AlgorithmExerciseProvider
canceled
- true
if the user stops the algorithm during the execution otherwise false
public void beforeProcessingExercise(AlgorithmExercise<?> exercise, AlgorithmStep step)
AlgorithmExerciseProvider
beforeProcessingExercise
in interface AlgorithmExerciseProvider
exercise
- the exercisestep
- the related step or null
if there is no related steppublic void afterProcessingExercise(AlgorithmExercise<?> exercise, AlgorithmExercise.ExamResult result, java.lang.String lastSolution)
AlgorithmExerciseProvider
afterProcessingExercise
in interface AlgorithmExerciseProvider
exercise
- the exerciseresult
- the final result of the exerciselastSolution
- the last solution the user has givenpublic void afterSolvingExercise(AlgorithmExercise<?> exercise, boolean succeeded, java.lang.String solution)
AlgorithmExerciseProvider
afterSolvingExercise
in interface AlgorithmExerciseProvider
exercise
- the exercisesucceeded
- true
if the user has entered the right solution otherwise false
solution
- the string representation of the solution the user has madepublic void reset()
View
protected void repaintComponent()
BaseComponent.repaint()
. You can override this method to repaint sub-components but ensure that
the super type method is invoked too meaning:
protected void repaintComponent() { // repaint the parent super.repaintComponent(); // repaint sub-components ... }
repaintComponent
in class BaseComponent