|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.gui2.DrawAtom | +--gishur.gui2.DrawObject
Extends the DrawAtom
by screen positions.
Fields inherited from class gishur.gui2.DrawAtom |
BLOCK_REPAINT, MARK_RECALC, MARK_REPAINT, MARK_SIZE, REPAINT, UNBLOCK_REPAINT, USER_STATES_FIRST, USER_STATES_MASK |
Constructor Summary | |
protected |
DrawObject(java.lang.String property_prefix)
Constructs a new DisplayObject which uses the given
prefix for all properties. |
Method Summary | |
protected void |
addDrawDependency(DrawObject drw)
Deprecated. |
protected void |
addPainter(Painter p)
Adds the given Painter at the end of the current
painter list. |
protected void |
blockRepaint()
Blocks all repaint() calls at this drawing hierachy.
|
boolean |
checkState(int state)
Checks if the given state is set. |
boolean |
checkStateCleared(int state)
Checks if the given state is cleared; that means every bit of the given state is cleared. |
protected DrawObject |
child()
Returns the first group element of the group. |
protected void |
clear()
Removes all member DrawObjects from this DrawAtom. |
void |
clearCache()
Clears the property-cache at this DrawObject and at all
members. |
void |
clearState(int state)
Clears a given state. |
protected DrawDependency |
dependency()
Returns the DrawDependency of this DrawObject . |
boolean |
dirty()
Returns true, if the object is currently marked as dirty. |
protected void |
disableEvents(int events_to_disable)
Disables the events defined by the specified event mask parameter from being delivered to this DrawObject . |
protected void |
draw(java.awt.Graphics g,
RenderContext context)
Draws this DrawAtom to the given
Graphics g .
|
protected void |
draw(java.awt.Graphics g,
RenderContext context,
PropertyStatusReader properties)
Draws this DrawAtom to the given
Graphics .
|
protected void |
enableEvents(int events_to_enable)
Enables the events defined by the specified event mask parameter to be delivered to this DrawObject .
|
protected void |
ensureRecalculate(RenderContext context)
This method could be used, to ensure recalculation of the DrawObject . |
protected Painter |
findPainter(java.lang.String name)
Returns the first stored Painter with the given name. |
protected Painter |
firstPainter()
Returns the first Painter in the painter list. |
protected boolean |
fullscreen()
Returns true , if this DrawObject needs
the full screen as bounds. |
void |
hide()
Hides the DrawAtom ( ). |
void |
hide(boolean update)
Hides the DrawAtom ( ). |
protected void |
insert(DrawObject p,
DrawObject drw)
Inserts the DrawObject drw in the group
before p . |
byte |
levelMask()
Returns the level mask (a combination of levels, that are displayed by this DrawObject ). |
byte |
levelUsed()
Returns a level mask of levels, that are used by this DrawObject ). |
java.lang.String |
locate(int x,
int y)
Locates the point (x,y) . |
void |
makeDirty()
Marks this DrawAtom for repainting (and recalculating)
and starts the recalculation/repainting system immediately. |
void |
makeDirty(boolean update)
Marks this DrawAtom for repainting (and recalculating).
|
protected DrawObject |
next()
Returns the next DrawObject in the group or null
if it is the last group element. |
protected DrawObject |
next(DrawObject drw)
Returns the next DrawObject of the given DrawObject ,
if this is direct parent of the given DrawObject
or null if it is the last group element.
|
protected Painter |
nextPainter(Painter p)
Returns the next Painter of the given Painter
p in the painter list. |
protected DrawObject |
parent()
Returns the parent group of this DrawObject . |
protected void |
prepeareRenderContext(RenderContext context)
Prepeares the RenderContext before recalulation or drawing
via a call to recalculate(gishur.gui2.RenderContext, gishur.gui2.PropertyStatusReader) /draw(Graphics,RenderContext) . |
protected DrawObject |
prev()
Returns the previous DrawObject in the group or null
if it is the first group element. |
protected DrawObject |
prev(DrawObject drw)
Returns the previous DrawObject of the given DrawObject ,
if this is direct parent of the given DrawObject
or null if it is the first group element.
|
protected void |
processDrawEvent(DrawEvent e)
Processes DrawEvent s occuring on this
DrawObject .
|
protected void |
processEvent(java.awt.AWTEvent e)
Processes events delivered to this DrawObject .
|
PropertyStatusReader |
propertyReader()
The PropertyStatusReader that should be used for reading
properties. |
protected void |
recalculate(RenderContext context)
Forces the DrawAtom to recalculate its representation.
|
protected abstract void |
recalculate(RenderContext context,
PropertyStatusReader properties)
Forces the DrawObject to recalculate its representation.
|
protected void |
remove(DrawObject drw)
Removes the given DrawObject from this group. |
protected void |
removeDrawDependency(DrawObject drw)
Deprecated. |
void |
repaint()
Starts the recalculation/repainting system immediately. |
ScreenTransformation |
screenTransformation()
Returns the valid ScreenTransformation for this
DrawObject . |
protected boolean |
setFullscreen(boolean fullscreen)
Marks or clears this DrawObject as a fullscreen
DrawObject . |
protected boolean |
setPaintBeforeMembers(boolean paintbefore)
Defines the paint order of this DrawObject and its
members. |
protected void |
setScreenTransformation(ScreenTransformation transform)
Sets the screen transformation for this DrawObject .
|
void |
setState(int state)
Sets a given state. |
void |
show()
Shows the DrawAtom ( ). |
void |
show(boolean update)
Shows the DrawAtom ( ). |
int |
state()
Returns the complete state of this object. |
int |
state(int state)
Returns the state for the given state constant. |
protected void |
unblockRepaint()
Unblocks repaint() calls and repaints all dirty objects. |
protected void |
unblockRepaint(boolean recalc_all)
Unblocks repaint() calls and repaints all (dirty) objects. |
boolean |
visible()
Returns true, if the DrawAtom is visible. |
Methods inherited from class gishur.gui2.DrawAtom |
addProperties, collectHits, dispatchEvent, displayManager, drawComponent, getBounds, getLocalProperty, getProperty, getProperty, getRequiredProperty, preprocessEvent, processMessage, properties, removeProperty, sendEvent, sendMessage, setBounds, setPropertiesTo, setProperty, setProperty, setProperty, setProperty, toString, toString, toStringDetail, toTreeString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected DrawObject(java.lang.String property_prefix)
DisplayObject
which uses the given
prefix for all properties.property_prefix
- the prefix string used for all read
propertiesMethod Detail |
public PropertyStatusReader propertyReader()
PropertyStatusReader
that should be used for reading
properties.PropertyStatusReader
for reading properties.protected final Painter firstPainter()
Painter
in the painter list.Painter
in the painter list.protected final Painter nextPainter(Painter p)
Painter
of the given Painter
p
in the painter list.p
- the Painter
which successor will be returned.Painter
protected Painter findPainter(java.lang.String name)
Painter
with the given name.name
- the name to search forPainter
with the given nameprotected final void addPainter(Painter p)
Painter
at the end of the current
painter list.p
- the Painter
to addpublic byte levelMask()
DrawObject
).public byte levelUsed()
DrawObject
).protected abstract void recalculate(RenderContext context, PropertyStatusReader properties)
DrawObject
to recalculate its representation.
This method will only be called, if it became dirty via a call
to the makeDirty(boolean)
method or something has happened, that
causes all DrawAtoms
to recalculate their
representation.
This method should only be called by the render system.context
- the RenderContext
to useproperties
- the PropertyStatusReader
to use for
reading propertiesprotected void draw(java.awt.Graphics g, RenderContext context, PropertyStatusReader properties)
this
DrawAtom
to the given
Graphics
.
The default implementation of this method calls the Painter.draw(java.awt.Graphics, gishur.gui2.RenderContext, gishur.gui2.PropertyStatusReader, byte)
methods of the stored Painters
for all used levels.
This method should only be called by the render system.g
- Graphics for drawingcontext
- the RenderContext
to useproperties
- the PropertyStatusReader
to use forDrawException
- if invalid call to this methodprotected final void recalculate(RenderContext context)
DrawAtom
to recalculate its representation.
This method will only be called, if it became dirty via a call
to the makeDirty(boolean)
method or something has happened, that
causes all DrawAtoms
to recalculate their
representation.
This method should only be called by the render system.recalculate
in class DrawAtom
context
- the RenderContext
to useprotected void ensureRecalculate(RenderContext context)
DrawObject
. This may be useful, if another DrawObject
needs the representation of this
DrawObject
in order to be calculated correctly. To enable access to this
method from outside overwrite the method (by calling this implementation)
to put it to the same package.context
- must be a valid RenderContext
protected final void draw(java.awt.Graphics g, RenderContext context)
this
DrawAtom
to the given
Graphics
g
.
This method should only be called by the render system.draw
in class DrawAtom
g
- Graphics for drawingcontext
- the RenderContext
to useDrawException
- if invalid call to this methodprotected void prepeareRenderContext(RenderContext context)
RenderContext
before recalulation or drawing
via a call to recalculate(gishur.gui2.RenderContext, gishur.gui2.PropertyStatusReader)
/draw(Graphics,RenderContext)
.prepeareRenderContext
in class DrawAtom
context
- RenderContext
to prepearepublic java.lang.String locate(int x, int y)
(x,y)
. If the point lies outside
of the DrawAtom's bounds null
will be returned,
otherwise a String value will be returned that identifies
the part that hits the given point.
In this implementation, the name of the Painter
will
be returned, that hits the given point.locate
in class DrawAtom
x,y
- point to locatenull
for no hit, otherwise the name of the
element that hits the point.protected void setScreenTransformation(ScreenTransformation transform)
this
DrawObject
.
The transformation will be stored under the key "screen_transformation" in
this
DrawObjects
properties list.
To initialize the ScreenTransformation
correctly, use this method
instead of DrawAtom.setProperty(java.lang.String, java.lang.Object)
.transform
- the new ScreenTransformation
public ScreenTransformation screenTransformation()
ScreenTransformation
for this
DrawObject
. If no ScreenTransformation
is set, an exception
will be thrown.ScreenTransformation
for this
DrawObject
.{@link
- DrawException} if property value ("screen_transformation
"
was not set.protected void processEvent(java.awt.AWTEvent e)
DrawObject
.
By default this method calls the appropriate
process<event type>Event
method for the given class of event.
A DrawObject
generates DrawEvents according to the enabled
event mask (see enableEvents(int)
) - these generated
events are processed to this method.
The checking for enabled events will be done before the
call of this method.e
- the event.processDrawEvent(gishur.gui2.event.DrawEvent)
protected void processDrawEvent(DrawEvent e)
DrawEvent
s occuring on this
DrawObject
.
This implementation of processDrawEvent
delivers the event
to the appropriate listener methods for DrawEvents, if this
object implements some of them. So its enough to implement listeners and
enable events to process DrawEvents occured at this DrawObject
at the
appropriate listener methods.
The supported listeners are:
GeneralAWTEventListener
ConnectionListener
RecalcListener
DirtyListener
VisibilityListener
ActivationListener
SelectionListener
EnableListener
e
- DrawEvent
to processprotected final void enableEvents(int events_to_enable)
this
DrawObject
.
The parameter should be OR-combined event masks. If you
want to enable standard awt-events, use the maks defined
by GishurEvent
(starting with AWT_
) instead
of the event masks defined by AWTEvent
. Do not
use event id's as event masks - this will not work! All events
defined by the Gishur package have an event mask part and an id
part - so one should only use the mask part!
This method only needs to be invoked by subclasses of DrawObject
which desire to have the specified event types delivered to.
processEvent(java.awt.AWTEvent)
.events_to_enable
- the event mask defining the event types.protected final void disableEvents(int events_to_disable)
this
DrawObject
.events_to_disable
- the event mask defining the event types.protected DrawObject next(DrawObject drw)
DrawObject
of the given DrawObject
,
if this
is direct parent of the given DrawObject
or null
if it is the last group element.
This method 'jumps over' elements in the drawing hierachy, that are no
DrawObjects
.DrawObject
protected DrawObject next()
DrawObject
in the group or null
if it is the last group element. This method 'jumps over'
elements in the drawing hierachy, that are no DrawObjects
.DrawObject
protected DrawObject prev()
DrawObject
in the group or null
if it is the first group element. This method 'jumps over'
elements in the drawing hierachy, that are no DrawObjects
.DrawObject
protected DrawObject prev(DrawObject drw)
DrawObject
of the given DrawObject
,
if this
is direct parent of the given DrawObject
or null
if it is the first group element.
This method 'jumps over' elements in the drawing hierachy, that are no
DrawObjects
.DrawObject
protected DrawObject parent()
DrawObject
.protected DrawObject child()
DrawObjects
.protected void insert(DrawObject p, DrawObject drw)
DrawObject
drw
in the group
before p
. The inserted DrawObject
is unvisible by default.p
- group member to insert before or null
to add
at the end of the groupdrw
- DrawObject
to insertprotected void remove(DrawObject drw)
DrawObject
from this
group. If the specified
DrawObject
has members, all members were removed first. Insertion
of the DrawObject
inserts only the DrawObject
- without
its members.drw
- DrawObject
to removeprotected void clear()
DrawObjects
from this
DrawAtom.protected DrawDependency dependency()
DrawDependency
of this
DrawObject
.DrawDependency
of this
DrawObject
.protected boolean fullscreen()
true
, if this
DrawObject
needs
the full screen as bounds.true
, if fullscreen DrawObject
protected boolean setFullscreen(boolean fullscreen)
this
DrawObject
as a fullscreen
DrawObject
.fullscreen
- if true
, object will use full screen
otherwise its bounds are fixedprotected boolean setPaintBeforeMembers(boolean paintbefore)
this
DrawObject
and its
members.paintbefore
- if true
: this
DrawObject
will be painted before its members.protected void addDrawDependency(DrawObject drw)
this
DrawObject
as draw-dependend by the
given DrawObject
.drw
- the DrawObject
, from which this
dependsprotected void removeDrawDependency(DrawObject drw)
this
DrawObject
from
the given this
DrawObject
.drw
- the DrawObject
, from which this
dependspublic boolean dirty()
public final void makeDirty(boolean update)
this
DrawAtom
for repainting (and recalculating).
If update==true
, the recalculation/repainting system will be
started immediately.update
- if true
, recalculation/repainting system startspublic final void makeDirty()
this
DrawAtom
for repainting (and recalculating)
and starts the recalculation/repainting system immediately.recalc
- if true
, the DrawAtom
will be
recalculated, otherwise only repainted.public void clearCache()
this
DrawObject
and at all
members.public final void repaint()
protected void blockRepaint()
repaint()
calls at this drawing hierachy.
Make shure to call unblockRepaint(boolean)
, that will ensure,
that objects will be repainted. Blocking calls may be nested,
but every call of blockRepaint()
should be finished
by a call of unblockRepaint(boolean)
.protected void unblockRepaint(boolean recalc_all)
repaint()
calls and repaints all (dirty) objects.repaint_all
- if true
a full repaint will be done.protected void unblockRepaint()
repaint()
calls and repaints all dirty objects.public boolean visible()
public void hide(boolean update)
visible()
()==false
).public void hide()
visible()
()==false
).public void show(boolean update)
visible()
()==true
).public void show()
visible()
()==true
).public final boolean checkState(int state)
state
- state to verifypublic final boolean checkStateCleared(int state)
state
- state to verifypublic final int state()
this
object.public final int state(int state)
public final void setState(int state)
state
must only use bits of
DrawAtom.USER_STATES_MASK
, otherwise these bits will be ignored.state
- state to setpublic final void clearState(int state)
state
must only use bits of
DrawAtom.USER_STATES_MASK
, otherwise these bits will be ignored.state
- state to clear
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |