datalator.user
Class User

java.lang.Object
  extended by datalator.user.User
Direct Known Subclasses:
AdminCode, OwnerCode, ToolBoxUser

public class User
extends java.lang.Object

datalator.user.User is a parent class and a programming interface for all Datalator applications extentions. Datalator programming model assumes creating Main.java as entry point for Applications and extending from 2 java source files:

datalator.user.UserApplet if you plan to distribute your Application as an Applet

and datalator.user.User where all business/custom logic defined(beyond default CRUD functionality).

Hello world Application

The best approach to create an Application of hello-world-type is to:

If you start your compiled Application like java -jar MyApp.jar you must see the Datalator client UI started. From now on the file MyApp.java has to be developed, Main.java and MyApplet.java are not supposed to be changed.

Programming Paradigm

The programming paradigm of Datalator library based on the next abstractions:

Data Containers

A Table Record represented by Java object datalator.sprav.SpravRecord; it contains public String[] content, each content[i] represents a field of that record. SpravRecord also contains public long recordId field as unique identifier in this table scope. SpravRecords are contained in public java.util.Vector records and could be "read" from it with java.util.Vector API. To change a SpravRecord content or to delete it one has to use convenience methods datalator.user.updateRecord(..., recordId) and datalator.user.deleteRecord(recordId). There is a comprehensive set of "getter" and "setter" methods to access SpravRecord content.

Layers

There are three SQL-table based layers:

There are 3 types of "service" layers to support SpravLayer and DocsLayer:

There are 3 more types of layers a programmer has to be aware about:

API Methods

There are two sets of methods provided by Datalator library:

For example, when we want to intercept "Enter-key pressed" event, when layer "Main Menu" is active and menu line "Exit" is active, we use the next snippet:


 public boolean preEnterLayer(Layer layer, SpravRecord spravRecord){          // callback
      if(layer.layerName.equals("Main Menu") && spravRecord.content[0].equals("Exit")){
          shutDown();                                                         // convenience method
          return false;                                                       // default event processing stopped
      }
      return true;                                                            // default event processing authorized
 }
 


Field Summary
static java.awt.Cursor defaultCursor
          Convenience object: ready to use default system cursor
static User user
          Reference to a class implementing logic; used by callback methods, set by setUserCode().
static java.awt.Cursor waitCursor
          Convenience object: ready to use "hair-glass" type of cursor
 
Constructor Summary
User()
           
 
Method Summary
static long addActiveSpravRecord(SpravLayer spravLayer)
          Synchronously inserts currently active SpravRecord into a SpravLayer content at the place defined by the active SpravRecord position.
static long appendDocsRecord(DocsLayer docsLayer, SpravRecord spravRecord, java.lang.String[] filters)
          Synchronously appends a SpravRecord to a DocsLayer table in the Database.
static long appendSpravRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Synchronously appends a SpravRecord to a SpravLayer table in the Database.
static void clearRecordLocks(SpravLayer spravLayer, int activeRecord)
          Clears locally SpravRecord locks: "under editing" and "record used to open another layer in hierarchy".
static void clearRecordLocks(SpravLayer spravLayer, SpravRecord spravRecord)
          Clears locally SpravRecord locks: "under editing" and "record used to open another layer in hierarchy".
static void commitLongTransaction()
          Commits a "long transaction" for the current client session.
static boolean connect(int port, int feedbackPort, java.lang.String serverURL, java.lang.String appName, java.lang.String id, java.lang.String pass, boolean flagRunFeedback, java.lang.String serverId)
          Connects a client to an Application on the specific server according given connection parameters.
 boolean contentChangedExternally(java.lang.String layerName)
          Callback method; invoked when a server notification received that content of the some Layer has been changed by another user(session).
 void contentChangedInternally(java.lang.String layerName)
          Callback method; invoked when a server notification received that content of the some Layer has been changed by the current user(session).
 void contentLoaded(Layer layer)
          Callback method; invoked after loading of SpravLayer(DocsLayer) content.
 void contentUpdatedAsynchronously(SpravLayer spravLayer)
          Callback method; invoked after receiving server notification "content changed" and after reloading that changed content.
static void copySameFieldsValues(SpravLayer sourceLayer, SpravRecord sourceRecord, SpravLayer targetLayer, SpravRecord targetRecord)
          Copies fields values from a record of one SpravLayer to a record of another SpravLayer with the same fields names.
static void createApplication(java.lang.String appName)
          Creates a new Database in the server Home directory, if issuing the request client connected with administrator credentials.
static SpravRecord createSpravRecord(SpravLayer spravLayer)
          Creates a new SpravRecord for a given SpravLayer according to the SpravLayer design.
static void deleteRecord(SpravLayer spravLayer, int activeRecord)
          Deletes a SpravRecord locally and from the Database, notifies all active sessions about the change.
static void deleteRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Deletes a SpravRecord locally and from the Database, notifies all active sessions about the change It also deletes all branches of hierarchies attached to that record; e.g.
static byte[] downloadFile(java.lang.String fileName, java.lang.String empty1, java.lang.String empty2, java.lang.String stagingFolder, javax.swing.JProgressBar progressBar, javax.swing.JLabel sizeLabel)
          Downloads small files(should fit into RAM) from a specified directory on the server host.
static void enter(DocsLayer docsLayer)
          Reloads content of the DocsLayer, given the current values of the filter fields.
static void enter(SpravLayer spravLayer)
          Reloads content of the SpravLayer.
static DocsLayer enterInvisibleDocs(Layer parentLayer, java.lang.String newLayerName)
          Loads the DocsLayer definition without visualizing it, behind the scene, to access the content.
static MenuLayer enterInvisibleMenu(Layer parentLayer, java.lang.String newLayerName)
          Loads "invisible" MenuLayer along with it's records.
static SpravLayer enterInvisibleSprav(Layer parentLayer, java.lang.String newLayerName)
          Loads "invisible" SpravLayer along with it's content.
static void enterMenuLine(java.lang.String value)
          Imitates "activation" of a given "visible" MenuLayer line, containing "value" parameter.
static DocsLayer enterVisibleDocs(Layer parentLayer, java.lang.String newLayerName)
          Loads the DocsLayer definition and visualizes FilterLayer only, to be used to access the content.
static MenuLayer enterVisibleMenu(Layer parentLayer, java.lang.String newLayerName)
          Loads and visualizes the MenuLayer.
static SpravLayer enterVisibleSprav(Layer parentLayer, java.lang.String newLayerName)
          Loads and visualizes the SpravLayer and it's content.
static void escape(Layer layer)
          Unloads loaded-before layer, adjusts internal state of the Application and releases resources.
static java.lang.String formatPresentDate()
          Returns formatted present client computer date as yyyy-mm-dd.
static java.lang.String formatPresentTime()
          Returns formatted present client computer time as hh-mm-ss.
static Layer getActiveLayer()
          Returns the top layer in the layers Application stack
static SpravRecord getActiveRecord(SpravLayer spravLayer)
          Returns the "active" SpravRecord of requested (visible or invisible) layer.
static long getApplicationSize(java.lang.String appName)
          Returns the size of a given Application directory in the server home directory, if issuing the request client connected with administrator credentials.
static java.lang.String[] getBackgroundNames()
          Returns a set of available built-in backgrounds.
static javax.swing.JComponent getCustomComponentByName(java.lang.String name, Layer layer)
          Returns a reference to a layer UI component, defined when visually developing the layer.
static java.util.Vector<javax.swing.JComponent> getCustomComponents(Layer layer)
          Returns all layer UI components, defined when visually developing the layer.
static java.lang.String getField(SpravLayer spravLayer, SpravRecord spravRecord, java.lang.String fieldName)
          Returns content of a given field of a given record of a given loaded spravLayer.
static java.lang.String getFilterField(DocsLayer layer, java.lang.String fieldName)
          Returns content of a given filter field of a given loaded DocsLayer.
static java.util.Vector<FilterField> getFilterFields(DocsLayer docsLayer)
          Returns all filter fields of the loaded DocsLayer
static javax.swing.JButton getHtmlLayerModeButton(HtmlLayer htmlLayer)
          Returns HTML Layer built-in button, which switched "html" and "editable text" modes.
static javax.swing.JTextField getInputField(SpravLayer spravLayer, java.lang.String fieldName)
          Returns reference to InputField of loaded SpravLayer.
static java.util.Vector<InputField> getInputFields(SpravLayer spravLayer)
          Returns all InputFields of a given SpravLayer.
static SpravLayer getInputLayerOwner(InputLayer inputLayer)
          Returns SpravLayer, owner of the given InputLayer.
static int getInputMode(InputLayer inputLayer)
          Returns mode of InputLayer.
static Layer getLayerByName(java.lang.String layerName)
          Returns a reference to visible Layer, by given name
static int getLayerFloor(Layer layer)
          Returns the Layer's position in the visible Layers stack, starting with 1 at the very bottom.
static java.util.Vector<Layer> getLayers()
          Returns Vector of all visible Layers, with the top (active) Layer as the last Vector element.
static java.lang.String getLocalIP()
          Returns an IP of the computer running the client
static int getMainPanelHeight()
          Returns height of the visible area inside the client Application Window.
static int getMainPanelWidth()
          Returns width of the visible area inside the client Application Window.
static Layer getParentLayer(Layer layer)
          Returns the Layer from which the given Layer was activated
static int getRecordsNumber(SpravLayer spravLayer)
          Returns number of content records loaded by given SpravLayer.
static java.lang.String[] getServerRunTimeInfo()
          Returns the Server Runtime info, if issuing the request client connected with administrator credentials.
static javax.swing.JButton getTextLayerSaveButton(TextLayer textLayer)
          Returns TextLayer built-in button, which saves edited text.
static java.lang.String getTextLayerText(TextLayer textLayer)
          Returns content of the given TextLayer.
static java.awt.Container getTopContainer()
          Returns the Application Frame or Browser Frame, if requested from Applet.
static User getUser()
          Returns reference to the Object, containing user-defined logic.
static java.lang.String getUserGroup()
          Returns the name of the group, which was given by Application Owner for current credentials.
static java.lang.String getUserName()
          Returns the name of the user(session), which was used to connect to the server.
static java.lang.String getWebPageParameter()
          Returns a parameter for Applet, which defined on the starting web page as .
static void initApplet(javax.swing.JApplet applet, java.lang.String userBuild)
          Initiates an Applet, when starting an Application from HTML page.
static boolean isApplet()
          Returns true if the Application running as Java Applet, false if as Java Application.
static void logLine(java.lang.String logName, java.lang.String message)
          Prints(appends) a message into a file.
