-
Notifications
You must be signed in to change notification settings - Fork 0
Class Jaswt
Package jaswt.core
File Jaswt.java
Jutilas is the class that contains the generic functions to develop an application.
This class implements the singleton pattern, so to get the Jutilas instance you need to use the getInstance()
method.
Example:
Jutilas.getInstance()
.
-
-
- Map<String, CLabel> createLabels(String[] textsLabel, int x, int y, int width, int height, int space, Composite compositeParent, String[] keyMapList, int labelStyle, CreateContentsDirection createContentsDirection)
- Map<String, Text> createTexts(int x, int y, int[] width, int height, int space, Composite compositeParent, String[] keyMapList, int textStyle, CreateContentsDirection createContentsDirection)
- Map<String, Button> createButtons(String[] textsList, int x, int y, int width, int height, int space, Composite compositeParent, SelectionListener[] selectListenerList, String[] keyMapList, CreateContentsDirection createContentsDirection)
This method launch a message box.
Return:
Return the SWT response. Example: SWT.YES
.
Parameters:
- parent, shell parent
- style, SWT style
- title, message box title
- message, message to be view
Example:
Shell shell = new Shell(Display.getDefault()); Jaswt.launchMB(shell, SWT.OK, "BEER", "I need a beer!!!");
This method launch a error message box.
Parameters:
- parent, shell parent
- exception, exception catched
Example:
Shell shell = new Shell(Display.getDefault()); Jaswt.launchMB(shell, new Exception("I need a beer!!!"));
This method launch a error message box, and write the exception on log error.
Parameters:
- parent, shell parent
- exception, exception catched
-
joggerError, object
jogger.JoggerError
Example:
Shell shell = new Shell(Display.getDefault()); JoggerError jogErr = new JoggerError(); Jaswt.launchMB(shell, new Exception("I need a beer!!!"), jogErr);
Map<String, CLabel> createLabels(String[] textsLabel, int x, int y, int width, int height, int space, Composite compositeParent, String[] keyMapList, int labelStyle, CreateContentsDirection createContentsDirection)
This method creates a more org.eclipse.swt.custom.CLabel
through a for loop, on
composite parent.
Return:
Return the map of org.eclipse.swt.custom.CLabel
created.
The map key is the respective key of key list passed in the arguments, the value is the CLabel created.
Parameters:
- textsLabel, text list for labels
- x, x cooridinate on composite to start
- y, y cooridinate on composite to start
- width, width of labels
- height, height of labels
- space, between two labels
- compositeParent, composite parent
- keyMapList, key list for map to be returned
- labelStyle, SWT style for labels
- createContentsDirection, direction to be create the labels. Look CreateContentsDirection.
Example:
Shell shell = new Shell(Display.getDefault()); String[] txtsLbl = {"Address:", "Port:"}; String[] keysLbl = {"address", "port"}; Map<String, CLabel> labelMap = Jaswt.getInstance().createLabels(txtsLbl, 20, 30, 70, 30, 20, shell, keysLbl, SWT.NONE, createContentsDirection.VERTICAL);
Map<String, Text> createTexts(int x, int y, int[] width, int height, int space, Composite compositeParent, String[] keyMapList, int textStyle, CreateContentsDirection createContentsDirection)
This method creates a more org.eclipse.swt.widgets.Text
through a for loop, on
composite parent.
Return:
Return the map of org.eclipse.swt.widgets.Text
created.
The map key is the respective key of key list passed in the arguments, the value is the Text created.
Parameters:
- x, x cooridinate on composite to start
- y, y cooridinate on composite to start
- width, width list for texts
- height, height of texts
- space, between two texts
- compositeParent, composite parent
- keyMapList, key list for map to be returned
- textStyle, SWT style for texts
- createContentsDirection, direction to be create the texts. Look CreateContentsDirection.
Example:
Shell shell = new Shell(Display.getDefault()); String[] keysTxt = {"address", "port"}; int[] widths = {160, 80}; Map<String, Text> textMap = Jaswt.getInstance().createTexts(100, 30, widths, 30, 20, shell, keysTxt, SWT.NONE, createContentsDirection.VERTICAL);
Map<String, Button> createButtons(String[] textsList, int x, int y, int width, int height, int space, Composite compositeParent, SelectionListener[] selectListenerList, String[] keyMapList, CreateContentsDirection createContentsDirection)
This method creates a more org.eclipse.swt.widgets.Button
through a for loop, on
composite parent.
Return:
Return the map of org.eclipse.swt.widgets.Button
created.
The map key is the respective key of key list passed in the arguments, the value is the Button created.
Parameters:
- textsLabel, text list for buttons
- x, x cooridinate on composite to start
- y, y cooridinate on composite to start
- width, width of bottuns
- height, height of buttons
- space, between two buttons
- compositeParent, composite parent
- keyMapList, key list for map to be returned
- labelStyle, SWT style for label
- createContentsDirection, direction to be create the buttons. Look CreateContentsDirection.
Example:
Shell shell = new Shell(Display.getDefault()); String[] txtBttn = {"Cancel", "Save"}; String[] keyBttn = {"address", "port"}; Map<String, Button> bttnMap = Jaswt.getInstance().createButtons(txtBttn, 50, 130, 100, 30, 20, shell, keyBttn, createContentsDirection.HORIZONTAL);
This method center the shell on screen.
The advice is to call this method only after setting the shell size.
Parameters:
-
shell,
org.eclipse.swt.widgets.Shell
to be centered
Example:
Shell shell = new Shell(Display.getDefault()); shell.setSize(200, 300); Jaswt.getInstance().centerWindow(shell);
This method open a OS window to select a foler.
Return:
The path of folder selcted.
Parameters:
-
shell,
org.eclipse.swt.widgets.Shell
parent - pathStart, path to bo opened in the directory dialog. If you pass null, the path is automatically setted on path of user home.
Example:
Shell shell = new Shell(Display.getDefault()); String dirPath = Jaswt.getInstance().launchDirectoryDialog(shell, "/path/to/start");
This method open a OS window to select a file.
Return:
The path of file selcted.
Parameters:
-
shell,
org.eclipse.swt.widgets.Shell
parent - pathStart, path to bo opened in the file dialog. If you pass null, the path is automatically setted on path of user home.
Example:
Shell shell = new Shell(Display.getDefault()); String filePath = Jaswt.getInstance().launchFileDialog(shell, "/path/to/start");
This enumeration contains the directions to create the contents.
Values:
- HORIZONTAL, horizontal
- VERTICAL, vertical