Public class HyperView
extends Applet
A HyperView extends Applet and this means it
can run in a web browser, or within a HyperFrame
All
Implemented Interfaces:
javax.accessibility.Accessible,
AnimationConstants,
BitDefs,
BufferHandler,
ConnectionConstants,
java.util.EventListener,
GetStringConstants,
HyperConstants,
java.awt.image.ImageObserver,
KeyboardConstants,
MenuConstants,
java.awt.MenuContainer,
java.awt.event.MouseListener,
java.awt.event.MouseMotionListener,
java.lang.Runnable,
java.io.Serializable,
SplineConstants,
TextConstants,
java.awt.event.WindowListener |
void |
addAbort()
Add an Abort.class
Button to the HyperView()
This works in conjunction with the
Dispatch() Object to control the current
run stack level.
Note:
An Abort() button only works
above
stack level 0.
|
void |
addCircle(Circle
c)
Adds a circle object to the display.
See "circle" for details.
|
boolean |
addConnect(Connect
tCon)
Add an impending external connection.
Note: #2
|
int |
addConsole(hyperConsole
hc)
Add a HyperConsole() to HyperView();
|
int |
addGadget(Gadget
tGad)
Add a Gadget() to the HyperView()
|
int |
addGadget(gadget
tGad, int tFlags)
Add a Gadget() to the HyperView() and
set some of its internal flags.
|
void |
addGadHead()
Add a Gadget() to the HyperView()
at the start of the Gadget() list.
|
void |
addGadTail()
Add a Gadget() to the HyperView()
at the tail of the HyperView
|
int |
addGob(gob
tGob)
Add a Gob() to the HyperView()
Note:
A Gob() is a "Graphics Object"
Which is the Java version of a "Bob"
which means "Blitter Object"
|
void |
addGobHead(gob
tmpGob)
Add a Gob to the head of the Gob list.
|
void |
addGobTail()
Add a Gob to the tail of the Gob() list.
|
void |
addLine(HyperLine
tmpLine)
Add a line to the HyperView.
|
void |
addStr(DBText
tStr)
Add a DBText String to the HyperView.
|
void |
addStr(DBText[]
tStr)
Add an array of DBText Strings to the
HyperView()
|
void |
addView(HyperView
tView)
Add another View to the HyperView()
Note:
Not yet completely implemented
HyerView already iconizes/scales.
Todo:
Add reference links for SubViews to share
HyperConnectionHandlers between multiple
HyperViews.
|
void
|
remView();
|
void |
allGobsOff()
Turn all Gobds off.
This essentially unsets the
GOB_ON_DISPLAY bit of Gob.gobFlags
|
void |
allGobsOn()
As previous but enables all gobs.
|
void |
anyKey()
This will
As Applet:
print to the Browser status bar
"Anykey to continue"
It will then wait for a keypress.
This is for debugging.
|
void |
backGroundENA()
Enable background image.
|
void |
bGPenSet(int
num)
set HyperView current background image.
|
void |
CLS()
Fill background with current background
Color(). Note if you are using a
background
image this does nothing.
todo: add image stamp if background image
is enabled.
|
void |
consoleGobsOff()
Turn Gobs on consoles off.
|
void |
consoleGobsOn()
Turn Gobs on consoles on.
|
void |
conZENA()
Turn Console ZBuffering on.
|
void |
curTime()
Get the current time and create
time_t / asctime() style time String
and set the HyperView.clock
reference to
it.
|
void |
DBVectorDraw(int
x, int y, int x2, int y2, int destx, int
desty, int destx2, int desty2)
This draws moving line
from
x/y,x2/y2
to
destx/desty,destx2/desty2
|
void |
delay(int
count)
HyperView() sychronized wait() for
count milliseconds. Use this instead
of Thread.sleep()
|
void |
destroy()
Applet standard destroy
|
void |
disableBackground()
Turn off the background image.
|
void |
disableTitlebar()
Turn the titlebar off.
|
void |
draw(int
tX, int tY)
Draw from current X/Y
to tX/tY. This will use the current
drawing pen.
|
void
void
|
drawModeSet(int
flag)
public setDrawPen(int tX,int tY)
There are 2 draw modes
(CJAM1 & !CJAM1) or in bitwise terms
CJAM1 and ~CJAM1.
CJAM 1 text has no background.
!CJAM 1 stamps a rectangle behind the
text in the current drawing color.
To draw text with no background rectangle
ie: Given the Text "Hello World!"
drawModeSet(CJAM1);
Renders.
drawModeSet(CJAM2);
|
void |
dumpObjectTree(java.lang.Object
obj)
Dump the passed classes inheritence
hierarchy.
|
void |
fGPenSet(int
num)
Set the forground drawing pen color to the
index num. This sets the index for
(Color)palette[HyperView.fGPen];
|
void |
fontSizeSet(int
size)
Set the current font size index.
Fonts and their sizes are preloaded
into
an indexable array.
Namely:
(oOnt)fonts[hyperView.curFont];
|
void |
gadgetToFront(gadget
rGad)
Force a gadget to the fron of all others.
|
void |
gadsAlignUpLeft(int
yOff)
Tile all Gadgets to the left starting
at yOff.
|
void |
gadsAndGobsOff()
Turn Gads and Gobs off.
Note: this is no longer relevent
Because allGObsOff() will do the same
thing
as Gadget now externs Gob();
|
void |
gadsAndGobsOn()
as previous.
|
void |
gadsOff()
Turn all Gadgets off
|
void |
gadsOn()
Turn all Gadgets on
|
java.lang.String |
getHome()
return the system propery user_home
|
java.awt.Frame |
getParentFrame()
get a Reference to the parent Frame()
that this Applet runs under.
|
RunInfo |
getRunInfo()
Return a reference to a RunInfo()
object.
|
java.lang.String |
getTextFlags(int
fl)
|
void |
gobToFront(gob
rGob)
move a Graphics Object to the head
of the z layer and thus in front of all
others.
|
void |
guru(java.lang.Exception
e,
int flag)
Invoke the guru.
Note:
This cannot normally be called. It is only
here to retain the stack
frame context.
insead you MUST instantiate a Guru Object
ie new Guru("Yikes!");
Otherwise various Display elements won't
be restored.
|
void |
guru(java.lang.Exception
e,
java.lang.String str)
as above.
|
void |
guru(java.lang.String
str)
|
void |
hyperDump()
Save ALL flag bits for the HyperView to
the file HyperView.dat
(This helps ALOT when debugging)
|
void |
hyperViewOut(java.lang.String
Data)
Thread safe.
Save the String to the file HyperView.dat
|
void |
hyperViewOut(java.lang.String
Data,
java.lang.Object lock)
Same as previous but sychronize
on "lock" instead. You would only use
this if you really wanted to
be notified.
|
void |
hyperViewOut(java.lang.String
Data,
java.io.OutputStream File)
As the last 2 but use this Outputstream,
|
boolean |
imageUpdate(java.awt.Image
img,
int infoFlags, int x, int y, int width,
int height)
This is internal.
The HyperView is
the image Obeserver. Most of the
cases
for the Observer are commented out because
they are unused. The HyperView
stamps
the image if it shows up or not.
As the Observer it has to do a
drawImage(()
anyway in order to invoke the call to
imageUpdate anyway. Thus there
is now advantage to doing
the extra logic because
we make the asumption the image will show
up anyway. As an
Applet the images
are stored in the jar anyway.
Thus, if the jar showed up, then we
know we have the image. If we
are runnig as an application, we
know the image is saved locally.
This scheme only fails under 2 situations.
1- You forgot to pack the image in the
jar.
2- You deleted the image from your
hard
disk.
Thus the onus is on the
application
developer to make sure all images
are where they should be.
|
void |
init()
Applet init() this is called by the
browser or HyperFrame(). Otherwise
it should NEVER be called.
|
void |
inKey()
THis is internal and should NEVER be
called.
It gets all keys from the keyboard
handler.
It either echos them to standard out.
(As application)
or to the Browser status bar A.K.A.
getAppletContext().showStatus(""+tmpChar);
|
java.lang.String |
kickStart()
Restart everything.
(currently not Thread safe)
|
void |
killGads()
Remove and get rid of all Gadgets
|
void |
killGetS()
kill All GetString Objects.
|
void |
Lazarus()
In the event of total death, one could
try this call and maybe resurrect
the HyperView() enough to save debug
data.
|
void |
lineWait()
Wait for all Vectored lines to
reach their destination(s) then return.
|
void |
loadRGB(int[][]
vals, int num)
load a new RGB array for drawing pens
|
long |
LRand(long
Range)
return a random long from 0 to Range
|
void |
LSrand(long
Seed)
Set random seed to Seed.
|
boolean |
main()
Main() is the method that MUST be
overwritten in ViewMain()
ViewMain() is the users hook into
the HyperView() all
applications MUST
have a ViewMain() which overwrites
main() or you get an error message.
|
void |
makeBitMap(gadget
tGad)
Make the Gadget tGad bitmap.
|
|
These have no user purpose.
They are standard MouseListener Events
for the Frame/Container. Their
only purpose is to hand the event to
the HyperMouse() mouse
handler.
|
void |
mouseClicked(java.awt.event.MouseEvent
e) |
void |
mouseDragged(java.awt.event.MouseEvent
e) |
void |
mouseEntered(java.awt.event.MouseEvent
e) |
void |
mouseExited(java.awt.event.MouseEvent
e) |
void |
mouseMoved(java.awt.event.MouseEvent
e) |
void |
mousePressed(java.awt.event.MouseEvent
e) |
void |
mouseReleased(java.awt.event.MouseEvent
e) |
|
|
void |
paint(java.awt.Graphics
g)
This method is merely to allow you to
use the HyperView like a component.
Hoever, this is not optimal use.
It calls the (Thread)HyperView.run()
method with its flags set to draw only
once and return.
Note: THis is currently commecnted
out.
Instead use runView()
|
void |
pixelWrite(int
x, int y)
Set a pixel at X/Y
Note:
See writePixel()
This is the lightweight version.
|
void |
playSound(java.lang.String
Name)
Play the sound. (AudioClip)
ie:
HyperView.playSound("mySound.au");
|
int |
rand(int
Range)
return random number from 0 to range.
|
void |
refreshGadList()
Re compute the index # of all gadgets
according to its position in the
HyperView render list.
(You don't want to do this very often
if ever)
|
void |
refreshGobList()
As above but for Gobs instead of gadgets.
|
void |
remGad(gadget
tG)
Remove this gadget (tG)
|
int |
remGob(gob
rGob)
Remove this Gogb (rGob)
|
void |
resetTotals()
Reset all counters to 0.
No real user use.
|
void |
restoreGobClip()
This is only used when a Gob is being
removed.
You can use it but it will be inefficient.
It restores the Gob's background
rectangle.
|
void |
run()
As in Thread.run()
Called automatically.
|
|
NOTE:
These are critical
|
boolean |
runView()
|
boolean |
runView(DBText[]
dbt, int tMilliSecs) |
boolean |
runView(DBText
dbt, int tMilliSecs) |
boolean |
runView(int
tMilliSecs) |
int |
setBackImage(java.lang.String
Name)
set the background image.
ie:
setBackImage("myBackGround.gif");
|
void |
setLocation(int
tX, int tY)
set the current drawing X/Y
|
void |
setMenu(hyperMenu
tMenu)
Change the PopMenu to tMenu.
Hmm have not had a need to try this
yet :)
|
void |
setRGB(int[]
vals, int num)
Set the system RGB values for system
drawing colors to vals[] (RGB triplets)
|
void |
setTitlebar(Titlebar
tTitle)
Change the titlebar to tTitle.
|
void |
setWaitTime(int
num)
set the HyperView() preemption wait time.
This is used to set the default video
synch timeout preemption.
This is one of the "tricks" of
HyperView.
It always preempts itself according to
Tony's "EXEC CONSTANT" which says this.
Any Thread which has the potential to
race MUST preempt itself for at least
20 milliseconds per iteration.
This ELIMINATES the
possability
of a race.
|
void |
Srand(int
Seed)
Set the random see to Seed.
|
void |
stackTimerOff()
this is the smae as
HyperView.flags &= ~RUNSTACK_TIMER;
Not generally user usable and
Will probably have Either no effect
depending on the state of your
Dispatch() stack.
|
void |
start()
Thread.start();
No user application.
|
voiid |
statusText(java.lang.String
str)
Echo to either STDOUT as application,
or to the browser's status bar.
This is the AppletContext().statusText()
|
void |
statusText(java.lang.String
str,
java.lang.Object lock)
As above but synchs on the Object lock.
|
void |
stop()
Call this to can the HyperView()
NOTE:
Thread.stop() is deprecated.
This complies with the Sun Engineer's
implementation recommendation for
Thread.stop()
|
java.lang.String |
sysProperty(java.lang.String
property)
Return the Standard java System property.
|
void |
text(java.lang.String
str,
int tx, int ty)
Print the String at X/Y
|
void |
text3D(java.lang.String
str,
int x, int y)
Text with Edges for Pseudo 3d
text.
Note:
CJAM1 mode (Background rectangle.)
|
void |
text3DB(java.lang.String
str,
int x, int y)
iNote:
!CJAM1 mode (No background
rectangle.)
|
void |
textErase()
Reset the Text String count to 0
and cancel the HyperView display text bit.
This shuts text Off.
|
void |
textFlush()
Reset Text count. (But don't shut it off)
Note:
This could be used to to turn
off a block of text thus.
int realStringNumber =
totalStrings;
textFlush(); // Resets
count to 0.
//
Text vanishes.
// finally reset
the value.
totalStrings =
readStringNumber;
|
void |
titlebarENA(Titlebar
title)
Enable the titlbar.
|
void |
update(java.awt.Graphics
g)
Graphics observer method. No user
implementation.
|
void |
viewGobsOff()
Turn all GObs embedded on consoles
off.
|
void |
viewGobsOn()
As above but on.
|
void |
waitForImageBlt(java.awt.Graphics
destGraphics,
java.awt.Image sourceImage, int sourceX,
int sourceY, int
sourceX2, int sourceY2, int destX, int
destY, int destX2, int destY2)
Wait for the image to show
up.
Rending it 3 X a second to invoke the
Image
Observer()
It is advisable to ONLY use
this on
startup when you absolutely have to wait
for an image to show up. For example
the HyperView() uses this to gets is
system images such as the radio button
graphics or the scrollbar graphics.
This is MOSTLY a system method.
remember it blocks; this may not be
desired.
|
void |
wake()
synchronize on and notify() the
HyperView()
|
|
Window Listener
Methods
These are used by the HyperFrame()
in application mode. A user can
overwrite them in ViewMain(), but
SHOULD call the respective super()
method.
|
void |
windowActivated(java.awt.event.WindowEvent
e) |
void |
windowClosed(java.awt.event.WindowEvent
e) |
void |
windowClosing(java.awt.event.WindowEvent
e) |
void |
windowDeactivated(java.awt.event.WindowEvent
e) |
void |
windowDeiconified(java.awt.event.WindowEvent
e) |
void |
windowIconified(java.awt.event.WindowEvent
e) |
void |
windowOpened(java.awt.event.WindowEvent
e) |
|
|
void |
writePixel(int
putX, int putY)
Note:
This has issues because it encapsulates
a pixel with an entire Gadget()
It is the same as:
new
Pixel((HyperView)this,X,Y);
This allows you to add Splines and
mouse events to a single pixel,
but for most applications is like
hitting an ant with a sledghammer.
A "lightweight" rendered
version
or pixel has been added as the default
pixel Object.
SEE pixelWrite()
|
void |
zENA()
Enable ZBuffer ie: Z space
|
void |
zOff()
Disable ZBUffer ie: Z Space.
|
Fields inherited
from interface HyperConstants.
These are
all bit definitions. |
BIT1, BIT2, BIT3,
BIT4, BIT5, BIT6, BIT7,
BIT8, BIT9, BIT10, BIT11, BIT12, BIT13,
BIT14, BIT15,
BIT16, BIT17, BIT18, BIT19, BIT20,
BIT21, BIT22, BIT23, BIT24, BIT25,
BIT26, BIT27, BIT28,
BIT29, BIT30, BIT31, BIT32
ABORT_ENA,
ANIMATE_GOB,
ASYNCH_KEY_ENA,
BACKGROUND_ENA,
BACKGROUND_LOADING,
BACKGROUND_USED,
BEGUN,
CLOCK_ON,
COLLISION_START,
COMPLETED,
CON_FLIP_ASCEND,
CON_FLIP_XOR,
CON_FLIPBACK,
CON_FLIPLOOP,
CON_RANDFLIP,
CONFIRMED,
CONNECT_ENA,
CONNECTED,
CONNECTING,
CONSOLE_ENA,
DEBUG_ENA,
DENIED,
DISPATCH_ENA,
DISPATCH_GADGET,
DISPATCH_RETURN,
DISPATCH_SOCK_ENA,
DISPLAY_ENA,
DL_ON,
ENABLE, FIRST_LINE,
GAD_DISPATCH_ENA,
GAD_DRAW_CURSOR,
GAD_IS_CONSOLE,
GAD_IS_MENU,
GAD_IS_TITLEBAR,
GAD_ITEM_SELECTED,
GAD_KEY_RELEASE_ENA,
GAD_KEY_TYPED_ENA,
GAD_KEYBOARD_ENA,
GAD_LAYER_ENA,
GAD_LOCK_ON,
GAD_MOUSEOVER_ENA,
GAD_NOCLICK,
GAD_NOGRAB,
GAD_OUTLINE_ENA,
GAD_TEXT_ENA,
GAD_USE_SELECT,
GADGET_BITMAPPED,
GADGET_TOGGLE,
GADGETCOMP,
GADGETFLASH,
GADGETON,
GADGETSELECT,
GADGETSTRING,
GEM_REFRESH,
GOB_ANIM_ENA,
GOB_ANIMATED,
GOB_BLT_ENA,
GOB_BOUNCE,
GOB_BOUNCED,
GOB_BOUNDED,
GOB_CLICK_METHOD,
GOB_COLLIDED,
GOB_COLLISION_MASK_ON,
GOB_COLLISION_ON,
GOB_DISPATCH_ENA,
GOB_DO_ONCLICK,
GOB_ENA,
GOB_GRABBED,
GOB_HAS_GRAVITY,
GOB_HAS_ZBUFFER,
GOB_INFO_ENA,
GOB_IS_GADGET,
GOB_IS_LINE,
GOB_IS_ORBITING,
GOB_IS_TEXT,
GOB_ISLOADED,
GOB_LOADING,
GOB_MOVING,
GOB_MULTICON,
GOB_NO_SELECT,
GOB_NO_TIDY,
GOB_ON_CONSOLE,
GOB_ON_DISPLAY,
GOB_ORBIT,
GOB_SPLINE_ENA,
GOB_USE_SELECT,
GURU_ENA,
guruEnd,
guruStr,
HORIZONTAL_ENA,
HYPER_ISCHILD,
HYPER_ISROOT,
HYPER_VIDEO_SYNCHED,
HYPERVIEWVERSION,
IMAGE_LOADING,
INHERIT_ALL,
INHERIT_ANIMGOBS,
INHERIT_BACKGROUND,
INHERIT_CONBACKS,
INHERIT_CONSOLES,
INHERIT_GADGETS,
INHERIT_GETSTRINGS,
INHERIT_GOBS,
INHERIT_MENUS,
INHERIT_STRINGS,
INHERIT_TITLEBAR,
INIT_OVERRIDE,
IO_DO,
IO_QUICK,
IO_SEND,
IO_WAIT,
KEEP_RUNNING,
KEY_LISTENER_INSTALLED,
KEYBOARD_ENA,
KEYBOARD_EXCEPTION,
LINE_ENA,
LOCAL_ECHO,
MAX_BACKGROUNDS,
MAX_CONSOLES,
MAX_EXEC,
MAX_FONT_SIZE,
MAX_GADGETS,
MAX_GETSTRINGS,
MAX_GOBS,
MAX_KEY_MESSAGES,
MAX_MOUSE_MESSAGES,
MAX_STRINGS,
MEM_ON,
MENU_ACTIVE,
MENU_ENA,
MOUSE_EXCEPTION,
MOUSE_LISTENER_INSTALLED,
MOUSE_MOTION_LISTENER_INSTALLED,
OBSERVER_ECHO,
OUTLINE_ENA,
RECORD, REMOTE_ON,
RUN_ABORTED,
RUN_ABORTLINK,
RUN_EXCEPTION,
RUNSTACK_TIMER,
SCROLL_DOWN,
SCROLL_DOWNLEFT,
SCROLL_ENA,
SCROLL_LEFT,
SCROLL_NONE,
SCROLL_RIGHT,
SCROLL_RIGHTDOWN,
SCROLL_UP,
SCROLL_UPLEFT,
SCROLL_URIGHT,
SCROLLBAR_HORIZONTAL,
SCROLLBAR_MONO_CNTL,
SCROLLBAR_VERTICAL,
SecurityWarningString,
SKIP_RESTORE,
TEXT_ENA,
TITLEBAR_CLOCK,
TITLEBAR_CLOSE,
TITLEBAR_DRAWSTRING,
TITLEBAR_ENA,
TITLEBAR_MEMON,
VECTOR_LINE,
VERTICAL_ENA,
ZBUFFER_ENA |
|