|
jET |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.plaf.ComponentUI | +--org.jet.sce.SceneryEditorUI | +--org.jet.sce.BasicSceneryEditorUI
This class defines basic behaviour for scenery editor.
Nested Class Summary | |
class |
BasicSceneryEditorUI.HighlighterHandler
Handles mouse events. |
class |
BasicSceneryEditorUI.KeyHandler
Key listener. |
class |
BasicSceneryEditorUI.PropertyChangeHandler
Property change listener listens component property changes. |
class |
BasicSceneryEditorUI.SceneryChangeHandler
Scenery listener. |
class |
BasicSceneryEditorUI.SelectionHandler
Scenery selection listener. |
class |
BasicSceneryEditorUI.ZoomInAction
Zooming in action. |
class |
BasicSceneryEditorUI.ZoomOutAction
Zooming out action. |
Field Summary | |
static int |
NORMAL_MODE
Normal mouse work mode. |
protected java.awt.Dimension |
preferredSize
Dimension. |
protected JSceneryEditor |
sce
Component. |
static java.lang.String |
UI_CLASS_ID
Class text represenataion. |
static int |
ZOOM_MODE
Zoom mouse work mode. |
Fields inherited from interface org.jet.sce.SceneryConstants |
PIXELS_PER_METER |
Constructor Summary | |
BasicSceneryEditorUI()
Default constructor. |
Method Summary | |
protected void |
completeUninstall()
Last stage of uninstalling process. |
protected BasicSceneryEditorUI.HighlighterHandler |
createHighlighterListener()
Creates object highlight listener. |
protected BasicSceneryEditorUI.KeyHandler |
createKeyListener()
Creates key listener to listen to key. |
protected BasicSceneryEditorUI.PropertyChangeHandler |
createPropertyChangeListener()
Creates property handler to handle property changes in the component. |
protected BasicSceneryEditorUI.SceneryChangeHandler |
createSceneryListener()
Creates scenery listener to handle changes in the scenery. |
protected BasicSceneryEditorUI.SelectionHandler |
createScenerySelectionListener()
Creates scenery selection listener. |
static javax.swing.plaf.ComponentUI |
createUI(javax.swing.JComponent c)
Creates component UI for the component. |
EditorKit |
getEditorKit(JSceneryEditor sc)
Gets an editor kit for component. |
java.awt.Dimension |
getMinimumSize(javax.swing.JComponent c)
Gets the minimum size of the scenery editor. |
int |
getMouseMode()
Returns mouse work mode. |
java.awt.Dimension |
getPreferredSize(javax.swing.JComponent c)
Gets a preferred size of component. |
java.awt.Color |
getSwitchColor()
Gets the switch color. |
java.awt.Color |
getTrackColor()
Gets the track color. |
java.awt.Color |
getTrackNamesColor()
Gets track names color. |
boolean |
getTrackNamesVisibility()
Gets track names visibility flag. |
protected void |
installCursors()
Installs zoom cursor. |
protected void |
installDefaults()
Installs defaults for the component (e.g. colors). |
protected void |
installImages()
Installs images. |
protected void |
installKeyboardActions()
Installs keyboard action for the scenery editor. |
protected void |
installListeners()
Installs listeners for the component. |
void |
installUI(javax.swing.JComponent c)
Installs defaults, listeners for component. |
java.awt.geom.Point2D |
modelToView(JSceneryEditor editor,
javax.vecmath.Point3d p)
Translates model coordinates to view coordinates for specfied scenery editor. |
void |
paint(java.awt.Graphics g,
javax.swing.JComponent c)
Paints a component c with graphic context g . |
protected void |
paintBackground(java.awt.Graphics g)
Paints background for component. |
protected void |
paintForeground(java.awt.Graphics g)
Draws tracks. |
protected void |
paintGrid(java.awt.Graphics g)
Paints a grid for scenery editor. |
protected void |
paintHandles(java.awt.Graphics2D g2)
Paints selection handlers if there is selection. |
protected void |
paintSelection(java.awt.Graphics2D g2)
Paints selection. |
protected void |
paintSwitches(java.awt.Graphics2D g2)
Paints switches. |
protected void |
paintTrackNames(java.awt.Graphics2D g2)
Paints track names. |
protected void |
paintTracks(java.awt.Graphics2D g2)
Paints tracks. |
protected void |
prepareToInstall()
First stage of component installation. |
java.awt.geom.Rectangle2D |
queryMinMax()
Returns rectangle that contains minimum X, maximum X, minimum Y, maximum Y values in model coordinates' layout, but the axes have view meaning. |
protected void |
setModel(Scenery s)
Sets the model for this scenery editor user interface. |
void |
setMouseMode(int mode)
Sets mouse work mode. |
protected void |
setSelectionModel(ScenerySelectionModel newSSM)
Resets the selection model. |
void |
setSwitchColor(java.awt.Color c)
Sets the switch color. |
void |
setTrackColor(java.awt.Color c)
Sets the track color. |
void |
setTrackNamesColor(java.awt.Color c)
Sets track names color. |
void |
setTrackNamesVisibility(boolean b)
Sets the visibility of track names. |
protected boolean |
shouldDraw(java.awt.Rectangle rect,
java.awt.Shape a)
Determines if the shape should be drawn in clipping rectangle. |
protected TextBox |
transformNamedTrack(Track t)
Computes text boxes for named tracks. |
protected java.awt.geom.CubicCurve2D[] |
transformSwitchToView(Switch sw)
Transforms switch to two cubic curves. |
protected java.awt.geom.CubicCurve2D |
transformTrackToView(Track track)
Transforms track to cubic curve. |
protected void |
uninstallKeyboardActions()
Uninstalls keyboard actions. |
protected void |
uninstallListeners()
Uninstalls listeners. |
void |
uninstallUI(javax.swing.JComponent c)
Uninstalls user interface for a component. |
protected void |
updateCachedDisplay()
Updates cached display, but it does not help much. |
protected void |
updateMinMaxInfo()
Updates when necessary min-max information. |
protected void |
updatePreferredSize()
Updates size for the component when data or scale changes. |
javax.vecmath.Point3d |
viewToModel(JSceneryEditor editor,
java.awt.geom.Point2D p)
Translates view coordinates (coordinates within GUI component) to model coordinates in three dimensonal space. |
Methods inherited from class javax.swing.plaf.ComponentUI |
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String UI_CLASS_ID
public static final int NORMAL_MODE
public static final int ZOOM_MODE
protected JSceneryEditor sce
protected java.awt.Dimension preferredSize
Constructor Detail |
public BasicSceneryEditorUI()
Method Detail |
public static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c)
c
- Component to create user interface object for.
BasicSceneryEditorUI
.public void installUI(javax.swing.JComponent c)
installUI
in class javax.swing.plaf.ComponentUI
c
- A component.protected void prepareToInstall()
protected void installDefaults()
protected void installCursors()
protected void installImages()
protected void installListeners()
protected BasicSceneryEditorUI.PropertyChangeHandler createPropertyChangeListener()
protected BasicSceneryEditorUI.SceneryChangeHandler createSceneryListener()
protected BasicSceneryEditorUI.HighlighterHandler createHighlighterListener()
protected BasicSceneryEditorUI.KeyHandler createKeyListener()
protected BasicSceneryEditorUI.SelectionHandler createScenerySelectionListener()
protected void installKeyboardActions()
public void uninstallUI(javax.swing.JComponent c)
uninstallUI
in class javax.swing.plaf.ComponentUI
c
- Component to uninstall (the same as in install).protected void completeUninstall()
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected void setModel(Scenery s)
s
- The new scenery.protected void setSelectionModel(ScenerySelectionModel newSSM)
public int getMouseMode()
NORMAL_MODE
,
ZOOM_MODE
public void setMouseMode(int mode)
mode
- Code of mouse mode.public void paint(java.awt.Graphics g, javax.swing.JComponent c)
c
with graphic context g
.
paint
in class javax.swing.plaf.ComponentUI
g
- Graphic context.c
- The component to paint.protected void paintBackground(java.awt.Graphics g)
paint
function.
g
- Graphic context.protected void paintGrid(java.awt.Graphics g)
g
- Graphic context.protected void paintForeground(java.awt.Graphics g)
protected void paintTracks(java.awt.Graphics2D g2)
protected void paintSwitches(java.awt.Graphics2D g2)
protected void paintTrackNames(java.awt.Graphics2D g2)
protected void paintSelection(java.awt.Graphics2D g2)
protected void paintHandles(java.awt.Graphics2D g2)
protected void updateCachedDisplay()
protected java.awt.geom.CubicCurve2D transformTrackToView(Track track)
track
- Original track from scenery.
protected java.awt.geom.CubicCurve2D[] transformSwitchToView(Switch sw)
sw
- Original switch from scenery.
protected TextBox transformNamedTrack(Track t)
t
- Named track.
protected boolean shouldDraw(java.awt.Rectangle rect, java.awt.Shape a)
public java.awt.Dimension getPreferredSize(javax.swing.JComponent c)
getPreferredSize
in class javax.swing.plaf.ComponentUI
c
- Component.
public java.awt.Dimension getMinimumSize(javax.swing.JComponent c)
Default is (1200, 1200).
getMinimumSize
in class javax.swing.plaf.ComponentUI
protected void updatePreferredSize()
protected void updateMinMaxInfo()
public EditorKit getEditorKit(JSceneryEditor sc)
getEditorKit
in class SceneryEditorUI
sc
- Scenery editor component.
EditorKit
public java.awt.geom.Point2D modelToView(JSceneryEditor editor, javax.vecmath.Point3d p)
modelToView
in class SceneryEditorUI
p
- Point in model coordinates.editor
- Scenery editor.
public javax.vecmath.Point3d viewToModel(JSceneryEditor editor, java.awt.geom.Point2D p)
viewToModel
in class SceneryEditorUI
editor
- Editor.p
- Point in view coordinates.
public java.awt.geom.Rectangle2D queryMinMax()
Returned rectangle bounds scenery.
X variable of rectangle means maximum X, y
variable means maximum Y. Width (negative value) of rectangle is
a distance, between maxmium X and minimum X, so x + width
equals minimum Y. Height (negative value) variable in rectangle
is a distance between the maximum Y and the minimum Y, so y +
height equals the minimum Y. You can easly obtain minimums and
maximums using getMinX()
,
getMaxX()
,
getMinY()
and getMaxY()
rectangle's methods.
public void setTrackColor(java.awt.Color c)
c
- New color of the track.public java.awt.Color getTrackColor()
public void setSwitchColor(java.awt.Color c)
c
- New color of the switch.public java.awt.Color getSwitchColor()
public void setTrackNamesColor(java.awt.Color c)
c
- The new color.public java.awt.Color getTrackNamesColor()
public void setTrackNamesVisibility(boolean b)
b
- If true
, track names will be visible.public boolean getTrackNamesVisibility()
True
, if track names are visible.
|
jET |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |