Package org.tn5250j
Class GuiGraphicBuffer
- java.lang.Object
-
- org.tn5250j.GuiGraphicBuffer
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.beans.PropertyChangeListener,java.util.EventListener,ScreenListener,ScreenOIAListener,SessionConfigListener
public class GuiGraphicBuffer extends java.lang.Object implements ScreenOIAListener, ScreenListener, java.beans.PropertyChangeListener, SessionConfigListener, java.awt.event.ActionListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classGuiGraphicBuffer.Data
-
Field Summary
Fields Modifier and Type Field Description protected java.awt.Rectangleclipperprotected intcolumnWidthprotected intcrossHairprotected booleanhotSpotsprotected introwHeight-
Fields inherited from interface org.tn5250j.event.ScreenOIAListener
OIA_CHANGED_BELL, OIA_CHANGED_CLEAR_SCREEN, OIA_CHANGED_CURSOR, OIA_CHANGED_INPUTINHIBITED, OIA_CHANGED_INSERT_MODE, OIA_CHANGED_KEYBOARD_LOCKED, OIA_CHANGED_KEYS_BUFFERED, OIA_CHANGED_MESSAGELIGHT, OIA_CHANGED_SCRIPT
-
-
Constructor Summary
Constructors Constructor Description GuiGraphicBuffer(Screen5250 screen, SessionPanel gui, SessionConfig config)
-
Method Summary
Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent actionevent)This is for blinking cursor but should be moved outvoiddrawChar(java.awt.Graphics2D g, int pos, int row, int col)voiddrawCursor(int row, int col)voiddrawImageBuffer(java.awt.Graphics2D gg2d)voiddrawImageBuffer(java.awt.Graphics2D gg2d, int x, int y, int width, int height)java.awt.Graphics2DdrawOIA()Draw the operator information areaprotected GuiGraphicBuffer.DatafillData(int startRow, int startCol, int endRow, int endCol)voidgetBoundingArea(java.awt.Rectangle bounds)Fills the passed Rectangle with the starting row and column and width and height of the selected area. 1 BASED so column 1 row one is returned 1,1 If there is no area bounded then the full screen area is returned.protected java.awt.ColorgetColor(char color, boolean background)protected java.awt.ColorgetColorProperty(java.lang.String prop)java.awt.geom.Rectangle2DgetCommandLineArea()java.awt.Graphics2DgetDrawingArea()Returns a pointer to the graphics area that we can draw onprotected floatgetFloatProperty(java.lang.String prop)intgetHeight()intgetHeight(java.awt.image.ImageObserver io)java.awt.image.BufferedImagegetImageBuffer(int width, int height)java.awt.geom.Rectangle2DgetInsertIndicatorArea()protected intgetIntProperty(java.lang.String prop)java.awt.geom.Rectangle2DgetKBIndicatorArea()java.awt.geom.Rectangle2DgetMessageArea()voidgetPointFromRowCol(int r, int c, java.awt.Point point)This will return the screen coordinates of a row and column.intgetPosFromView(int x, int y)java.awt.geom.Rectangle2DgetPositionArea()java.awt.DimensiongetPreferredSize()intgetRowColFromPoint(int x, int y)Return the row column based on the screen x,y position coordinates It will calculate a 0,0 based row and column based on the screen point coordinate.java.awt.geom.Rectangle2DgetScreenArea()java.awt.geom.Rectangle2DgetScriptIndicatorArea()java.awt.geom.Rectangle2DgetStatusArea()protected java.lang.StringgetStringProperty(java.lang.String prop)java.awt.geom.Rectangle2DgetTextArea()intgetWidth()intgetWidth(java.awt.image.ImageObserver io)java.awt.Graphics2DgetWritingArea(java.awt.Font font)Returns a pointer to the graphics area that we can write onbooleanisBlinkCursor()booleanisWithinScreenArea(int x, int y)protected voidloadColors()voidloadProps()java.awt.RectanglemodelToView(int row, int col)java.awt.RectanglemodelToView(int row, int col, java.awt.Rectangle r)voidonConfigChanged(SessionConfigEvent pce)Update the configuration settingsvoidonOIAChanged(ScreenOIA changedOIA, int change)voidonScreenChanged(int which, int sr, int sc, int er, int ec)voidonScreenSizeChanged(int rows, int cols)voidpropertyChange(java.beans.PropertyChangeEvent pce)voidresize(int width, int height)protected voidresizeScreenArea(int width, int height)Convinience method to resize the screen area such as when the parent frame is resized.protected voidsetProperty(java.lang.String key, java.lang.String val)voidsetUseAntialias(boolean antialiased)java.awt.PointtranslateEnd(java.awt.Point end)Translate the ending point of mouse movement to encompass a full characterjava.awt.PointtranslateStart(java.awt.Point start)Translate the starting point of mouse movement to encompass a full characterprotected voidupdateImage(int x, int y, int width, int height)protected voidupdateImage(java.awt.Rectangle r)
-
-
-
Constructor Detail
-
GuiGraphicBuffer
public GuiGraphicBuffer(Screen5250 screen, SessionPanel gui, SessionConfig config)
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent actionevent)
This is for blinking cursor but should be moved out- Specified by:
actionPerformedin interfacejava.awt.event.ActionListener
-
isBlinkCursor
public boolean isBlinkCursor()
-
resize
public void resize(int width, int height)
-
loadColors
protected final void loadColors()
-
loadProps
public void loadProps()
-
getStringProperty
protected final java.lang.String getStringProperty(java.lang.String prop)
-
getColorProperty
protected final java.awt.Color getColorProperty(java.lang.String prop)
-
getFloatProperty
protected final float getFloatProperty(java.lang.String prop)
-
getIntProperty
protected final int getIntProperty(java.lang.String prop)
-
setProperty
protected final void setProperty(java.lang.String key, java.lang.String val)
-
onConfigChanged
public void onConfigChanged(SessionConfigEvent pce)
Update the configuration settings- Specified by:
onConfigChangedin interfaceSessionConfigListener- Parameters:
pce- session configuration event
-
propertyChange
public void propertyChange(java.beans.PropertyChangeEvent pce)
- Specified by:
propertyChangein interfacejava.beans.PropertyChangeListener
-
getPosFromView
public int getPosFromView(int x, int y)
-
getRowColFromPoint
public int getRowColFromPoint(int x, int y)Return the row column based on the screen x,y position coordinates It will calculate a 0,0 based row and column based on the screen point coordinate.- Parameters:
x- screen x positiony- screen y position- Returns:
- screen array position based 0,0 so position row 1 col 3 would be 2
-
getPointFromRowCol
public void getPointFromRowCol(int r, int c, java.awt.Point point)This will return the screen coordinates of a row and column.- Parameters:
r- rowc- columnpoint- just a point
-
isWithinScreenArea
public boolean isWithinScreenArea(int x, int y)
-
translateStart
public java.awt.Point translateStart(java.awt.Point start)
Translate the starting point of mouse movement to encompass a full character- Parameters:
start- a point to start- Returns:
- Point translated point
-
translateEnd
public java.awt.Point translateEnd(java.awt.Point end)
Translate the ending point of mouse movement to encompass a full character- Parameters:
end- end point- Returns:
- Point translated point
-
getBoundingArea
public void getBoundingArea(java.awt.Rectangle bounds)
Fills the passed Rectangle with the starting row and column and width and height of the selected area. 1 BASED so column 1 row one is returned 1,1 If there is no area bounded then the full screen area is returned.- Parameters:
bounds- a rectangle
-
resizeScreenArea
protected final void resizeScreenArea(int width, int height)Convinience method to resize the screen area such as when the parent frame is resized.- Parameters:
width- width of the screenheight- height of the screen
-
getPreferredSize
public final java.awt.Dimension getPreferredSize()
-
getImageBuffer
public java.awt.image.BufferedImage getImageBuffer(int width, int height)
-
drawOIA
public java.awt.Graphics2D drawOIA()
Draw the operator information area- Returns:
- graphics object
-
drawCursor
public void drawCursor(int row, int col)
-
getDrawingArea
public java.awt.Graphics2D getDrawingArea()
Returns a pointer to the graphics area that we can draw on- Returns:
- a pointer
-
drawImageBuffer
public void drawImageBuffer(java.awt.Graphics2D gg2d, int x, int y, int width, int height)
-
updateImage
protected void updateImage(int x, int y, int width, int height)
-
updateImage
protected void updateImage(java.awt.Rectangle r)
-
drawImageBuffer
public void drawImageBuffer(java.awt.Graphics2D gg2d)
-
getWritingArea
public java.awt.Graphics2D getWritingArea(java.awt.Font font)
Returns a pointer to the graphics area that we can write on- Parameters:
font- a font to use- Returns:
- a pointer
-
setUseAntialias
public void setUseAntialias(boolean antialiased)
-
drawChar
public final void drawChar(java.awt.Graphics2D g, int pos, int row, int col)
-
onScreenSizeChanged
public void onScreenSizeChanged(int rows, int cols)- Specified by:
onScreenSizeChangedin interfaceScreenListener
-
onScreenChanged
public void onScreenChanged(int which, int sr, int sc, int er, int ec)- Specified by:
onScreenChangedin interfaceScreenListener
-
onOIAChanged
public void onOIAChanged(ScreenOIA changedOIA, int change)
- Specified by:
onOIAChangedin interfaceScreenOIAListener
-
getTextArea
public java.awt.geom.Rectangle2D getTextArea()
-
getScreenArea
public java.awt.geom.Rectangle2D getScreenArea()
-
getCommandLineArea
public java.awt.geom.Rectangle2D getCommandLineArea()
-
getStatusArea
public java.awt.geom.Rectangle2D getStatusArea()
-
getPositionArea
public java.awt.geom.Rectangle2D getPositionArea()
-
getMessageArea
public java.awt.geom.Rectangle2D getMessageArea()
-
getInsertIndicatorArea
public java.awt.geom.Rectangle2D getInsertIndicatorArea()
-
getKBIndicatorArea
public java.awt.geom.Rectangle2D getKBIndicatorArea()
-
getScriptIndicatorArea
public java.awt.geom.Rectangle2D getScriptIndicatorArea()
-
getWidth
public int getWidth()
-
getHeight
public int getHeight()
-
getWidth
public int getWidth(java.awt.image.ImageObserver io)
-
getHeight
public int getHeight(java.awt.image.ImageObserver io)
-
fillData
protected GuiGraphicBuffer.Data fillData(int startRow, int startCol, int endRow, int endCol)
-
modelToView
public final java.awt.Rectangle modelToView(int row, int col)
-
modelToView
public final java.awt.Rectangle modelToView(int row, int col, java.awt.Rectangle r)
-
getColor
protected java.awt.Color getColor(char color, boolean background)
-
-