isCOBOL Evolve : User Interface : Working With UI and Controls : Windows extension and customization through a hook class
Windows extension and customization through a hook class
The isCOBOL Framework allows you to customize windows layout through an hook class that is automatically invoked before and after the display of the window.
To specify the name of the class, use the iscobol.gui.window.hook * configuration property, e.g.
iscobol.gui.window.hook=MYWINHANDLER
The class may be written in Java or in object oriented COBOL and must implement the com.iscobol.rts.WindowCreateHandler interface that includes the two methods beforeWindowCreate and afterWindowCreate:
public interface com.iscobol.rts.WindowCreateHandler {
  public abstract void beforeWindowCreate(com.iscobol.gui.server.WindowAttributeHook) throws com.iscobol.rts.WindowCreateOverflowException;
  public abstract void afterWindowCreate(com.iscobol.gui.server.WindowAttributeHook) throws com.iscobol.rts.WindowCreateOverflowException;
}
The two methods beforeWindowCreate and afterWindowCreate receive an instance of WindowAttributeHook as parameter.
The WindowAttributeHook class has the following public methods:
java.lang.String
getProgName()
Returns the name of the program that displayed the window
void
setNoClose(java.lang.Boolean)
Apply or remove the No-Close style
java.lang.Boolean
getNoClose()
Returns if the the No-Close style is set
void
setUndecorate(java.lang.Boolean)
Apply or remove the Undecorated style
java.lang.Boolean
getUndecorate()
Returns if the the Undecorated style is set
void
setResizable(java.lang.Boolean)
Apply or remove the Resizable style
java.lang.Boolean
getResizable()
Returns if the the Resizable style is set
void
setLayoutManager(java.lang.String)
Specifies the name of the layout manager. Possible values are:
" "
"LM-RESIZE"
"LM-RESPONSIVE"
"LM-SCALE"
"LM-ZOOM"
java.lang.String
getLayoutManager()
Returns the name of the layout manager. Possible values are:
" "
"LM-RESIZE"
"LM-RESPONSIVE"
"LM-SCALE"
"LM-ZOOM"
void
setLines(java.lang.Float)
Specifies the value of the Lines property
java.lang.Float
getLines()
Returns the value of the Lines property
void
setLine(java.lang.Integer)
Specifies the value of the Line property
java.lang.Integer
getLine()
Returns the value of the Line property
void
setColumn(java.lang.Integer)
Specifies the value of the [ Col | Column | Pos | Position ] property
java.lang.Integer
getColumn()
Returns the value of the [ Col | Column | Pos | Position ] property
void
setScreenLine(java.lang.Integer)
Specifies the value of the Screen Line property
java.lang.Integer
getScreenLine()
Returns the value of the Screen Line property
void
setScreenColumn(java.lang.Integer)
java.lang.Integer
getScreenColumn()
void
setSize(java.lang.Float)
Specifies the value of the Size property
java.lang.Float
getSize()
Returns the value of the Size property
void
setCellHeight(java.lang.Integer)
Specifies the value of the Cell Height property
java.lang.Integer
getCellHeight()
Returns the value of the Cell Height property
void
setCellWidth(java.lang.Integer)
Specifies the value of the Cell Width property
java.lang.Integer
getCellWidth()
Returns the value of the Cell Width property
void
setTitle(java.lang.String)
Specifies the value of the Title property
java.lang.String
getTitle()
Returns the value of the Title property
void
setTitleBar(java.lang.Boolean)
Apply or remove the Title-Bar style
java.lang.Boolean
getTitleBar()
Returns if the the Title-Bar style is set
void
setModal(java.lang.Boolean)
Apply or remove the Modal style
java.lang.Boolean
getModal()
Returns if the the Modal style is set
void
setWithSystemMenu(java.lang.Boolean)
Apply or remove the System Menu style
java.lang.Boolean
getWithSystemMenu()
Returns if the the System Menu style is set
void
setMinSize(float)
Specifies the value of the Min-Size property
float
getMinSize()
Returns the value of the Min-Size property
void
setMaxSize(float)
Specifies the value of the Max-Size property
float
getMaxSize()
Returns the value of the Max-Size property
void
setMinLines(float)
Specifies the value of the Min-Lines property
float
getMinLines()
Returns the value of the Min-Lines property
void
setMaxLines(float)
Specifies the value of the Max-Lines property
float
getMaxLines()
Returns the value of the Max-Lines property
void
setColor(int)
Specifies the value of the Color property
int
getColor()
Returns the value of the Color property
void
setLabelOffset(int)
Reserved for future use
int
getLabelOffset()
Reserved for future use
void
setForeground(int)
Specifies the value of the Foreground-Color property
int
getForeground()
Returns the value of the Foreground-Color property
void
setBackground(int)
Specifies the value of the Background-Color property
int
getBackground()
Returns the value of the Background-Color property
void
setUserColors(java.lang.Boolean)
Apply or remove the User-Colors style
java.lang.Boolean
getUserColors()
Returns if the the User-Colors style is set
void
setUserGray(java.lang.Boolean)
Apply or remove the User-Gray style
java.lang.Boolean
getUserGray()
Returns if the the User-Gray style is set
void
setUserWhite(java.lang.Boolean)
Apply or remove the User-White style
java.lang.Boolean
getUserWhite()
Returns if the the User-White style is set
void
setIcon(com.iscobol.types.NumericVar)
Specifies the value of the Icon property
com.iscobol.rts.ICobolVar
getIcon()
Returns the value of the Icon property
void
setFont(com.iscobol.types.CobolVar)
Specifies the value of the Font property
com.iscobol.rts.ICobolVar
getFont()
Returns the value of the Font property
void
setControlFont(com.iscobol.types.CobolVar)
Specifies the value of the Control Font property
void
setPopupMenu(com.iscobol.types.CobolVar)
Specifies the value of the Pop-Up Menu property
com.iscobol.rts.ICobolVar
getPopupMenu()
Returns the value of the Pop-Up Menu property
java.lang.String
getType()
Returns the window type. Possible values are:
"DOCKABLE"
"DOCKING"
"FLOATING"
"INDEPENDENT"
"INITIAL"
"MDI-CHILD"
"MDI-PARENT"
"STANDARD"
void
setAction(int)
Specifies the value of the Action property
int
getAction()
Returns the value of the Action property
void
setVisible(java.lang.Boolean)
Specifies the value of the Visible property
java.lang.Boolean
getVisible()
Returns the value of the Visible property
void
setEnabled(java.lang.Boolean)
Specifies the value of the Enabled property
java.lang.Boolean
getEnabled()
Returns the value of the Enabled property
void
setGradientColor1(int)
Specifies the value of the Gradient-Color-1 property
int
getGradientColor1()
Returns the value of the Gradient-Color-1 property
void
setGradientColor2(int)
Specifies the value of the Gradient-Color-2 property
int
getGradientColor2()
Returns the value of the Gradient-Color-2 property
void
setGradientOrientation(int)
Specifies the value of the Gradient-Orientation property
int
getGradientOrientation()
Returns the value of the Gradient-Orientation property
void
setBackgroundBitmapHandle(com.iscobol.rts.ICobolVar)
Reserved for future use
void
getBackgroundBitmapHandle(com.iscobol.rts.ICobolVar)
Reserved for future use
void
setBackgroundBitmapScale(int)
Reserved for future use
int
getBackgroundBitmapScale()
Reserved for future use
void
setCustomData(java.lang.String)
Specifies the value of the Custom-Data property
java.lang.String
getCustomData()
Returns the value of the Custom-Data property
void
getHandle(com.iscobol.rts.ICobolVar)
Reserved for future use
Example
The following sample class identifies if the LM-RESIZE layout manager was used and replaces it with the LM-SCALE layout manager:
import com.iscobol.rts.WindowCreateHandler ;
import com.iscobol.rts.WindowCreateOverflowException;
import com.iscobol.gui.server.WindowAttributeHook;
 
public class ReplaceLM implements WindowCreateHandler {
  public void beforeWindowCreate(WindowAttributeHook wah) throws WindowCreateOverflowException {
      if (wah.getLayoutManager().equals("LM-RESIZE")) {
          wah.setLayoutManager("LM-SCALE");
      }      
  }
  public void afterWindowCreate(WindowAttributeHook wah) throws WindowCreateOverflowException {
      // nothing to do here      
  }
}
To enable the above window hook, set the following configuration entry:
iscobol.gui.window.hook=ReplaceLM