static void openInput(SpravLayer spravLayer)
          Opens up the InputLayer for a given SpravLayer.
 void postAddRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Callback method; invoked after a record addition is complete.
 void postDeleteRecord(SpravLayer spravLayer)
          Callback method; invoked after a record deletion is complete
 void postEnterLayer(Layer layer, SpravRecord spravRecord)
          Callback method; invoked after some layer is activated.
 void postEnterPressedInputLayer(SpravLayer spravLayer, InputField inputField, int editMode)
          Callback method; invoked after adding or replacing a SpravRecord when action activated by a human user from Input Form controls.
 void postEscapeLayer(Layer layer)
          Callback method; invoked after a layer removed from the layers stack and cleanup is complete.
 void postFocusGainedInputField(Layer layer, InputField inputField)
          Callback method; invoked when InputField of the given Layer gains input focus.
 void postImageWindowClicked(java.lang.String imageId)
          Callback method; invoked when Image Field is clicked
 void postInputFieldTypedIn(Layer layer)
          Callback method; invoked when user presses "enter" or "tab" key in any InputField, except the last one.
 void postLoadEntryLayer(java.lang.String appName, java.lang.String entryLayerName, java.lang.String userName, java.lang.String password)
          Callback method; invoked after Entry Layer(Main Menu) loaded and visualized
 void postMouseLeftClicked(SpravLayer spravLayer, java.awt.event.MouseEvent me)
          Callback method; invoked every time user left-clicks on the panel representing a Layer and after that click is processed.
 void postMouseRightClicked(SpravLayer spravLayer, java.awt.event.MouseEvent me)
          Callback method; invoked every time user right-clicks on the panel representing a Layer and after that click is processed.
 void postOpenFilterWindow(DocsLayer docsLayer)
          Callback method; invoked after a FilterWindow visualized for a given DocsLayer
 void postOpenInputWindow(SpravLayer spravLayer)
          Callback method; invoked after an InputWindow visualized for a given SpravLayer
 void postOpenServiceMenu(SpravLayer spravLayer, java.lang.String supportMenuName)
          Callback method; invoked after ServiceMenu has been visualized.
 void postPaintCustomComponent(java.awt.Graphics g, java.lang.String name, Layer layer, javax.swing.JComponent jc)
          Callback method; every visually designed UI component will call this method after they complete default painting.
 void postPaintLayer(java.awt.Graphics g, Layer layer)
          Callback methods; invoked after Layer completed default painting, allows alter it.
 void postPaintLayerWindow(java.awt.Graphics g, Layer layer, LayerWindow lw)
          Callback methods; invoked after every Layer's Window completes default painting, allows alter it.
 void postReloadContent(SpravLayer spravLayer)
          Callback method; invoked after SpravLayer's content has been externally altered and after reloaded.
 void postReplaceRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Callback method; invoked after SpravRecord of SpravLayer has been replaced.
 void postSettingSupport(SpravLayer spravLayer, SpravRecord sourceRecord, InputField inputField, javax.swing.JTextField targetTextField)
          Callback method; invoked after a given SpravLayer has been used as a drop-down list to set up value in the target JTextField.
 void postStartConnectionDialog()
          Callback method; invoked after connection dialog panel has been visualized.
 void postStartSupportLayer(java.lang.String layerName)
          Callback method; invoked after a SpravLayer with given name visualized to be used as a drop-down list.
 boolean preAddRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Callback method; invoked before a record addition is commenced.
 boolean preDeleteRecord(SpravLayer spravLayer)
          Callback method; invoked before a record deletion is complete
 boolean preEnterLayer(Layer layer)
          Callback method; invoked before entering (activation) procedure from the given layer commences.
 boolean preEnterLayer(Layer layer, SpravRecord spravRecord)
          Callback method; invoked before entering (activation) another layer from the given one.
 boolean preEnterPressedInputLayer(SpravLayer spravLayer, InputField inputField, int editMode)
          Callback method; invoked before adding or replacing a SpravRecord when action activated by a human user from Input Form controls.
 boolean preEscapeLayer(Layer layer)
          Callback method; invoked before a layer removed from the layers stack and cleanup commences.
 boolean preFocusGainedInputField(Layer layer, InputField inputField)
          Callback method; invoked when InputField of the given Layer is about to gain input focus.
 boolean preImageWindowClicked(java.lang.String imageId)
          Callback method; invoked when Image Field is clicked before click processing commences.
 boolean preInputFieldTypedIn(Layer layer)
          Callback method; invoked when user presses "enter" or "tab" key in any InputField, except the last one before processing commenced When the last(only) IntputField "enter" or "tab" keyed, preAddRecord() and postaddRecord() gets invoked.
 boolean preLoadEntryLayer(java.lang.String appName, java.lang.String entryLayerName, java.lang.String userName, java.lang.String password)
          Callback method; invoked before Entry Layer(Main Menu) loaded and visualized.
 boolean preMouseLeftClicked(SpravLayer spravLayer, java.awt.event.MouseEvent me)
          Callback method; invoked every time user left-clicks on the panel representing a Layer before that click is processed.
 boolean preMouseRightClicked(SpravLayer spravLayer, java.awt.event.MouseEvent me)
          Callback method; invoked every time user right-clicks on the panel representing a Layer before that click is processed.
 boolean preOpenFilterWindow(DocsLayer docsLayer)
          Callback method; invoked before a FilterWindow visualized for a given DocsLayer
 boolean preOpenInputWindow(SpravLayer spravLayer)
          Callback method; invoked before an InputWindow visualized for a given SpravLayer
 boolean preOpenServiceMenu(SpravLayer spravLayer, java.lang.String serviceMenuName)
          Callback method; invoked before ServiceMenu has been visualized.
 boolean prePaintLayerWindow(java.awt.Graphics g, Layer layer, LayerWindow lw)
          Callback methods; invoked before every Layer's Window commences default painting, allows alter default behavior.
 boolean preReloadContent(SpravLayer spravLayer)
          Callback method; invoked before reloading of SpravLayer's content, which has been externally altered.
 boolean preReplaceRecord(SpravLayer spravLayer, SpravRecord spravRecord)
          Callback method; invoked before SpravRecord of SpravLayer has been replaced.
 boolean preReportChangingLayer(Layer source, Layer dest, boolean enterFlag)
          Callback method; invoked before server notified about navigating from source to destination layer.
 boolean preSettingSupport(SpravLayer spravLayer, SpravRecord sourceRecord, InputField inputField, javax.swing.JTextField targetTextField)
          Callback method; invoked before a given SpravLayer is used as a drop-down list to set up value in the target JTextField.
 void preShowConnectionDialog(java.util.Properties comps)
          Callback method; invoked before Connection Dialog Panel visualized.
 boolean preStartConnectionDialog()
          Callback method; invoked before connection dialog panel has been visualized.
 boolean preStartSupportLayer(java.lang.String layerName)
          Callback method; invoked after a SpravLayer with given name visualized to be used as a drop-down list.
 boolean preSwitchInputMode(SpravLayer spravLayer, int inputMode)
          Callback method; invoked when InputForm requested to change an input mode.
 void recordLockStateChanged(java.lang.String layerName, long recordId, boolean locked)
          Callback method; invoked when server notifies that "edit"-lock status of specific SpravRecord, belonging to SpravLayer with given name has been changed.
static void reloadContent(SpravLayer spravLayer)
          Initiates asynchronous content updating for the given SpravLayer.
static void reloadContentAndWait(Layer spravLayer)
          Initiates and completes synchronous content updating for the given SpravLayer.
static void removeApplication(java.lang.String appName)
          Deletes the given Database in the server Home directory, if issuing the request client connected with administrator credentials.
static void removeFilterFieldSupport(SpravLayer spravLayer)
          Part of programming hierarchies of "supporting" drop-down lists, see "Programming FilterFields Support" for more information.
static void repaintAll()
          Requests repainting the whole UI, Java Swing might take some time before fulfilling the request.
static void repaintAll(int delay)
          Initiates repainting the whole UI after given delay.
static void replaceSpravRecordAndWait(SpravLayer spravLayer, SpravRecord spravRecord)
          Synchronously replaces given SpravRecord to a SpravLayer table in the Database.
static java.lang.String[] restartServer()
          Restarts the server, if issuing the request client connected with administrator credentials.
static void restoreKeyboardFocus()
          Restores an Application keyboard focus if focus was transferred to a custom UI control like in scenario: user hit the button "print" and that button owns a focus now - means UI does not receive user input any more.
static void rollbackLongTransaction()
          Rollbacks a "long transaction" for the current client session.
static java.lang.String[] saveTextContentAndWait(java.lang.String textLayerName, java.lang.String parentLayerName, long parentRecordId, java.lang.String text)
          Synchronously saves content of a TextLayer.
static java.lang.String[] saveTextLayerText(TextLayer textLayer)
          Synchronously saves content of "visible" TextLater.
static void setActiveMenuRecord(MenuLayer menuLayer, java.lang.String content)
          Sets the active record pointer(highlighted record background) of the MenuLayer to the record with the given content.
static void setActiveRecord(SpravLayer spravLayer, int recordNum)
          Sets the active record pointer(highlighted record background) of the SpravLayer to the record with the given position in Vector of records.
static void setActiveRecord(SpravLayer spravLayer, long recordId)
          Sets the active record pointer(highlighted record background) of the SpravLayer to the record with the given record Id.
static void setAuxFilterFieldText(FilterField filterField, java.lang.String text)
          Sets the content of auxiliary Filter Field when this Field operation is set to inclusive "><", like when looking for a specific time frame.
static boolean setBackground(java.awt.Image image)
          Sets a background image of the Application Frame.
static void setBackground(java.lang.String name)
          Sets one of built-in images as a background image of the Application Frame.
static void setDefaultCursor()
          Sets a default system cursor.
static void setField(SpravLayer spravLayer, SpravRecord spravRecord, java.lang.String fieldName, java.lang.String value)
          Sets value of a given field of a given record of a given loaded spravLayer.
static void setFilterField(DocsLayer docsLayer, java.lang.String fieldName, java.lang.String value)
          Sets value of a given filter field of a given loaded DocsLayer.
static void setFilterFieldOperation(FilterField filterField, int op)
          Sets the comparison operation to use with the FilterField.
static void setFilterFieldText(FilterField filterField, java.lang.String value)
          Sets value of the given FilterField.
static void setInputField(InputLayer inputLayer, java.lang.String fieldName, java.lang.String value)
          Sets value of the given SpravLayer and given InputField name when reference to InputLayer is available.
static void setInputField(SpravLayer spravLayer, java.lang.String fieldName, java.lang.String value)
          Sets value of the given SpravLayer and given InputField name when reference to SpravLayer is available.
static void setInputFieldText(InputField inputField, java.lang.String value)
          Sets value of the given InputField when reference to InputField is available.
static void setLayerMainWindowCaption(Layer layer, java.lang.String text, java.awt.Color frontColor, java.awt.Color backColor)
          Sets caption of the Layer's Main Window
static void setLocation(Layer layer, int newX, int newY)
          Sets the location of the given Layer
static void setShadowDefault(Layer layer)
          Sets default shadow size of the given Layer
static void setShadowExtended(Layer layer)
          Extends shadow of the given Layer to darken background and highlight the given Layer
static void setSize(Layer layer, int newWidth, int newHeight)
          Sets dimensions of the given Layer
static void setSupportMode(boolean flag)
          Part of programming hierarchies of "supporting" drop-down lists, see "Programming FilterFields Support" for more information.
static void setTextFieldColors(InputField inputField, java.awt.Color fore, java.awt.Color back)
          Sets visual attributes of the given InputField text field
static void setTextLayerButtonsVisible(TextLayer textLayer, boolean flag)
          Sets visibility of "save" and "mode" buttons of the TextLayer, thus granting or denying user ability to alter the content
static void setTextLayerText(TextLayer textLayer, java.lang.String text)
          Sets content of the given TextLayer
static void setUserCode()
          Initializes and sets a reference to a class containing Application business logic, in order to have callback methods working properly.
static void setWaitCursor()
          Sets hourglass type of cursor
static void showMessage(java.lang.String message)
          Requests to repaint the message in the Application Message Panel.
static void showMessageImmediately(java.lang.String message)
          Repaints the message in the Application Message Panel immediately
static void showRecordLockPeopleWorkingBelow(boolean flag)
          Allows or disallows to use an icon "people working below" when visualizing any SpravLayer content.
static void shutDown()
          Escapes all opened currently layers gracefully, notifies the server that session is over, closes connections and stops the client.
static java.lang.String[] shutDownServer()
          Notifies all connected clients "Shutting down Server...", closes database connection immediately and makes server System.exit(0).
static void startClientApplication(int x, int y, int width, int height, java.lang.String serverIp, java.lang.String appName, java.lang.String id, java.lang.String password, java.lang.String buildString)
          Starts the client application, the only method which has to be rewritten in the Main class of application.
static void startFilterSupportLayer(DocsLayer docsLayer, FilterField filterField)
          Visualizes "supporting" SpravLayer for the given FilterField of the given DocsLayer, as it a user left-click on that FilterField.
static void startInputSupportLayer(SpravLayer spravLayer, InputField inputField)
          Visualizes "supporting" SpravLayer for the given InputField of the given SpravLayer, as it a user left-click on that InputField.
static void startLongTransaction()
          Starts a "long transaction" for the current client session.
static java.lang.String[] startServer()
          Sets the server into normal processing mode after it has been stopped, if issuing the request client connected with administrator credentials.
static void stopDownload()
          Stops downloading process which has been activated by downloadFile(java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.swing.JProgressBar, javax.swing.JLabel) request.
static java.lang.String[] stopServer()
          Stops processing any requests(except from administrator session), if issuing the request client connected with administrator credentials.
static void switchInputMode(InputLayer inputLayer, int times)
          Switches mode of InputLayer given number of times.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

user

public static User user
Reference to a class implementing logic; used by callback methods, set by setUserCode().


waitCursor

public static java.awt.Cursor waitCursor
Convenience object: ready to use "hair-glass" type of cursor


defaultCursor

public static java.awt.Cursor defaultCursor
Convenience object: ready to use default system cursor

Constructor Detail

User

public User()
Method Detail

setUserCode

public static void setUserCode()
Initializes and sets a reference to a class containing Application business logic, in order to have callback methods working properly. To be used by extending class, like user = MyApp.setUserCode();


addActiveSpravRecord

public static long addActiveSpravRecord(SpravLayer spravLayer)
Synchronously inserts currently active SpravRecord into a SpravLayer content at the place defined by the active SpravRecord position.

Parameters:
spravLayer - reference to SpravLayer
Returns:
SpravRecord id, -1 if operation failed
See Also:
appendSpravRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

appendDocsRecord

public static long appendDocsRecord(DocsLayer docsLayer,
                                    SpravRecord spravRecord,
                                    java.lang.String[] filters)
Synchronously appends a SpravRecord to a DocsLayer table in the Database.

Parameters:
docsLayer - DocsLayer to append the SpravRecord to
spravRecord - SpravRecord to append to the DocsLayer
filters - the array of filter fields values, e.g. {"USD",..., "Sold"}. Set of filter fields defined when building a DocsLayer.
Returns:
the unique record identifier, -1 if error

appendSpravRecord

public static long appendSpravRecord(SpravLayer spravLayer,
                                     SpravRecord spravRecord)
Synchronously appends a SpravRecord to a SpravLayer table in the Database.

Parameters:
spravLayer - SpravLayer to append the SpravRecord to
spravRecord - SpravRecord to append to the SpravLayer
Returns:
the unique record identifier, -1 if operation failed
See Also:
addActiveSpravRecord(datalator.layers.sprav.SpravLayer)

clearRecordLocks

public static void clearRecordLocks(SpravLayer spravLayer,
                                    int activeRecord)
Clears locally SpravRecord locks: "under editing" and "record used to open another layer in hierarchy". After opening locks locally, it is necessary to replaceSpravRecordAndWait(SpravLayer layer, SpravRecord dataRecord) to open locks "globally" in the Database and notify all connected clients about the change

Parameters:
spravLayer - SpravLayer to clear locks for
activeRecord - number of SpravRecord to be "lock-cleared" as in SpravLayer Vector records

clearRecordLocks

public static void clearRecordLocks(SpravLayer spravLayer,
                                    SpravRecord spravRecord)
Clears locally SpravRecord locks: "under editing" and "record used to open another layer in hierarchy". After opening locks locally, it is necessary to replaceSpravRecordAndWait(SpravLayer layer, SpravRecord dataRecord) to open locks "globally" in the Database and notify all connected clients about the change

Parameters:
spravLayer - SpravLayer to clear locks for
spravRecord - SpravRecord to clear all locks for

commitLongTransaction

public static void commitLongTransaction()
Commits a "long transaction" for the current client session. Any request(like replaceSpravRecordAndWait(SpravLayer layer, SpravRecord dataRecord)) issued by a client usually translates into a series of SQL sentences on the server side. Thus every request has it's own "commit" or "rollback" statements in the sequence. When a developer programs a transaction, consisting of a few atomic requests(e.g. deletion of a few records), it is necessary to issue startLongTransaction() to commence the transaction, which suppresses "commits" of atomic requests. If a developer is not satisfied with the transaction execution, he or she has to issue rollbackLongTransaction() to return the Database to a state before that long transaction started.

See Also:
rollbackLongTransaction(), startLongTransaction()

connect

public static boolean connect(int port,
                              int feedbackPort,
                              java.lang.String serverURL,
                              java.lang.String appName,
                              java.lang.String id,
                              java.lang.String pass,
                              boolean flagRunFeedback,
                              java.lang.String serverId)
Connects a client to an Application on the specific server according given connection parameters. A client cannot be connected to two Applications at the same time.

Parameters:
port - a client socket port on which server waiting for connections (defined by the server administrator), works in open-request-respond-close mode
feedbackPort - a client socket port which a client waiting for a Database state changes notifications from. A way of clients synchronization. Works in open-wait-receive notification-wait mode(long pull). Clients checks the connection health every 5 seconds, when error detected, the client reestablishes the connection.
serverURL - a server name or IP, e.g. "microsoft.com" or "127.0.0.1"
appName - an Application name, e.g. "AdminApplication" or "MyApp" to connect to. One server can host a number of applications.
id - an id given by a server administrator, e.g. "guest" or "visitor"
pass - a password given by a server administrator
flagRunFeedback - if true, the client will maintain the feedback connection and will be synchronized
serverId - a String, unique for every licensed server installation. A developer should be given that number by a server administrator. If a developer does not know the serverId he is a hacker.
Returns:
true, if connection successful, false - if not and prints a message into System.out stream.
See Also:
shutDown()

contentChangedExternally

public boolean contentChangedExternally(java.lang.String layerName)
Callback method; invoked when a server notification received that content of the some Layer has been changed by another user(session). Used to allow to reload layer content if appropriate.

Parameters:
layerName - layer name, content of which has been changed by another user(session)
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
contentChangedInternally(java.lang.String), contentUpdatedAsynchronously(datalator.layers.sprav.SpravLayer)

contentChangedInternally

public void contentChangedInternally(java.lang.String layerName)
Callback method; invoked when a server notification received that content of the some Layer has been changed by the current user(session). Used to reload layer content if appropriate.

Parameters:
layerName - layer name, content of which has been changed by the current user(session)
See Also:
contentChangedExternally(java.lang.String), contentUpdatedAsynchronously(datalator.layers.sprav.SpravLayer)

contentLoaded

public void contentLoaded(Layer layer)
Callback method; invoked after loading of SpravLayer(DocsLayer) content. Called from SpravLayer constructor and when activator button of Filter of DocsLayer clicked, thus notifies about initial content loading, which after might be changed by other users.

Parameters:
layer - reference to the SpravLayer, which content just has been loaded
See Also:
contentUpdatedAsynchronously(datalator.layers.sprav.SpravLayer), contentChangedExternally(java.lang.String), contentChangedInternally(java.lang.String)

contentUpdatedAsynchronously

public void contentUpdatedAsynchronously(SpravLayer spravLayer)
Callback method; invoked after receiving server notification "content changed" and after reloading that changed content.

Parameters:
spravLayer - reference to SpravLayer, which content just been reloaded
See Also:
contentLoaded(datalator.layers.Layer)

copySameFieldsValues

public static void copySameFieldsValues(SpravLayer sourceLayer,
                                        SpravRecord sourceRecord,
                                        SpravLayer targetLayer,
                                        SpravRecord targetRecord)
Copies fields values from a record of one SpravLayer to a record of another SpravLayer with the same fields names.

Parameters:
sourceLayer - source SpravLayer
sourceRecord - source SpravRecord
targetLayer - target SpravLayer
targetRecord - target SpravRecord

createApplication

public static void createApplication(java.lang.String appName)
Creates a new Database in the server Home directory, if issuing the request client connected with administrator credentials. Administrator convenience method.

Parameters:
appName - a name of the new application to be created.
See Also:
removeApplication(java.lang.String)

createSpravRecord

public static SpravRecord createSpravRecord(SpravLayer spravLayer)
Creates a new SpravRecord for a given SpravLayer according to the SpravLayer design. Fields of the SpravRecord are to be populated by setField(SpravLayer spravLayer, SpravRecord sr, String fieldName, String value)

Parameters:
spravLayer - a SpravLayer to create a SpravRecord for
Returns:
object SpravRecord with all the fields to be populated according to the SpravLayer design

deleteRecord

public static void deleteRecord(SpravLayer spravLayer,
                                int activeRecord)
Deletes a SpravRecord locally and from the Database, notifies all active sessions about the change. It also deletes all branches of hierarchies attached to that record; e.g. if record "department A" has been deleted so will all records of stuff working in that "department A". Note, if "department A" has been used as a key for a DocsLayer like "sales", those records will not be deleted automatically.

Parameters:
spravLayer - A SpravLayer to delete a SpravRecord from
activeRecord - Position of the active SpravRecord to be deleted in the Vector records of the SpravLayer
See Also:
deleteRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

deleteRecord

public static void deleteRecord(SpravLayer spravLayer,
                                SpravRecord spravRecord)
Deletes a SpravRecord locally and from the Database, notifies all active sessions about the change It also deletes all branches of hierarchies attached to that record; e.g. if record "department A" has been deleted so will all records of stuff working in that "department A". Note, if "department A" has been used as a key for a DocsLayer like "sales", those records will not be deleted automatically.

Parameters:
spravLayer - A SpravLayer to delete a SpravRecord from
spravRecord - SpravRecord to be deleted from the Database
See Also:
deleteRecord(datalator.layers.sprav.SpravLayer, int)

downloadFile

public static byte[] downloadFile(java.lang.String fileName,
                                  java.lang.String empty1,
                                  java.lang.String empty2,
                                  java.lang.String stagingFolder,
                                  javax.swing.JProgressBar progressBar,
                                  javax.swing.JLabel sizeLabel)
Downloads small files(should fit into RAM) from a specified directory on the server host. To stop the downloading process use stopDownload().

Parameters:
fileName - name of the file to be downloaded from the server
empty1 - reserved for internal use, has to be ""
empty2 - reserved for internal use, has to be ""
stagingFolder - full directory name on the server host where to look for the requested file
progressBar - a javax.swing.JProgressBar to reflect downloading progress, might be null
sizeLabel - a lavax.swing.JLabel to show the size of encoded file to be downloaded, might be null
Returns:
array of bytes with the file content, ready to written on the local disk

enter

public static void enter(SpravLayer spravLayer)
Reloads content of the SpravLayer.

Parameters:
spravLayer - SpravLayer, which record are to be reloaded

enter

public static void enter(DocsLayer docsLayer)
Reloads content of the DocsLayer, given the current values of the filter fields.

Parameters:
docsLayer - a DocsLayer, which records are to be reloaded

enterInvisibleDocs

public static DocsLayer enterInvisibleDocs(Layer parentLayer,
                                           java.lang.String newLayerName)
Loads the DocsLayer definition without visualizing it, behind the scene, to access the content. Prepares the DocsLayer's filter fields to be programmatically populated with values and makes available method enter(datalator.layers.docs.DocsLayer) to use thus providing access to DocsLayers records. Unloading escape(datalator.layers.Layer) of the invisible Layer is not mandatory.

Parameters:
parentLayer - if not null, activation of the DocsLayer will be recorded for use in SaaS applications
newLayerName - name of the DocsLayer to load without visualization
Returns:
reference to the loaded "invisible" DocsLayer
See Also:
enterVisibleDocs(datalator.layers.Layer, java.lang.String), escape(datalator.layers.Layer)

enterInvisibleMenu

public static MenuLayer enterInvisibleMenu(Layer parentLayer,
                                           java.lang.String newLayerName)
Loads "invisible" MenuLayer along with it's records. Makes method (java.lang.String) available to use, such enabling invisible navigation into complex Layers structures. Unloading escape(datalator.layers.Layer) of the invisible Layer is not mandatory.

Parameters:
parentLayer - if not null, activation of the MenuLayer will be recorded for use in SaaS applications
newLayerName - name of the MenuLayer to load without visualization
Returns:
reference to the loaded "invisible" MenuLayer
See Also:
enterVisibleMenu(datalator.layers.Layer, java.lang.String), escape(datalator.layers.Layer)

enterInvisibleSprav

public static SpravLayer enterInvisibleSprav(Layer parentLayer,
                                             java.lang.String newLayerName)
Loads "invisible" SpravLayer along with it's content. Unloading escape(datalator.layers.Layer) of the invisible Layer is not mandatory.

SpravLayers are used normally to create hierarchies from SQL tables like: (counties)-(cities of counties)-(streets of cities). When records of (countries) are created, they use as a key the record of a parent menu, which activated (countries). Respectfully, (cities) use a particular (countries)-record as a key and (streets) use a particular (cities)-record as a key. That means, to receive from the database a streets list for a particular city of a specific country, a programmer has to code like that (we assume that all quoted names were defined when visually developing that Application):

 MenuLayer  menu      = enterInvisibleMenu(null,  menuName);     // all menu record contained in one table, null as a parent is valid here
                        setActiveMenuRecord(menu, "Countries");  // must be set, "Countries"-record used as a key for (countries)-table
 SpravLayer countries = enterInvisibleSprav(menu, "Countries");  // loads available countries list
 
 for(int i = 0; i < getRecordsNumber(countries); i++){
      SpravRecord country     = countries.records.elementAt(i);
      String      countryName = getField(country, "Country Name");
      if(countryName.equals("Canada")){
          country.activeRecord = i;
          break;
      }
 }
 SpravLayer cities    = enterInvisibleSprav(countries, "Cities"); // loads available cities list for "Canada"
 for(int i = 0; i < getRecordsNumber(cities); i++){
      SpravRecord city     = cities.records.elementAt(i);
      String      cityName = getField(city, "City Name");
      if(countryName.equals("Toronto")){
          city.activeRecord = i;
          break;
      }
 }
 SpravLayer streets    = enterInvisibleSprav(cities, "Streets");  // loads available streets for Toronto, Canada

 

Parameters:
parentLayer - if not null, activation of the MenuLayer will be recorded for use in SaaS applications. The parentLayer "activeRecord" used to index SpravLayer records when they created, must be the same to select content.
newLayerName - name of the SpravLayer to load without visualization
Returns:
reference to the loaded "invisible" SpravLayer and it's content

enterMenuLine

public static void enterMenuLine(java.lang.String value)
Imitates "activation" of a given "visible" MenuLayer line, containing "value" parameter. To work with "invisible" Menu, one has to employ two other methods: setActiveMenuRecord(datalator.layers.menu.MenuLayer, java.lang.String) and one of "enterInvisible..." or "enterVisible..." family methods, like in a snippet:

        MenuLayer menu = enterInvisibleMenu(null, "menu1");
                         setActiveMenuRecord(menu, "line 1");     // must be set, "line 1" used as a key
        DocsLayer docs = enterInvisibleDocs(menu, "docs1");
 

Parameters:
value - content of the line to "enter into" and activate an attached Layer or action.

enterVisibleDocs

public static DocsLayer enterVisibleDocs(Layer parentLayer,
                                         java.lang.String newLayerName)
Loads the DocsLayer definition and visualizes FilterLayer only, to be used to access the content. To "unload" visible DocsLayer one has to use escape(datalator.layers.Layer).

Parameters:
parentLayer - if not null, activation of the DocsLayer will be recorded for use in SaaS applications. Setting to null does not affect the DocsLayer content selection, which depends on values of filter fields only.
newLayerName - name of the DocsLayer to load
Returns:
reference to the loaded DocsLayer with visualized FilterLayer only and no content delivered from the server. To deliver content, one has to set key values of the FilterLayer and issue enter(datalator.layers.docs.DocsLayer).

enterVisibleMenu

public static MenuLayer enterVisibleMenu(Layer parentLayer,
                                         java.lang.String newLayerName)
Loads and visualizes the MenuLayer. To "unload" visible MenuLayer one has to use escape(datalator.layers.Layer).

Parameters:
parentLayer - if not null, activation of the MenuLayer will be recorded for use in SaaS applications.
newLayerName - name of the MenuLayer to load
Returns:
reference to the loaded MenuLayer

enterVisibleSprav

public static SpravLayer enterVisibleSprav(Layer parentLayer,
                                           java.lang.String newLayerName)
Loads and visualizes the SpravLayer and it's content. To "unload" visible SpravLayer use escape(datalator.layers.Layer).

Parameters:
parentLayer - must not be null to properly load the content. See explanation and a snippet for enterInvisibleSprav(datalator.layers.Layer, java.lang.String)
newLayerName - name of the SpravLayer to load
Returns:
reference to the loaded SpravLayer

escape

public static void escape(Layer layer)
Unloads loaded-before layer, adjusts internal state of the Application and releases resources. Mandatory and the only way to "leave" loaded-before visible layer. Optional for invisible layers - they do not affect internal state of the Application; resources will be released by Java GC.

Parameters:
layer - reference to a layer to be "escaped"

formatPresentDate

public static java.lang.String formatPresentDate()
Returns formatted present client computer date as yyyy-mm-dd.

Returns:
a Java String presenting the formatted date
See Also:
formatPresentTime()

formatPresentTime

public static java.lang.String formatPresentTime()
Returns formatted present client computer time as hh-mm-ss.

Returns:
a Java String presenting the formatted time
See Also:
formatPresentDate()

getActiveLayer

public static Layer getActiveLayer()
Returns the top layer in the layers Application stack

Returns:
top layer in the layers Application stack

getActiveRecord

public static SpravRecord getActiveRecord(SpravLayer spravLayer)
Returns the "active" SpravRecord of requested (visible or invisible) layer. Valid for all tables-based layers: SpravLayer, MenuLayer, DocsLayer

Parameters:
spravLayer - Sprav(Menu, Docs)Layer to find an active record into
Returns:
reference to the "active" SpravRecord

getApplicationSize

public static long getApplicationSize(java.lang.String appName)
Returns the size of a given Application directory in the server home directory, if issuing the request client connected with administrator credentials. Administrator convenience method.

Parameters:
appName - of an Application
Returns:
size of the Application folder is bytes

getBackgroundNames

public static java.lang.String[] getBackgroundNames()
Returns a set of available built-in backgrounds.

Returns:
names of available backgrounds
See Also:
setBackground(java.lang.String), setBackground(java.awt.Image)

getCustomComponentByName

public static javax.swing.JComponent getCustomComponentByName(java.lang.String name,
                                                              Layer layer)
Returns a reference to a layer UI component, defined when visually developing the layer. Used to add JButtons listeners, set JLabels texts and so on.

Parameters:
name - name given to a UI element when visually designing the layer
layer - the layer to look a UI element for
Returns:
reference to UI element if found
See Also:
getCustomComponents(datalator.layers.Layer)

getCustomComponents

public static java.util.Vector<javax.swing.JComponent> getCustomComponents(Layer layer)
Returns all layer UI components, defined when visually developing the layer. Used to add JButtons listeners, set JLabels texts and so on.

Parameters:
layer - the layer to look UI elements for
Returns:
all UI components defined for the layer
See Also:
getCustomComponentByName(java.lang.String, datalator.layers.Layer)

getField

public static java.lang.String getField(SpravLayer spravLayer,
                                        SpravRecord spravRecord,
                                        java.lang.String fieldName)
Returns content of a given field of a given record of a given loaded spravLayer. Content always returned as a Java String.

Parameters:
spravLayer - the SpravLayer to extract the field content from
spravRecord - the SpravLayer record to extract the field content from
fieldName - name of the field to extract content from
Returns:
field content
See Also:
setField(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, java.lang.String, java.lang.String)

getFilterField

public static java.lang.String getFilterField(DocsLayer layer,
                                              java.lang.String fieldName)
Returns content of a given filter field of a given loaded DocsLayer. Content always returned as a Java String.

Parameters:
layer - reference to the DocsLayer to extract the filter field content from
fieldName - name of the filter field to extract content from
Returns:
filter field content
See Also:
getField(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, java.lang.String), getFilterFields(datalator.layers.docs.DocsLayer)

getFilterFields

public static java.util.Vector<FilterField> getFilterFields(DocsLayer docsLayer)
Returns all filter fields of the loaded DocsLayer

Parameters:
docsLayer - reference to the docsLayer
Returns:
all filter fields

getHtmlLayerModeButton

public static javax.swing.JButton getHtmlLayerModeButton(HtmlLayer htmlLayer)
Returns HTML Layer built-in button, which switched "html" and "editable text" modes. Usually used to setVisible(false) and such to disable unauthorized content change.

Parameters:
htmlLayer - reference to HTML Layer
Returns:
reference to "mode" button
See Also:
getTextLayerSaveButton(datalator.layers.text.TextLayer), getTextLayerText(datalator.layers.text.TextLayer), setTextLayerText(datalator.layers.text.TextLayer, java.lang.String)

getInputField

public static javax.swing.JTextField getInputField(SpravLayer spravLayer,
                                                   java.lang.String fieldName)
Returns reference to InputField of loaded SpravLayer. InputField consists of JTextField, JLabel and JButton, belongs to InputForm and services manual user input. Usually used to modify default UI behavior.

Parameters:
spravLayer - reference to the SpravLayer
fieldName - name of the InputField, consistent with the name of respectful JLabel or JButton
Returns:
reference to InputField
See Also:
getInputFields(datalator.layers.sprav.SpravLayer), setInputField(datalator.layers.InputLayer, java.lang.String, java.lang.String), setInputField(datalator.layers.sprav.SpravLayer, java.lang.String, java.lang.String)

getInputFields

public static java.util.Vector<InputField> getInputFields(SpravLayer spravLayer)
Returns all InputFields of a given SpravLayer.

Parameters:
spravLayer - reference to the SpravLayer
Returns:
all InputFields
See Also:
getInputField(datalator.layers.sprav.SpravLayer, java.lang.String), setInputField(datalator.layers.InputLayer, java.lang.String, java.lang.String), setInputField(datalator.layers.sprav.SpravLayer, java.lang.String, java.lang.String)

getInputLayerOwner

public static SpravLayer getInputLayerOwner(InputLayer inputLayer)
Returns SpravLayer, owner of the given InputLayer.

Parameters:
inputLayer - reference to InputLayer
Returns:
SpravLayer
See Also:
openInput(datalator.layers.sprav.SpravLayer)

getInputMode

public static int getInputMode(InputLayer inputLayer)
Returns mode of InputLayer. There are 5 possible modes:

 0 - input
 1 - browse
 2 - search "starting with substring"
 3 - search "containing substring"
 4 - edit
 

Parameters:
inputLayer - reference to InputLayer
Returns:
input mode
See Also:
preSwitchInputMode(datalator.layers.sprav.SpravLayer, int), switchInputMode(datalator.layers.InputLayer, int)

getLayerByName

public static Layer getLayerByName(java.lang.String layerName)
Returns a reference to visible Layer, by given name

Parameters:
layerName - Name of the Layer to be found
Returns:
reference to a Layer, null if not found
See Also:
getLayers(), getLayerFloor(datalator.layers.Layer), getParentLayer(datalator.layers.Layer)

getLayerFloor

public static int getLayerFloor(Layer layer)
Returns the Layer's position in the visible Layers stack, starting with 1 at the very bottom.

Parameters:
layer - reference to the Layer
Returns:
the Layer's "floor" - a position in the visible Layers stack, starting with 1. -1 if Layer is null.
See Also:
getLayers(), getLayerByName(java.lang.String), getParentLayer(datalator.layers.Layer)

getLayers

public static java.util.Vector<Layer> getLayers()
Returns Vector of all visible Layers, with the top (active) Layer as the last Vector element.

Returns:
Vector of all visible Layers
See Also:
getLayerByName(java.lang.String), getLayerFloor(datalator.layers.Layer), getParentLayer(datalator.layers.Layer)

getLocalIP

public static java.lang.String getLocalIP()
Returns an IP of the computer running the client

Returns:
an IP of the computer running the client

getMainPanelHeight

public static int getMainPanelHeight()
Returns height of the visible area inside the client Application Window.

Returns:
height of the visible area inside the client Application Window.

getMainPanelWidth

public static int getMainPanelWidth()
Returns width of the visible area inside the client Application Window.

Returns:
width of the visible area inside the client Application Window.

getParentLayer

public static Layer getParentLayer(Layer layer)
Returns the Layer from which the given Layer was activated

Parameters:
layer - Layer which parent is to be found
Returns:
Layer from which the given Layer was activated
See Also:
getLayers(), getLayerByName(java.lang.String), getLayerFloor(datalator.layers.Layer), getParentLayer(datalator.layers.Layer)

getRecordsNumber

public static int getRecordsNumber(SpravLayer spravLayer)
Returns number of content records loaded by given SpravLayer. Note that number of loaded records less or equal to the number of records contained in the SQL table for a SpravLayer.

Parameters:
spravLayer - reference to the SpravLayer
Returns:
number of the SpravLayer loaded records

getServerRunTimeInfo

public static java.lang.String[] getServerRunTimeInfo()
Returns the Server Runtime info, if issuing the request client connected with administrator credentials. Administrator convenience method.

Returns:
array of Strings with information on current Server state(memory, queues, etc.)

getTextLayerSaveButton

public static javax.swing.JButton getTextLayerSaveButton(TextLayer textLayer)
Returns TextLayer built-in button, which saves edited text. Usually used to setVisible(false) and such to disable unauthorized content change.

Parameters:
textLayer - reference to TextLayer
Returns:
reference to "save" button
See Also:
getHtmlLayerModeButton(datalator.layers.text.HtmlLayer), getTextLayerText(datalator.layers.text.TextLayer), setTextLayerText(datalator.layers.text.TextLayer, java.lang.String)

getTextLayerText

public static java.lang.String getTextLayerText(TextLayer textLayer)
Returns content of the given TextLayer.

Parameters:
textLayer - reference to the TextLayer
Returns:
TextLayer content.
See Also:
getHtmlLayerModeButton(datalator.layers.text.HtmlLayer), getTextLayerSaveButton(datalator.layers.text.TextLayer), setTextLayerText(datalator.layers.text.TextLayer, java.lang.String)

getTopContainer

public static java.awt.Container getTopContainer()
Returns the Application Frame or Browser Frame, if requested from Applet.

Returns:
the Application Frame or Browser Frame, if requested from Applet.

getUser

public static User getUser()
Returns reference to the Object, containing user-defined logic. Used by Datalator internally to dispatch callback from other packages

Returns:
reference to User object

getUserGroup

public static java.lang.String getUserGroup()
Returns the name of the group, which was given by Application Owner for current credentials. Might be "guest" or "developer", used to control access rights.

Returns:
name of the user group, which current session belongs to.
See Also:
getUserName()

getUserName

public static java.lang.String getUserName()
Returns the name of the user(session), which was used to connect to the server.

Returns:
the name of the user.
See Also:
getUserGroup()

getWebPageParameter

public static java.lang.String getWebPageParameter()
Returns a parameter for Applet, which defined on the starting web page as .

Returns:
we page defined parameter.

initApplet

public static void initApplet(javax.swing.JApplet applet,
                              java.lang.String userBuild)
Initiates an Applet, when starting an Application from HTML page.

Parameters:
applet - reference to the JApplet like in code snippet:

 
        public class MyApplet extends UserApplet{
            public void init() {
                try{
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // recommended for UI consistency
                    SwingUtilities.updateComponentTreeUI(this);
                }
                catch(Exception e){}
                MyApplet.setUserCode();
                MyApplet.initApplet(this, "MyApplet  build 08-10-2011");
            }
        }
 
 

userBuild - String which will be displayed on the Applet background, just above build string of the core buildString

isApplet

public static boolean isApplet()
Returns true if the Application running as Java Applet, false if as Java Application.

Returns:
true if the Application running as Java Applet, false if as Java Application.

openInput

public static void openInput(SpravLayer spravLayer)
Opens up the InputLayer for a given SpravLayer. Used in scenarios when human user supposed to make a record in the invisible SpravLayer (means user not given the access to all records), when InputLayer represents a form to be filled in by a human

Parameters:
spravLayer - reference to a SpravLayer

logLine

public static void logLine(java.lang.String logName,
                           java.lang.String message)
Prints(appends) a message into a file.

Parameters:
logName - file name
message - message

postAddRecord

public void postAddRecord(SpravLayer spravLayer,
                          SpravRecord spravRecord)
Callback method; invoked after a record addition is complete. The record is added to the end of the table.

Parameters:
spravLayer - SpravLayer which a record has been just added to
See Also:
postDeleteRecord(datalator.layers.sprav.SpravLayer), preAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preDeleteRecord(datalator.layers.sprav.SpravLayer)

postDeleteRecord

public void postDeleteRecord(SpravLayer spravLayer)
Callback method; invoked after a record deletion is complete

Parameters:
spravLayer - SpravLayer which a record has been just deleted from
See Also:
postAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preDeleteRecord(datalator.layers.sprav.SpravLayer)

postEnterLayer

public void postEnterLayer(Layer layer,
                           SpravRecord spravRecord)
Callback method; invoked after some layer is activated. Note that only a parent layer reference is passed, to get a reference to a newly activated layer one has to use getActiveLayer().

Parameters:
layer - the "parent" layer, which activated another one
spravRecord - a SpravRecord, which has been double-clicked on, activated by enter key or programmatically by enter(datalator.layers.sprav.SpravLayer) or enter... methods family.
See Also:
preEnterLayer(datalator.layers.Layer), preEnterLayer(datalator.layers.Layer, datalator.layers.sprav.SpravRecord), preEnterPressedInputLayer(datalator.layers.sprav.SpravLayer, datalator.layers.InputField, int)

postEnterPressedInputLayer

public void postEnterPressedInputLayer(SpravLayer spravLayer,
                                       InputField inputField,
                                       int editMode)
Callback method; invoked after adding or replacing a SpravRecord when action activated by a human user from Input Form controls.

Parameters:
spravLayer - reference to the SpravLayer, which content has been just altered
inputField - is an owner of the TextField, which detected enter key pressed
editMode - 0 when a SpravRecord has been added, 4 when a SpravRecord has been replaced
See Also:
preEnterPressedInputLayer(datalator.layers.sprav.SpravLayer, datalator.layers.InputField, int)

postEscapeLayer

public void postEscapeLayer(Layer layer)
Callback method; invoked after a layer removed from the layers stack and cleanup is complete.

Parameters:
layer - the layer which has been just "escaped"
See Also:
preEscapeLayer(datalator.layers.Layer)

postFocusGainedInputField

public void postFocusGainedInputField(Layer layer,
                                      InputField inputField)
Callback method; invoked when InputField of the given Layer gains input focus.

Parameters:
layer - owner of the InputField
inputField - InputField gained input focus
See Also:
postFocusGainedInputField(datalator.layers.Layer, datalator.layers.InputField)

postImageWindowClicked

public void postImageWindowClicked(java.lang.String imageId)
Callback method; invoked when Image Field is clicked

Parameters:
imageId - image id, consisting from the layer name, SpravRecord id and Image Field name.
See Also:
preImageWindowClicked(String imageId)

postInputFieldTypedIn

public void postInputFieldTypedIn(Layer layer)
Callback method; invoked when user presses "enter" or "tab" key in any InputField, except the last one. When the last(only) IntputField "enter" or "tab" keyed, preAddRecord() and postaddRecord() gets invoked.

Parameters:
layer - reference to the active layer
See Also:
preInputFieldTypedIn(datalator.layers.Layer), preAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), postAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

postLoadEntryLayer

public void postLoadEntryLayer(java.lang.String appName,
                               java.lang.String entryLayerName,
                               java.lang.String userName,
                               java.lang.String password)
Callback method; invoked after Entry Layer(Main Menu) loaded and visualized

Parameters:
appName - name of application a used connected to
entryLayerName - name of the entry layer name
userName - id, which user have connected with
password - password, which user have connected with
See Also:
preLoadEntryLayer(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

postMouseLeftClicked

public void postMouseLeftClicked(SpravLayer spravLayer,
                                 java.awt.event.MouseEvent me)
Callback method; invoked every time user left-clicks on the panel representing a Layer and after that click is processed.

Parameters:
spravLayer - reference to the Layer, which UI was left-clicked on
me - reference to the MouseEvent, which was detected on the Layer UI
See Also:
preMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), preMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), postMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent)

postMouseRightClicked

public void postMouseRightClicked(SpravLayer spravLayer,
                                  java.awt.event.MouseEvent me)
Callback method; invoked every time user right-clicks on the panel representing a Layer and after that click is processed.

Parameters:
spravLayer - reference to the Layer, which UI was right-clicked on
me - reference to the MouseEvent, which was detected on the Layer UI
See Also:
preMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), preMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), postMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent)

postOpenFilterWindow

public void postOpenFilterWindow(DocsLayer docsLayer)
Callback method; invoked after a FilterWindow visualized for a given DocsLayer

See Also:
preOpenFilterWindow(datalator.layers.docs.DocsLayer), postOpenInputWindow(datalator.layers.sprav.SpravLayer), preOpenInputWindow(datalator.layers.sprav.SpravLayer)

postOpenInputWindow

public void postOpenInputWindow(SpravLayer spravLayer)
Callback method; invoked after an InputWindow visualized for a given SpravLayer

Parameters:
spravLayer - reference to SpravLayer which InputLayer has been just visualized
See Also:
preOpenInputWindow(datalator.layers.sprav.SpravLayer), preOpenFilterWindow(datalator.layers.docs.DocsLayer), postOpenFilterWindow(datalator.layers.docs.DocsLayer)

postOpenServiceMenu

public void postOpenServiceMenu(SpravLayer spravLayer,
                                java.lang.String supportMenuName)
Callback method; invoked after ServiceMenu has been visualized. A ServiceMenu is a MenuLayer, which might be activated by F2 key on keyboard; plays role of "context menu". Every SpravLayer might visually define a ServiceMenu. More complex context-dependent support must be defined programmatically.

Parameters:
spravLayer - reference to a SpravLayer
supportMenuName - name of "supporting" MenuLayer
See Also:
preOpenServiceMenu(datalator.layers.sprav.SpravLayer, java.lang.String)

postPaintCustomComponent

public void postPaintCustomComponent(java.awt.Graphics g,
                                     java.lang.String name,
                                     Layer layer,
                                     javax.swing.JComponent jc)
Callback method; every visually designed UI component will call this method after they complete default painting.

Parameters:
g - java.awt.Graphics to paint upon
name - name of the UI component
layer - layer, which UI component belongs to
jc - reference to javax.swing.JComponent

postPaintLayer

public void postPaintLayer(java.awt.Graphics g,
                           Layer layer)
Callback methods; invoked after Layer completed default painting, allows alter it.

Parameters:
g - reference to java.awt.graphics to paint upon
layer - reference to the Layer

postPaintLayerWindow

public void postPaintLayerWindow(java.awt.Graphics g,
                                 Layer layer,
                                 LayerWindow lw)
Callback methods; invoked after every Layer's Window completes default painting, allows alter it.

Parameters:
g - reference to java.awt.graphics to paint upon
layer - reference to the layer
lw - reference to LayerWindow to be painted
See Also:
prePaintLayerWindow(java.awt.Graphics, datalator.layers.Layer, datalator.layers.LayerWindow)

postReloadContent

public void postReloadContent(SpravLayer spravLayer)
Callback method; invoked after SpravLayer's content has been externally altered and after reloaded.

Parameters:
spravLayer - reference to the SpravLayer, which content has been changed
See Also:
preReloadContent(datalator.layers.sprav.SpravLayer)

postReplaceRecord

public void postReplaceRecord(SpravLayer spravLayer,
                              SpravRecord spravRecord)
Callback method; invoked after SpravRecord of SpravLayer has been replaced.

Parameters:
spravLayer - reference to SpravLayer which SpravRecord has been replaced
spravRecord - reference to SpravRecord which has been replaced
See Also:
preReplaceRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

postSettingSupport

public void postSettingSupport(SpravLayer spravLayer,
                               SpravRecord sourceRecord,
                               InputField inputField,
                               javax.swing.JTextField targetTextField)
Callback method; invoked after a given SpravLayer has been used as a drop-down list to set up value in the target JTextField.

Parameters:
spravLayer - reference to SpravLayer, which has been used as a drop-down list
sourceRecord - reference to SpravRecord, which has been used to setup value
inputField - reference to target InputField
targetTextField - reference to target JTextField
See Also:
preSettingSupport(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, datalator.layers.InputField, javax.swing.JTextField)

postStartConnectionDialog

public void postStartConnectionDialog()
Callback method; invoked after connection dialog panel has been visualized.

See Also:
preStartConnectionDialog()

postStartSupportLayer

public void postStartSupportLayer(java.lang.String layerName)
Callback method; invoked after a SpravLayer with given name visualized to be used as a drop-down list.

Parameters:
layerName - name of the SpravLayer which has been just visualized
See Also:
preStartSupportLayer(java.lang.String)

preAddRecord

public boolean preAddRecord(SpravLayer spravLayer,
                            SpravRecord spravRecord)
Callback method; invoked before a record addition is commenced. The record will be added to the end of the table.

Parameters:
spravLayer - SpravLayer which a SpravRecord is to be added to
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postDeleteRecord(datalator.layers.sprav.SpravLayer), postAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preDeleteRecord(datalator.layers.sprav.SpravLayer)

preDeleteRecord

public boolean preDeleteRecord(SpravLayer spravLayer)
Callback method; invoked before a record deletion is complete

Parameters:
spravLayer - SpravLayer which a record is to be deleted from
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), preDeleteRecord(datalator.layers.sprav.SpravLayer)

preEnterLayer

public boolean preEnterLayer(Layer layer)
Callback method; invoked before entering (activation) procedure from the given layer commences. Gets called in two cases: when the given layer used as a support "drop-down" list or when it is used to activate (enter) another Layer Used to prevent unwanted recursions when using hierarchies of SQL tables to support sequential FilterFields

Parameters:
layer - reference to a layer which is about to initiate "double click" or "enter-key" processing.
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postEnterLayer(datalator.layers.Layer, datalator.layers.sprav.SpravRecord), preEnterLayer(datalator.layers.Layer, datalator.layers.sprav.SpravRecord)

preEnterLayer

public boolean preEnterLayer(Layer layer,
                             SpravRecord spravRecord)
Callback method; invoked before entering (activation) another layer from the given one. That method does not get called when using the given layer for input "support" as in drop-down lists situation.

Parameters:
layer - reference to a layer which is about to initiate "activation" of another layer
spravRecord - reference to SpravRecord which was double-clicked or enter-keyed to initiate another layer activation.
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postEnterLayer(datalator.layers.Layer, datalator.layers.sprav.SpravRecord), preEnterLayer(datalator.layers.Layer)

preEnterPressedInputLayer

public boolean preEnterPressedInputLayer(SpravLayer spravLayer,
                                         InputField inputField,
                                         int editMode)
Callback method; invoked before adding or replacing a SpravRecord when action activated by a human user from Input Form controls.

Parameters:
spravLayer - reference to the SpravLayer, which content is to be altered
inputField - is the owner of the TextField, which detected enter key pressed
editMode - 0 when a SpravRecord has been added, 4 when a SpravRecord has been replaced
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postEnterPressedInputLayer(datalator.layers.sprav.SpravLayer, datalator.layers.InputField, int)

preEscapeLayer

public boolean preEscapeLayer(Layer layer)
Callback method; invoked before a layer removed from the layers stack and cleanup commences.

Parameters:
layer - the layer is to be "escaped"
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postEscapeLayer(datalator.layers.Layer)

preFocusGainedInputField

public boolean preFocusGainedInputField(Layer layer,
                                        InputField inputField)
Callback method; invoked when InputField of the given Layer is about to gain input focus.

Parameters:
layer - owner of the InputField
inputField - InputField gained input focus
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postFocusGainedInputField(datalator.layers.Layer, datalator.layers.InputField)

preImageWindowClicked

public boolean preImageWindowClicked(java.lang.String imageId)
Callback method; invoked when Image Field is clicked before click processing commences.

Parameters:
imageId - image id, consisting from the layer name, SpravRecord id and Image Field name.
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postImageWindowClicked(String imageId)

preInputFieldTypedIn

public boolean preInputFieldTypedIn(Layer layer)
Callback method; invoked when user presses "enter" or "tab" key in any InputField, except the last one before processing commenced When the last(only) IntputField "enter" or "tab" keyed, preAddRecord() and postaddRecord() gets invoked.

Parameters:
layer - reference to the active layer
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
preInputFieldTypedIn(datalator.layers.Layer), preAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord), postAddRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

preLoadEntryLayer

public boolean preLoadEntryLayer(java.lang.String appName,
                                 java.lang.String entryLayerName,
                                 java.lang.String userName,
                                 java.lang.String password)
Callback method; invoked before Entry Layer(Main Menu) loaded and visualized.

Parameters:
appName - name of application a used connected to
entryLayerName - name of the entry layer name
userName - id, which user have connected with
password - password, which user have connected with
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postLoadEntryLayer(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

preMouseLeftClicked

public boolean preMouseLeftClicked(SpravLayer spravLayer,
                                   java.awt.event.MouseEvent me)
Callback method; invoked every time user left-clicks on the panel representing a Layer before that click is processed.

Parameters:
spravLayer - reference to the Layer, which UI was left-clicked on
me - reference to the MouseEvent, which was detected on the Layer UI
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), preMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), postMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent)

preMouseRightClicked

public boolean preMouseRightClicked(SpravLayer spravLayer,
                                    java.awt.event.MouseEvent me)
Callback method; invoked every time user right-clicks on the panel representing a Layer before that click is processed.

Parameters:
spravLayer - reference to the Layer, which UI was right-clicked on
me - reference to the MouseEvent, which was detected on the Layer UI
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
preMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), postMouseRightClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent), postMouseLeftClicked(datalator.layers.sprav.SpravLayer, java.awt.event.MouseEvent)

preOpenFilterWindow

public boolean preOpenFilterWindow(DocsLayer docsLayer)
Callback method; invoked before a FilterWindow visualized for a given DocsLayer

Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postOpenFilterWindow(datalator.layers.docs.DocsLayer), postOpenInputWindow(datalator.layers.sprav.SpravLayer), preOpenInputWindow(datalator.layers.sprav.SpravLayer)

preOpenInputWindow

public boolean preOpenInputWindow(SpravLayer spravLayer)
Callback method; invoked before an InputWindow visualized for a given SpravLayer

Parameters:
spravLayer - reference to SpravLayer which InputLayer has been just visualized
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postOpenInputWindow(datalator.layers.sprav.SpravLayer), preOpenFilterWindow(datalator.layers.docs.DocsLayer), postOpenFilterWindow(datalator.layers.docs.DocsLayer)

preOpenServiceMenu

public boolean preOpenServiceMenu(SpravLayer spravLayer,
                                  java.lang.String serviceMenuName)
Callback method; invoked before ServiceMenu has been visualized. A ServiceMenu is a MenuLayer, which might be activated by F2 key on keyboard; plays role of "context menu". Every SpravLayer might visually define a ServiceMenu. More complex context-dependent support must be defined programmatically.

Parameters:
spravLayer - reference to a SpravLayer
serviceMenuName - name of "supporting" MenuLayer
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postOpenServiceMenu(datalator.layers.sprav.SpravLayer, java.lang.String)

prePaintLayerWindow

public boolean prePaintLayerWindow(java.awt.Graphics g,
                                   Layer layer,
                                   LayerWindow lw)
Callback methods; invoked before every Layer's Window commences default painting, allows alter default behavior.

Parameters:
g - reference to java.awt.graphics to paint upon
layer - reference to the layer
lw - reference to LayerWindow to be painted
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postPaintLayerWindow(java.awt.Graphics, datalator.layers.Layer, datalator.layers.LayerWindow)

preReloadContent

