jscicalc.ScrollableLabel Class Reference

This class forms a base class for scrollable labels. More...

Inheritance diagram for jscicalc.ScrollableLabel:

jscicalc.DisplayLabel jscicalc.EntryLabel
Collaboration diagram for jscicalc.ScrollableLabel:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ScrollableLabel (ReadOnlyDisplayPanel panel, Navigator navigator)
 The constructor defines an interface to the DisplayPanel object.
abstract void update (boolean on)
 Update the display.
void left ()
 Move the Caret left if possible.
void right ()
 Move the Caret right if possible.
void newExpression ()
 Note that we have a new expression (in case we’re asked to update the panel).
void updateCaretVisibility ()
 Use to update whether or not caret is shown.
void paintComponent (java.awt.Graphics g)

Protected Member Functions

int getDotPosition ()
 Get the Caret position.
void setCaretVisible (boolean b)
 Change whether or not the caret should be shown, assuming permission is given.

Protected Attributes

boolean caretVisible
 Use to show if caret should be visible in this object, assuming object has permission to show it.
Navigator navigator
 The NavigationFilter we use to make sure Caret is always sensibly placed.
String expression
 The expression (an HTML string).
int dotPosition
 The current Caret position (probably only meaningful internally).
javax.swing.JPanel jPanel
 A JPanel we use as part of this component.
javax.swing.JTextPane textPane
 Allows us to scroll through the expression and add some simple editing methods.
ReadOnlyDisplayPanel panel
 Interface to main display panel (good for accessing other parts of the calculator).
boolean newExpression
 Have we just evaluated an expression so that Parser is cleared but we haven’t yet cleared the expression in this display?
javax.swing.Action backward
 Not used.
javax.swing.Action forward
 Not used.

Static Private Attributes

static final long serialVersionUID = 1L


Detailed Description

This class forms a base class for scrollable labels.

The original scrollable label was the EntryLabel, but we also want the DisplayLabel to be scrollable. Hence, a base class can provide common functionality.

Author:
J. D. Lamb
Version:
Revision
1.3

Constructor & Destructor Documentation

jscicalc.ScrollableLabel.ScrollableLabel ( ReadOnlyDisplayPanel  panel,
Navigator  navigator 
)

The constructor defines an interface to the DisplayPanel object.

Parameters:
panel The display panel (we read values from CalculatorApplet through it)
navigator The NavigationFilter that allows us to move correctly through the HTML expression in the DisplayPanel object

References jscicalc.ScrollableLabel.backward, jscicalc.ScrollableLabel.dotPosition, jscicalc.ScrollableLabel.expression, jscicalc.ScrollableLabel.forward, jscicalc.ScrollableLabel.jPanel, jscicalc.ScrollableLabel.newExpression(), jscicalc.ScrollableLabel.textPane, and jscicalc.ScrollableLabel.update().


Member Function Documentation

abstract void jscicalc.ScrollableLabel.update ( boolean  on  )  [pure virtual]

Update the display.

The parameter is probably redundant since we can get the value of on indirectly from the CalculatorApplet object.

Parameters:
on if false the calculator is switched off and so we don’t display anything; otherwise redisplay expression.

Implemented in jscicalc.DisplayLabel, and jscicalc.EntryLabel.

Referenced by jscicalc.ScrollableLabel.ScrollableLabel().

void jscicalc.ScrollableLabel.left (  ) 

void jscicalc.ScrollableLabel.right (  ) 

int jscicalc.ScrollableLabel.getDotPosition (  )  [protected]

Get the Caret position.

I’m not quite sure how Caret positions work because Sun’s documentation isn’t crytal clear on this, but we can move Carets without any problems.

Returns:
Caret position

References jscicalc.Navigator.dots, jscicalc.ScrollableLabel.navigator, and jscicalc.ScrollableLabel.textPane.

Referenced by jscicalc.EntryLabel.delete(), and jscicalc.EntryLabel.insert().

Note that we have a new expression (in case we’re asked to update the panel).

This is useful if we’ve just evaluated an expression but not cleared the panel. Then the Parser and this object will not match and we must be aware of this to avoid problems.

References jscicalc.ScrollableLabel.setCaretVisible().

Referenced by jscicalc.EntryLabel.insert(), jscicalc.ScrollableLabel.ScrollableLabel(), and jscicalc.EntryLabel.setExpression().

void jscicalc.ScrollableLabel.updateCaretVisibility (  ) 

void jscicalc.ScrollableLabel.setCaretVisible ( boolean  b  )  [protected]

Change whether or not the caret should be shown, assuming permission is given.

Parameters:
b true if caret should be shown; false otherwise

Reimplemented in jscicalc.DisplayLabel.

References jscicalc.ScrollableLabel.caretVisible, and jscicalc.ScrollableLabel.updateCaretVisibility().

Referenced by jscicalc.ScrollableLabel.newExpression(), and jscicalc.EntryLabel.update().

void jscicalc.ScrollableLabel.paintComponent ( java.awt.Graphics  g  ) 


Member Data Documentation

Use to show if caret should be visible in this object, assuming object has permission to show it.

Referenced by jscicalc.ScrollableLabel.setCaretVisible(), jscicalc.DisplayLabel.setCaretVisible(), and jscicalc.ScrollableLabel.updateCaretVisibility().

javax.swing.JPanel jscicalc.ScrollableLabel.jPanel [protected]

A JPanel we use as part of this component.

Referenced by jscicalc.ScrollableLabel.ScrollableLabel().

javax.swing.JTextPane jscicalc.ScrollableLabel.textPane [protected]

Have we just evaluated an expression so that Parser is cleared but we haven’t yet cleared the expression in this display?

Referenced by jscicalc.DisplayPanel.newExpression().

javax.swing.Action jscicalc.ScrollableLabel.backward [protected]

javax.swing.Action jscicalc.ScrollableLabel.forward [protected]

final long jscicalc.ScrollableLabel.serialVersionUID = 1L [static, private]


The documentation for this class was generated from the following file:

Generated on Sun Jun 1 08:57:45 2008 for Java Scientific Calculator by  doxygen 1.5.5