fllogosm
 Main
 User's Guide
 Developer's Guide
 Admin's Guide
 FAQ
 License Info
 Feedback
 MaxBase

This page contains information about how to use and exploit the MaxBase bean.

Use of the MaxBase class with plain Jdk
import nrio.MaxBase;

Is required in your Java source file.

 What you can do with the MaxBase Bean 

  • First off, you can invoke some public MaxBase methods, read and write MaxBase properties in order to accomplish tasks such as having a query start automatically.
  • Another option is to replace MaxBase add & modify panels (the ones created with the VFD) so you can have a more strict control on the entered data, and their source. Usually, however, you should create your forms using VFD, the Visual Form Designer, and pass them to a MaxBase instance via the setCustomForm(String) method. 
  • A mechanism is provided to let your add & modify panels communicate with different MaxBase beans (say you want to retrieve a list of suppliers to present to the user when setting up the on sale items' add panel). 
     
  • Finally, you can add your own features to MaxBase in a way that works also with applets (no need for external INI files that would break the virtual sandbox).
    Class nrio.MaxBase


java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----nrio.MaxBase


 

public class MaxBaseextends Frame implements ActionListener, WindowListener, ComponentListener

MaxBase, beside being a Java application, can be used also as a JavaBean or as a plain Java class to be reused in your programs; by letting the developer call one of its nearly fourty methods, MaxBase allows for deep and high-level customization of its features: it is by no means closed to third party modifications!

You may want, as an example, to use it inside an applet in order to let web users browse a database with a rich and effective GUI, or you may use it locally in your programs as an editor for dbs, adding only some custom features like (again, an example) pre-defined forms, automatic generation and printing of invoices, etc. By using an LPInterface object you can link together several instances of MaxBase, each one working in its own thread (multithreading and synchronization of the objects is handled automatically by Java and MaxBase).

Since MaxBase discends from java.awt.Frame, it makes sense to add features to it, instead of incorporating it into other objects, therefore you tipically have one object of type LPInterface (it may or may not be visible) that spawns one or more MaxBase instances (each one most likely having a set of customized menus and features) handling message traffic from and to the forementioned MaxBase instances.

Several methods require an index type. Here are all the valid values for such methods:

ISAM00 = ISAM indexing, duplicate and null values are allowed.
ISAM11 = ISAM indexing, duplicate and null values are NOT allowed.
ISAM10 = ISAM indexing, duplicate values are NOT allowed, null values are.
ISAM01 = ISAM indexing, duplicate values are allowed, null values are NOT.
B+TREE00 = B+TREE indexing, duplicate and null values are allowed.
B+TREE11 = B+TREE indexing, duplicate and null values are NOT allowed.
B+TREE10 = B+TREE indexing, duplicate values are NOT allowed, null values are.
B+TREE01 = B+TREE indexing, duplicate values are allowed, null values are NOT.
NONE0 = No indexing, null values are allowed.
NONE1 = No indexing, null values are NOT allowed.

Other items that will be mentioned in this page are AMInterface, MBPluginFactory and LPInterface. In short, AMInterface is a custom add/modify/browse form that is not created with the Visual Form Designer (there may be times when you need something drastically different from a VFD form); LPInterface is an object that acts as a message dispatcher among several MaxBase instances; MBPluginFactory is an interface used when you need to add features to MaxBase.


APPLETMENUS
                Public constant that defines a precise subset of menus to be activated in MaxBase (the ones used when MaxBase is running inside a web browser).
BROWSEMENUS
                Public constant that defines a precise subset of menus to be activated in MaxBase (the ones used when MaxBase is running inside a web browser, minus the record adding/modifying/deleting features). o
FULLMENUS
                Public constant that activates all of the menu voices (same as MaxBase when used as an application outside of a web browser).
STATICDBMENUS
                Public constant that defines a precise subset of menus to be activated in MaxBase (same as FULLMENUS, minus the db login/logout and some other features).

MaxBase()
                Bare-bone constructor.
MaxBase(MBAParam, URL)
                Constructor, typically used when MaxBase is launched from an applet.
MaxBase(String, LPInterface, AMInterface)
                Constructor, typically used when MaxBase is launched from an application (not an applet).

addField(String, int, String, String)
                Adds a field to the currently loaded database.
addMenuItems(String[])
                Adds custom menu items to the MaxBase menus.
dbinfo()
                Gets information about the fields of the currently loaded database.
deleRec(String[], boolean)
                (Un)Deletes records from the database.
delField(String)
                Deletes a field from the currently loaded database.
deselectAll()
                Deselects all of the selected rows (only affects MaxBase in line view mode).
disableMenuItems(String[])
                Disables menu items.
disconnect()
                Logs out from the currently loaded database.
enableMenuItems(String[])
                Enables menu items.
externAddStore(String[][])
                Used by objects implementing AMInterface: adds a record to the currently loaded database.
externModiStore(String[][])
                Used by objects implementing AMInterface: modifies a record of the currently loaded database.
formView()
                Puts MaxBase in form view mode.
getActiveDB()
                Returns the currently loaded database.
getExternalAddModi()
                Returns (if present) the currently in use external add/modify/browse panel.
getLpParent()
                Returns the object implementing LPInterface and controlling this MaxBase instance.
getMBFilter()
                Returns the currently in use filter conditions.
getPluginFactory()
                Returns the currently in use Plugin Factory (object that adds custom features to a MaxBase instance).
isApplet()
                Gets information about MaxBase being used as an applet.
isLineViewMode()
                Gets information about MaxBase being set in line view mode (as opposed to form view mode).
isTipActive()
                Gets information about MaxBase tips being active.
lineView()
                Puts MaxBase in line view mode.
loadRecWithFilter(String, String, String, boolean, String)
                Gets a number of records from the currently loaded database.
modifyFieldIndex(String, String)
                Modifies a field indexing strategy on-the-fly for the currently loaded database.
modifyFieldLength(String, int)
                Modifies on-the-fly a field length for the currently loaded database.
modifyFieldName(String, String)
                Modifies on-the-fly a field name for the currently loaded database.
peekSelected()
                Returns the currently selected records (if any).
refreshView()
                Forces a query refresh.
selectAll()
                Selects all records (only works when MaxBase is in line view mode).
setActiveDB(String)
                Logs in to a database.
setCustomForm(String)
                Forces MaxBase to use a specific form (in form view, or for adding/modifying records).
setExternalAddModi(AMInterface)
                Sets the external add/modify panel.
setLpParent(LPInterface)
                Sets the controlling object (implementing LPInterface).
setMaxBaseFields(boolean[], int[], int[])
                Sets visual properties for all of the fields.
setMenuLevel(int)
                Sets the menus to a specific and predefined level (some features enabled, some other disabled).
setPluginFactory(MBPluginFactory)
                Sets the Plugin Factory (object implementing custom features).
setQuery(String, int)
                Sets both the new filter conditions and the field on which the database must be ordered on.
setTipActive(boolean)
                Enables or disables MaxBase tips.
shutDown()
                Closes all database activities.

 

FULLMENUS


 public static final int FULLMENUS

Public constant to be used with the setMenuLevel(int) method, enabling all menu items.

STATICDBMENUS


 public static final int STATICDBMENUS

Public constant to be used with the setMenuLevel(int) method, disabling the following menu items:
New
Login..
Logout
Delete this DB
DB structure
Database and file utilities
Form designer

APPLETMENUS


 public static final int APPLETMENUS

Public constant to be used with the setMenuLevel(int) method, disabling the following menu items:
New
Login..
Logout
Delete this DB
DB structure
Database and file utilities
Form designer
Add a plugin..
Remove plugins..
Save plugins information
Load form

BROWSEMENUS


 public static final int BROWSEMENUS

Public constant to be used with the setMenuLevel(int) method, disabling the following menu items:
New
Login..
Logout
Delete this DB
DB structure
Database and file utilities
Form designer
Add a plugin..
Remove plugins..
Save plugins information
Load form
Add
Modify
Delete
Pack DB

MaxBase


 public MaxBase()
 

Bare-bone constructor. After this method, MaxBase will not be shown and no database will be loaded.

MaxBase


 public MaxBase(String sDBName,
                LPInterface LP,
                AMInterface AM)
 

Constructor, typically used when MaxBase is launched from an application (not an applet).

 

Parameters:

sDBName is a string that represents a file or an URL (with the syntax mbase://host:port(password)).
LP is an object of type LPInterface.
AM is an object of type AMInterface.

MaxBase


 public MaxBase(MBAParam m,
                URL main_url)
 

Constructor, typically used when MaxBase is launched from an applet.
The main_url parameter tells MaxBase where to find icons for the images of the toolbar (you then need to create there a directory labeled nrio and unzip there the .gif files you find into the jar under the nrio directory).

addField


 public void addField(String rTName,
                      int rTLen,
                      String rTSel,
                      String alignment)
 

Adds a field to the currently loaded database.
Parameters:
rTName
is the name of the field.
rTLen is the length of the field.
rTSel is the index type for this field.
alignment is a string representing the alignment of this field in line view mode as it would be expressed in a Label (int), and can be one of Label.LEFT, Label.RIGHT, Label.CENTER. Basically, it is a string representing a number.

addMenuItems


 public void addMenuItems(String s[])
 

Adds custom menu items to the MaxBase menus. Each string must be composed of three parts:
The first is the menu on which to add this item (the string must be the same as the one shown on screen)
The second is a character, "|" (the pipe), that allows MaxBase to divide the menu from the item
The last one is the real menu item.

dbinfo


 public String[][] dbinfo()
 

Gets information about the fields of the currently loaded database. The array returned exactly mimics the one returned by the JRXDbase method.

deleRec


 public String deleRec(String sRecords[], boolean bDelete)
 

(Un)Deletes records from the database. The sRecords array must contain the database references, bDelete indicates whether we're deleting or undeleting items.

delField


 public void delField(String fieldName)
 

Deletes a field from the currently loaded database.

deselectAll


 public void deselectAll()
 

Deselects all of the selected rows (only affects MaxBase in line view mode).

disableMenuItems


 public void disableMenuItems(String s[])
 

Selectively disables menu items; the array is composed by strings that exactly mimic the ones shown on the menus.

disconnect


 public void disconnect()
 

Logs out from the currently loaded database.

enableMenuItems


 public void enableMenuItems(String s[])
 

Selectively enables menu items; the array is composed by strings that exactly mimic the ones shown on the menus.

externAddStore


 public void externAddStore(String sAddArr[][])
 

Used by objects implementing AMInterface: adds a record to the currently loaded database.

externModiStore


 public void externModiStore(String sModiArr[][])
 

Used by objects implementing AMInterface: modifies a record of the currently loaded database.

Note: the [0][0] position of the array must be set to one of the MBIOComponent data entry result values (OK, STAY, ABORT, OKSTAY).

formView


 public void formView()
 

Puts MaxBase in form view mode.

getActiveDB


 public String getActiveDB()
 

Returns the currently loaded database. If the return string ends in ".dat", the database is local, otherwise it's in the form mbase://host.

getExternalAddModi


 public AMInterface getExternalAddModi()
 

Returns (if present) the currently in use external add/modify/browse panel.

getLpParent


 public LPInterface getLpParent()
 

Returns the object implementing LPInterface and controlling this MaxBase instance.

getMBFilter


 public String getMBFilter()
 

Returns the currently in use filter conditions in one string.

getPluginFactory


 public MBPluginFactory getPluginFactory()
 

Returns the currently in use Plugin Factory (object that adds custom features to a MaxBase instance).

isApplet


 public boolean isApplet()
 

Gets information about MaxBase being used as an applet.

isLineViewMode


 public boolean isLineViewMode()
 

Gets information about MaxBase being set in line view mode (as opposed to form view mode).

isTipActive


 public boolean isTipActive()
 

Gets information about MaxBase tips being active.

lineView


 public void lineView()
 

Puts MaxBase in line view mode.

loadRecWithFilter


 public String[][] loadRecWithFilter(String sIdx,
                                     String sHowManyRec,
                                     String sStart,
                                     boolean bForward,
                                     String sFilt)
 

Gets a number of records from the currently loaded database.
Parameters:
sIdx
is the index on which to order the data set,
sHowManyRec indicates how many records to return (max.); you can specify "ALL".
sStart is the record from which to start loading records. Valid values can be numeric or you can use the "LAST" keyword -- which means "start from the last record in the archive".
sFilt is the filter to be used.

modifyFieldIndex


 public void modifyFieldIndex(String fieldName,
                              String newIndex)
 

Modifies a field indexing strategy on-the-fly for the currently loaded database.

modifyFieldLength


 public void modifyFieldLength(String fieldName,
                               int newLength)
 

Modifies on-the-fly a field length for the currently loaded database.

modifyFieldName


 public void modifyFieldName(String oldName,
                             String newName)
 

Modifies on-the-fly a field name for the currently loaded database.

peekSelected


 public String[][] peekSelected()
 

Returns the currently selected records (if any) with the same data array as the loadrecwithfilter method (and yes, this means that in the [0][1]-th element you have the total number of records returned).

refreshView


 public void refreshView()
 

Forces a query refresh.

selectAll


 public void selectAll()
 

Selects all records (only works when MaxBase is in line view mode).

setActiveDB


 public void setActiveDB(String dbName)
 

Logs in to a database, logging out from the current one (if a database is being accessed, of course).
Parameter:
dbName:
the path of the database (if a local db), or its URL (if the db is on the network).

setCustomForm


 public void setCustomForm(String s)
 

Forces MaxBase to use a specific form (in form view, or for adding/modifying records). The parameter string should be taken from a .mfr file (produced by the Visual Form Designer).

setExternalAddModi


 public void setExternalAddModi(AMInterface ami)
 

Sets the external add/modify panel.

setLpParent


 public void setLpParent(LPInterface lpi)
 

Sets the controlling object (implementing LPInterface).

setMaxBaseFields


 public void setMaxBaseFields(boolean bVisible[],
                              int iAlign[],
                              int iField[])
 

Sets visual properties for all of the fields.
ialign is a string array, where the array elements represent the alignment of the fields in line view mode as they would be expressed in a Label (int), and can be one of Label.LEFT, Label.RIGHT, Label.CENTER. Basically, they are strings representing numbers.

setMenuLevel


 public void setMenuLevel(int mtype)
 

Sets the menus to a specific and predefined level (some features enabled, some other disabled). The constant representing the menu levels are specified right here in the MaxBase object. After you have set a specific menu level, you can still enable/disable specific menu items.

setPluginFactory


 public void setPluginFactory(MBPluginFactory mbpf)
 

Sets the Plugin Factory (object implementing custom features).

setQuery


 public void setQuery(String query,
                      int orderby)
 

Sets both the new filter conditions and the field on which the database must be ordered on.

setTipActive


 public void setTipActive(boolean active)
 

Enables or disables MaxBase tips.

shutDown


 public void shutDown()
 

Closes all database activities.