

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 |
The original scrollable label was the EntryLabel, but we also want the DisplayLabel to be scrollable. Hence, a base class can provide common functionality.
| jscicalc.ScrollableLabel.ScrollableLabel | ( | ReadOnlyDisplayPanel | panel, | |
| Navigator | navigator | |||
| ) |
The constructor defines an interface to the DisplayPanel object.
| 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().
| 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.
| 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 | ( | ) |
Move the Caret left if possible.
Reimplemented in jscicalc.DisplayLabel.
References jscicalc.ScrollableLabel.dotPosition, jscicalc.Navigator.dots, jscicalc.ScrollableLabel.navigator, and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.left().
| void jscicalc.ScrollableLabel.right | ( | ) |
Move the Caret right if possible.
Reimplemented in jscicalc.DisplayLabel.
References jscicalc.ScrollableLabel.dotPosition, jscicalc.Navigator.dots, jscicalc.ScrollableLabel.navigator, and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.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.
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 | ( | ) |
Use to update whether or not caret is shown.
References jscicalc.ScrollableLabel.caretVisible, jscicalc.ScrollableLabel.dotPosition, jscicalc.ReadOnlyDisplayPanel.hasCaret(), jscicalc.ScrollableLabel.panel, and jscicalc.ScrollableLabel.textPane.
Referenced by jscicalc.DisplayPanel.setCaretToDisplay(), jscicalc.DisplayPanel.setCaretToEntry(), jscicalc.ScrollableLabel.setCaretVisible(), and jscicalc.DisplayLabel.setCaretVisible().
| void jscicalc.ScrollableLabel.setCaretVisible | ( | boolean | b | ) | [protected] |
Change whether or not the caret should be shown, assuming permission is given.
| 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 | ) |
boolean jscicalc.ScrollableLabel.caretVisible [protected] |
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().
Navigator jscicalc.ScrollableLabel.navigator [protected] |
The NavigationFilter we use to make sure Caret is always sensibly placed.
Referenced by jscicalc.EntryLabel.delete(), jscicalc.ScrollableLabel.getDotPosition(), jscicalc.EntryLabel.insert(), jscicalc.ScrollableLabel.left(), jscicalc.ScrollableLabel.right(), jscicalc.DisplayLabel.ScrollData.ScrollData(), jscicalc.EntryLabel.setExpression(), and jscicalc.DisplayLabel.setExpression().
String jscicalc.ScrollableLabel.expression [protected] |
The expression (an HTML string).
Referenced by jscicalc.EntryLabel.clear(), jscicalc.DisplayLabel.clear(), jscicalc.EntryLabel.delete(), jscicalc.EntryLabel.insert(), jscicalc.ScrollableLabel.ScrollableLabel(), jscicalc.EntryLabel.setExpression(), jscicalc.DisplayLabel.setExpression(), jscicalc.EntryLabel.update(), and jscicalc.DisplayLabel.update().
int jscicalc.ScrollableLabel.dotPosition [protected] |
The current Caret position (probably only meaningful internally).
Referenced by jscicalc.EntryLabel.clear(), jscicalc.DisplayLabel.clear(), jscicalc.EntryLabel.delete(), jscicalc.DisplayLabel.ScrollData.getScrollDirections(), jscicalc.EntryLabel.insert(), jscicalc.ScrollableLabel.left(), jscicalc.DisplayLabel.ScrollData.left(), jscicalc.ScrollableLabel.right(), jscicalc.DisplayLabel.ScrollData.right(), jscicalc.ScrollableLabel.ScrollableLabel(), jscicalc.EntryLabel.setExpression(), jscicalc.DisplayLabel.setExpression(), jscicalc.EntryLabel.update(), jscicalc.DisplayLabel.update(), 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] |
Allows us to scroll through the expression and add some simple editing methods.
Referenced by jscicalc.EntryLabel.delete(), jscicalc.DisplayLabel.DisplayLabel(), jscicalc.ScrollableLabel.getDotPosition(), jscicalc.EntryLabel.insert(), jscicalc.ScrollableLabel.left(), jscicalc.DisplayLabel.ScrollData.left(), jscicalc.ScrollableLabel.right(), jscicalc.DisplayLabel.ScrollData.right(), jscicalc.ScrollableLabel.ScrollableLabel(), jscicalc.EntryLabel.update(), jscicalc.DisplayLabel.ScrollData.update(), jscicalc.DisplayLabel.update(), and jscicalc.ScrollableLabel.updateCaretVisibility().
ReadOnlyDisplayPanel jscicalc.ScrollableLabel.panel [protected] |
Interface to main display panel (good for accessing other parts of the calculator).
Referenced by jscicalc.DisplayLabel.getBase(), jscicalc.DisplayLabel.setExpression(), jscicalc.DisplayLabel.setNewExpression(), jscicalc.EntryLabel.update(), jscicalc.DisplayLabel.update(), and jscicalc.ScrollableLabel.updateCaretVisibility().
boolean jscicalc.ScrollableLabel.newExpression [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] |
Reimplemented in jscicalc.DisplayLabel, and jscicalc.EntryLabel.
1.5.5