public boolean preReloadContent(SpravLayer spravLayer)
Callback method; invoked before reloading of SpravLayer's content, which has been externally altered.

Parameters:
spravLayer - reference to the SpravLayer, which content to be changed
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postReloadContent(datalator.layers.sprav.SpravLayer)

preReplaceRecord

public boolean preReplaceRecord(SpravLayer spravLayer,
                                SpravRecord spravRecord)
Callback method; invoked before SpravRecord of SpravLayer has been replaced.

Parameters:
spravLayer - reference to SpravLayer which SpravRecord to be replaced
spravRecord - reference to SpravRecord to be replaced
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postReplaceRecord(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord)

preReportChangingLayer

public boolean preReportChangingLayer(Layer source,
                                      Layer dest,
                                      boolean enterFlag)
Callback method; invoked before server notified about navigating from source to destination layer. This method is a part of SaaS platform.

Parameters:
source - reference to a source Layer
dest - reference to a destination Layer
enterFlag - if true then destination Layer has been activated, if false then source Layer has been escaped.
Returns:
true if normal system processing authorized, false to suppress normal system processing

preSettingSupport

public boolean preSettingSupport(SpravLayer spravLayer,
                                 SpravRecord sourceRecord,
                                 InputField inputField,
                                 javax.swing.JTextField targetTextField)
Callback method; invoked before a given SpravLayer is used as a drop-down list to set up value in the target JTextField.

Parameters:
spravLayer - reference to SpravLayer, which will be used as a drop-down list
sourceRecord - reference to SpravRecord, which will be used to setup value
inputField - reference to target InputField
targetTextField - reference to target JTextField
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postSettingSupport(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, datalator.layers.InputField, javax.swing.JTextField)

preShowConnectionDialog

public void preShowConnectionDialog(java.util.Properties comps)
Callback method; invoked before Connection Dialog Panel visualized. Might be used to setup connection parameters or alter the Dialog default behavior. See example:

     public void preShowConnectionDialog(Properties comps){
        JTextField port1     = (JTextField)comps.get("TextField Server Port");
        JTextField port2     = (JTextField)comps.get("TextField Feedback Port");
        JTextField server    = (JTextField)comps.get("TextField Server");
        JTextField app       = (JTextField)comps.get("TextField Application");
        JTextField us        = (JTextField)comps.get("TextField User");
        JTextField password  = (JTextField)comps.get("PasswordField Password");
        JButton enterButton  = (JButton)   comps.get("Enter Button");
        JButton cancelButton = (JButton)   comps.get("Cancel Button");
        JLabel     l1        = (JLabel)    comps.get("Label Application");
        JLabel     l2        = (JLabel)    comps.get("Label Server");
        JLabel     l3        = (JLabel)    comps.get("Label Server Port");
        JLabel     l4        = (JLabel)    comps.get("Label Feedback Port");
        JLabel     l5        = (JLabel)    comps.get("Label User");
        JLabel     l6        = (JLabel)    comps.get("Label Password");
     }
 

Parameters:
comps - java.util.Properties containing controls of Connection Dialog

preStartConnectionDialog

public boolean preStartConnectionDialog()
Callback method; invoked before connection dialog panel has been visualized. Used to bypass default connection behavior, see example:

        public boolean preStartConnectionDialog(){
            String webPageParameter = getWebPageParameter();

            if(webPageParameter.equals("myApp 1.0")) {
                setWaitCursor();
                if(!connect(8081, 8082, "myServer.com", "myApp 1.0", "guest", "guest", true, "1111222211112222")){
                    System.out.println("Cannot connect...");
                    setDefaultCursor();
                    shutDown();
                }
                else{
                    setDefaultCursor();
                    return false;        // connected successfully, do not show connection dialog, start myApp1
                }
            }
            if(webPageParameter.equals("myApp 2.0")) {
                setWaitCursor();
                if(!connect(8081, 8082, "myServer.com", "myApp 2.0", "guest", "guest", true, "1111222211112222")){
                    System.out.println("Cannot connect...");
                    setDefaultCursor();
                    shutDown();
                }
                else{
                    setDefaultCursor();
                    return false;        // connected successfully, do not show connection dialog, start myApp2
                }
            }
            return true;
        }
 

See Also:
postStartConnectionDialog(), connect(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String)

preStartSupportLayer

public boolean preStartSupportLayer(java.lang.String layerName)
Callback method; invoked after a SpravLayer with given name visualized to be used as a drop-down list.

Parameters:
layerName - name of the SpravLayer to be visualized
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
postStartSupportLayer(java.lang.String)

preSwitchInputMode

public boolean preSwitchInputMode(SpravLayer spravLayer,
                                  int inputMode)
Callback method; invoked when InputForm requested to change an input mode. There are 5 possible modes:

 0 - input
 1 - browse
 2 - search "starting with substring"
 3 - search "containing substring"
 4 - edit
 

Useful to deny records modification by not authorized user.

Parameters:
spravLayer - reference to a SpravLayer, which InputForm requested to change input mode.
inputMode -
Returns:
true if normal system processing authorized, false to suppress normal system processing
See Also:
switchInputMode(datalator.layers.InputLayer, int)

recordLockStateChanged

public void recordLockStateChanged(java.lang.String layerName,
                                   long recordId,
                                   boolean locked)
Callback method; invoked when server notifies that "edit"-lock status of specific SpravRecord, belonging to SpravLayer with given name has been changed.

Parameters:
layerName - name of the layer which record lock status has been changed
recordId - id of the SpravRecord, which lock has been changed
locked - if true then the record has been locked by somebody, if false the record has been unlocked.

reloadContent

public static void reloadContent(SpravLayer spravLayer)
Initiates asynchronous content updating for the given SpravLayer. The application UI will be responsive during that process.

Parameters:
spravLayer - reference the SpravLayer to be updated.
See Also:
reloadContentAndWait(datalator.layers.Layer)

reloadContentAndWait

public static void reloadContentAndWait(Layer spravLayer)
Initiates and completes synchronous content updating for the given SpravLayer. The application UI might freeze during that process (usually milliseconds).

Parameters:
spravLayer - reference to the SpravLayer to be updated.
See Also:
reloadContent(datalator.layers.sprav.SpravLayer)

removeApplication

public static void removeApplication(java.lang.String appName)
Deletes the given Database in the server Home directory, if issuing the request client connected with administrator credentials. Administrator convenience method.

Parameters:
appName - a name of the new application to be removed.
See Also:
createApplication(java.lang.String)

removeFilterFieldSupport

public static void removeFilterFieldSupport(SpravLayer spravLayer)
Part of programming hierarchies of "supporting" drop-down lists, see "Programming FilterFields Support" for more information.

Parameters:
spravLayer - reference to the SpravLayer
See Also:
setSupportMode(boolean)

repaintAll

public static void repaintAll(int delay)
Initiates repainting the whole UI after given delay. Useful to clean up UI artifacts if any.

Parameters:
delay - milliseconds before request UI repainting

repaintAll

public static void repaintAll()
Requests repainting the whole UI, Java Swing might take some time before fulfilling the request.


replaceSpravRecordAndWait

public static void replaceSpravRecordAndWait(SpravLayer spravLayer,
                                             SpravRecord spravRecord)
Synchronously replaces given SpravRecord to a SpravLayer table in the Database.

Parameters:
spravLayer - reference to the SpravLAyer, which SpravRecord is to be replaced.
spravRecord - reference to SpravRecord to be replaced.

restartServer

public static java.lang.String[] restartServer()
Restarts the server, if issuing the request client connected with administrator credentials. Administrator convenience method.

Returns:
Server response as array of Strings

restoreKeyboardFocus

public static void restoreKeyboardFocus()
Restores an Application keyboard focus if focus was transferred to a custom UI control like in scenario: user hit the button "print" and that button owns a focus now - means UI does not receive user input any more.


rollbackLongTransaction

public static void rollbackLongTransaction()
Rollbacks a "long transaction" for the current client session. Any request(like replaceSpravRecordAndWait(SpravLayer layer, SpravRecord dataRecord)) issued by a client usually translates into a series of SQL sentences on the server side. Thus every request has it's own "commit" or "rollback" statements in the sequence. When a developer programs a transaction, consisting of a few atomic requests(e.g. deletion of a few records), it is necessary to issue startLongTransaction() to commence the transaction, which suppresses "commits" of atomic requests. If a developer is not satisfied with the transaction execution, he or she has to issue commitLongTransaction() to return the Database to a state before that long transaction started.

See Also:
commitLongTransaction()

saveTextContentAndWait

public static java.lang.String[] saveTextContentAndWait(java.lang.String textLayerName,
                                                        java.lang.String parentLayerName,
                                                        long parentRecordId,
                                                        java.lang.String text)
Synchronously saves content of a TextLayer. Usually used when creating content programmatically and TextLayer/"parent" layers are invisible.

Parameters:
textLayerName - name of the TextLayer
parentLayerName - name of the "parent" Layer, which activates the given TexLayer
parentRecordId - recordId of the "parent" layer record, which text content will be attached to
text - content to save in the Database
Returns:
Server response as array of Strings
See Also:
saveTextLayerText(datalator.layers.text.TextLayer)

saveTextLayerText

public static java.lang.String[] saveTextLayerText(TextLayer textLayer)
Synchronously saves content of "visible" TextLater.

Parameters:
textLayer - reference to TextLayer
Returns:
Server response as array of Strings
See Also:
saveTextContentAndWait(java.lang.String, java.lang.String, long, java.lang.String)

setActiveMenuRecord

public static void setActiveMenuRecord(MenuLayer menuLayer,
                                       java.lang.String content)
Sets the active record pointer(highlighted record background) of the MenuLayer to the record with the given content.

Parameters:
menuLayer - reference to MenuLayer
content - content of the record to be set as active
See Also:
setActiveRecord(datalator.layers.sprav.SpravLayer, int), setActiveRecord(datalator.layers.sprav.SpravLayer, long)

setActiveRecord

public static void setActiveRecord(SpravLayer spravLayer,
                                   long recordId)
Sets the active record pointer(highlighted record background) of the SpravLayer to the record with the given record Id.

Parameters:
spravLayer - reference to SpravLayer
recordId - id of the record to be set as active
See Also:
setActiveMenuRecord(datalator.layers.menu.MenuLayer, java.lang.String), setActiveRecord(datalator.layers.sprav.SpravLayer, int)

setActiveRecord

public static void setActiveRecord(SpravLayer spravLayer,
                                   int recordNum)
Sets the active record pointer(highlighted record background) of the SpravLayer to the record with the given position in Vector of records.

Parameters:
spravLayer - reference to SpravLayer
recordNum - desirable position of active record in the records set
See Also:
setActiveMenuRecord(datalator.layers.menu.MenuLayer, java.lang.String), setActiveRecord(datalator.layers.sprav.SpravLayer, long)

setAuxFilterFieldText

public static void setAuxFilterFieldText(FilterField filterField,
                                         java.lang.String text)
Sets the content of auxiliary Filter Field when this Field operation is set to inclusive "><", like when looking for a specific time frame.

Parameters:
filterField - reference to FilterField
text - content of the FilterField's TextField

setBackground

public static void setBackground(java.lang.String name)
Sets one of built-in images as a background image of the Application Frame.

Parameters:
name - name of the background image.
See Also:
getBackgroundNames(), setBackground(java.awt.Image)

setBackground

public static boolean setBackground(java.awt.Image image)
Sets a background image of the Application Frame.

Parameters:
image - reference to the background image.
Returns:
true if installation of the new background was successful, false otherwise
See Also:
getBackgroundNames(), setBackground(java.lang.String)

setDefaultCursor

public static void setDefaultCursor()
Sets a default system cursor.

See Also:
setWaitCursor()

setField

public static void setField(SpravLayer spravLayer,
                            SpravRecord spravRecord,
                            java.lang.String fieldName,
                            java.lang.String value)
Sets value of a given field of a given record of a given loaded spravLayer.

Parameters:
spravLayer - the SpravLayer to set the field value for
spravRecord - the SpravLayer record to set the field value for
fieldName - name of the field to set value for
value - value of the field to set
See Also:
getField(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, java.lang.String)

setFilterField

public static void setFilterField(DocsLayer docsLayer,
                                  java.lang.String fieldName,
                                  java.lang.String value)
Sets value of a given filter field of a given loaded DocsLayer.

Parameters:
docsLayer - reference to the DocsLayer to set the filter field content for
fieldName - name of the filter field to set content for
value - value of the FilterField to set
See Also:
getField(datalator.layers.sprav.SpravLayer, datalator.layers.sprav.SpravRecord, java.lang.String), getFilterField(datalator.layers.docs.DocsLayer, java.lang.String), getFilterFields(datalator.layers.docs.DocsLayer)

setFilterFieldOperation

public static void setFilterFieldOperation(FilterField filterField,
                                           int op)
Sets the comparison operation to use with the FilterField.

Parameters:
filterField - FilterField to set the operation for
op - operation code:

 0 - equal                      ("=")
 1 - greater than               (">")
 2 - less than                  ("<")
 3 - between an inclusive range ("><")
 4 - greater than or equal      (">=")
 5 - less than or equal         ("<=")
 6 - not equal                  ("!=")
 7 - like (Search for a pattern ("~")
 


setFilterFieldText

public static void setFilterFieldText(FilterField filterField,
                                      java.lang.String value)
Sets value of the given FilterField.

Parameters:
filterField - FilterField to set value for
value - value to set

setInputField

public static void setInputField(SpravLayer spravLayer,
                                 java.lang.String fieldName,
                                 java.lang.String value)
Sets value of the given SpravLayer and given InputField name when reference to SpravLayer is available.

Parameters:
spravLayer - reference to SpravLayer
fieldName - name of the InputField to set the value
value - value to set
See Also:
setInputField(datalator.layers.sprav.SpravLayer, java.lang.String, java.lang.String), setInputFieldText(datalator.layers.InputField, java.lang.String)

setInputField

public static void setInputField(InputLayer inputLayer,
                                 java.lang.String fieldName,
                                 java.lang.String value)
Sets value of the given SpravLayer and given InputField name when reference to InputLayer is available.

Parameters:
inputLayer - reference to InputLayer
fieldName - name of the InputField to set the value
value - value to set
See Also:
setInputField(datalator.layers.sprav.SpravLayer, java.lang.String, java.lang.String), setInputFieldText(datalator.layers.InputField, java.lang.String)

setInputFieldText

public static void setInputFieldText(InputField inputField,
                                     java.lang.String value)
Sets value of the given InputField when reference to InputField is available.

Parameters:
inputField - reference to InputField
value - value to set
See Also:
setInputField(datalator.layers.InputLayer, java.lang.String, java.lang.String), setInputField(datalator.layers.sprav.SpravLayer, java.lang.String, java.lang.String)

setLayerMainWindowCaption

public static void setLayerMainWindowCaption(Layer layer,
                                             java.lang.String text,
                                             java.awt.Color frontColor,
                                             java.awt.Color backColor)
Sets caption of the Layer's Main Window

Parameters:
layer - reference to the Layer to set caption for
text - caption to set
frontColor - font color to use when drawing the caption
backColor - background color to use when drawing the caption

setLocation

public static void setLocation(Layer layer,
                               int newX,
                               int newY)
Sets the location of the given Layer

Parameters:
layer - reference to the Layer
newX - top left corner X position
newY - top left corner Y position
See Also:
setSize(datalator.layers.Layer, int, int)

setShadowDefault

public static void setShadowDefault(Layer layer)
Sets default shadow size of the given Layer

Parameters:
layer - reference to the Layer
See Also:
setShadowExtended(datalator.layers.Layer)

setShadowExtended

public static void setShadowExtended(Layer layer)
Extends shadow of the given Layer to darken background and highlight the given Layer

Parameters:
layer - reference to be Layer
See Also:
setShadowDefault(datalator.layers.Layer)

setSize

public static void setSize(Layer layer,
                           int newWidth,
                           int newHeight)
Sets dimensions of the given Layer

Parameters:
layer - reference to the Layer
newWidth - new Layer width
newHeight - new Layer height
See Also:
setLocation(datalator.layers.Layer, int, int)

setSupportMode

public static void setSupportMode(boolean flag)
Part of programming hierarchies of "supporting" drop-down lists, see "Programming FilterFields Support" for more information.

Parameters:
flag - if true sets runtime support mode, if false clears runtime support mode
See Also:
removeFilterFieldSupport(datalator.layers.sprav.SpravLayer)

setTextFieldColors

public static void setTextFieldColors(InputField inputField,
                                      java.awt.Color fore,
                                      java.awt.Color back)
Sets visual attributes of the given InputField text field

Parameters:
inputField - reference to InputField
fore - font color
back - background color

setTextLayerButtonsVisible

public static void setTextLayerButtonsVisible(TextLayer textLayer,
                                              boolean flag)
Sets visibility of "save" and "mode" buttons of the TextLayer, thus granting or denying user ability to alter the content

Parameters:
textLayer - reference to TextLayer
flag - if true buttonsare visible, if false they are invisible

setTextLayerText

public static void setTextLayerText(TextLayer textLayer,
                                    java.lang.String text)
Sets content of the given TextLayer

Parameters:
textLayer - reference to TextLayer
text - content to set
See Also:
getTextLayerText(datalator.layers.text.TextLayer)

setWaitCursor

public static void setWaitCursor()
Sets hourglass type of cursor

See Also:
setDefaultCursor()

showMessage

public static void showMessage(java.lang.String message)
Requests to repaint the message in the Application Message Panel.

Parameters:
message - message to be repainted.

showMessageImmediately

public static void showMessageImmediately(java.lang.String message)
Repaints the message in the Application Message Panel immediately

Parameters:
message - message to be repainted

startLongTransaction

public static void startLongTransaction()
Starts a "long transaction" for the current client session. Any request(like replaceSpravRecordAndWait(SpravLayer layer, SpravRecord dataRecord)) issued by a client usually translates into a series of SQL sentences on the server side. Thus every request has it's own "commit" or "rollback" statements in the sequence. When a developer programs a transaction consisting of a few atomic requests(e.g. deletion of a few records), it is necessary to issue startLongTransaction() to commence the transaction, which suppresses "commits" of atomic requests. If a developer is not satisfied with the transaction execution, he or she has to issue rollbackLongTransaction() to return the Database to a state before that long transaction started.

See Also:
rollbackLongTransaction(), commitLongTransaction()

shutDown

public static void shutDown()
Escapes all opened currently layers gracefully, notifies the server that session is over, closes connections and stops the client.

See Also:
connect(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String)

stopServer

public static java.lang.String[] stopServer()
Stops processing any requests(except from administrator session), if issuing the request client connected with administrator credentials. Administrator convenience method. Only administrator requests startServer(), restartServer(), shutDownServer() and getServerRunTimeInfo() will be processed.

Returns:
Server response as array of Strings

startServer

public static java.lang.String[] startServer()
Sets the server into normal processing mode after it has been stopped, if issuing the request client connected with administrator credentials. Administrator convenience method.

Returns:
Server response as array of Strings
See Also:
stopServer(), restartServer(), shutDownServer(), getServerRunTimeInfo()

shutDownServer

public static java.lang.String[] shutDownServer()
Notifies all connected clients "Shutting down Server...", closes database connection immediately and makes server System.exit(0). Note, when restartServer() request issued, the server quits with code "1111" which is used by launch script to restart the server again. Note, Linux launch script receives the value as "87". Administrator convenience method.

Returns:
Server response as array of Strings
See Also:
restartServer()

switchInputMode

public static void switchInputMode(InputLayer inputLayer,
                                   int times)
Switches mode of InputLayer given number of times. There are 5 possible modes:

 0 - input
 1 - browse
 2 - search "starting with substring"
 3 - search "containing substring"
 4 - edit
 

Parameters:
inputLayer - reference to InputLayer
times - number of time to switch the mode (e.g. from "input" to "edit" it will be 4 times)
See Also:
preSwitchInputMode(datalator.layers.sprav.SpravLayer, int)

stopDownload

public static void stopDownload()
Stops downloading process which has been activated by downloadFile(java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.swing.JProgressBar, javax.swing.JLabel) request. Because of the blocking Java input-output API employed in the current Datalator version, that request might not be executed immediately.

See Also:
downloadFile(java.lang.String, java.lang.String, java.lang.String, java.lang.String, javax.swing.JProgressBar, javax.swing.JLabel)

startClientApplication

public static void startClientApplication(int x,
                                          int y,
                                          int width,
                                          int height,
                                          java.lang.String serverIp,
                                          java.lang.String appName,
                                          java.lang.String id,
                                          java.lang.String password,
                                          java.lang.String buildString)
Starts the client application, the only method which has to be rewritten in the Main class of application. See the following snippet:

 
 public class Main {
    public static void main(String[] args) {
       javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                datalator.user.MyApp.user = new datalator.user.MyApp();       // setting up the class, custom logic container
                // or use convenience method MyApp.setUserCode(); 
                datalator.user.MyApp.startClientApplication(50, 40, 1200, 800, "127.0.0.1", "MyApp", "", "", "MyApp3 build 07-29-2011");
            }
        });
    }
}
 

Parameters:
x - x-position of the top left corner of application frame
y - y-position of the top left corner of application frame
width - width of the application frame
height - height of the application frame
serverIp - server name or ip (e.g. "fancydata.com" or "127.0.0.1") to connect to
appName - application name to connect to
id - user id
password - user password
buildString - optional string to be displayed in the left bottom corner of the application screen

startFilterSupportLayer

public static void startFilterSupportLayer(DocsLayer docsLayer,
                                           FilterField filterField)
Visualizes "supporting" SpravLayer for the given FilterField of the given DocsLayer, as it a user left-click on that FilterField.

Parameters:
docsLayer - reference to DocsLayer
filterField - reference to FilterField
See Also:
startInputSupportLayer(datalator.layers.sprav.SpravLayer, datalator.layers.InputField)

startInputSupportLayer

public static void startInputSupportLayer(SpravLayer spravLayer,
                                          InputField inputField)
Visualizes "supporting" SpravLayer for the given InputField of the given SpravLayer, as it a user left-click on that InputField.

Parameters:
spravLayer - reference to SpravLayer
inputField - reference to InputField
See Also:
startFilterSupportLayer(datalator.layers.docs.DocsLayer, datalator.layers.FilterField)

showRecordLockPeopleWorkingBelow

public static void showRecordLockPeopleWorkingBelow(boolean flag)
Allows or disallows to use an icon "people working below" when visualizing any SpravLayer content.

Parameters:
flag - if true UI will show the icon, if false - not.