Servoy Properties Summary | |
---|---|
String | build |
Date | buildDate |
String | component |
String | defaultPrinter |
Number | version |
Servoy Properties Details |
---|
build
String build
Returns the current version (major, minor, build)Returns
String build String
Supported Clients
SmartClient, WebClient, NGClient
buildDate
Date buildDate
Returns date release dateReturns
Date date Date
Supported Clients
SmartClient, WebClient, NGClient
component
String component
Returns the component nameReturns
String name String
Supported Clients
SmartClient, WebClient, NGClient
defaultPrinter
String defaultPrinter
Get/Set the default printer.Returns
String printer String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Get an Array of available printers.
// capture the printer list in an array
var printers = plugins.it2be_tools.getPrinters();
// show the list in a dialog
var selection = plugins.dialogs.showSelectDialog("printers", "These are your printers", printers);
// get the default printer
var defaultprinter = plugins.it2be_tools.defaultPrinter;
// set the default printer to the selected printer
plugins.it2be_tools.defaultPrinter = selection;
// start printing with a printer dialog
controller.print(true,true);
// reset the default printer to the previously found default printer
plugins.it2be_tools.defaultPrinter = defaultprinter;
// start printing with a printer dialog
controller.print(true,true);
version
Number version
Returns the current version (major, minor)Returns
Number version Double
Supported Clients
SmartClient, WebClient, NGClient
Servoy Methods Details |
---|
arrayContains
Boolean arrayContains( Array<Object>, Object )
Check that the array contains the value.Parameters
Array<Object> array the array
Object value the value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
arrayIndexOf
Number arrayIndexOf( Array<Object>, Object )
Returns the index of the value in the array (or -1 if not found).Parameters
Array<Object> array the array
Object value the value
Returns
Number index int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// We set up a mixed Array
var array = [2,1,"a",6,"C",3,99,4,"Ball",5,"Zero",88];
// Returns the index of the value in the array (or -1 if not found).
application.output("Array index of: " + plugins.it2be_tools.arrayIndexOf(array, 4));
client
ITClient client( )
Retrieve (more or less) essential client data.Returns
ITClient client object ITClient
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve ITClient data
application.output(plugins.it2be_tools.client().IP);
application.output(plugins.it2be_tools.client().fileSeparator);
application.output(plugins.it2be_tools.client().hostName);
application.output(plugins.it2be_tools.client().javaVendor);
application.output(plugins.it2be_tools.client().javaVendorURL);
application.output(plugins.it2be_tools.client().javaVersion);
application.output(plugins.it2be_tools.client().lineSeparator);
application.output(plugins.it2be_tools.client().osArchitecture);
application.output(plugins.it2be_tools.client().osName);
application.output(plugins.it2be_tools.client().osNumber);
application.output(plugins.it2be_tools.client().osVersion);
application.output(plugins.it2be_tools.client().pathSeparator);
application.output(plugins.it2be_tools.client().tempDir);
application.output(plugins.it2be_tools.client().userDir);
application.output(plugins.it2be_tools.client().userHome);
application.output(plugins.it2be_tools.client().userName);
var a = plugins.it2be_tools.client().MACAddress();
if (a) {
for (var i = 0 ; i < a.length ; i++) {
application.output(a[i]);
}
} else {
application.output('Strange there is no MAC address');
}
createUUID
String createUUID( )
Create a random UUID.Returns
String uuid String
Supported Clients
SmartClient, WebClient, NGClient
dateDifference
Number dateDifference( Object, Object, Number )
Calculate the difference between date 1 and date 2 and output milliseconds (1), seconds (2), minutes (3), hours (4) or days (5).Parameters
Object date1 the first date
Object date2 the second date
Number period the period
Returns
Number days long
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Calculate the difference between date 1 and date 2 and output milliseconds (1), seconds (2), minutes (3), hours (4) or days (5).
var date1 = new Date();
var date2 = new Date();
// set the day of d2 with the day of date1 - 3 days and display the result
d2.setDate(d1.getDate() - 3);
application.output(plugins.it2be_tools.dateDifference(date1, date2, 1));
application.output(plugins.it2be_tools.dateDifference(date1, date2, 5));
dateFormat
Date dateFormat( String, String )
The dateFormat class acts like the dateFormat class of Java to convert from Date to String and vice versa.Parameters
String date the date
String format the format
Returns
Date date Date
Supported Clients
SmartClient, WebClient, NGClient
dateFormat
String dateFormat( Object )
The dateFormat class acts like the dateFormat class of Java to convert from Date to String and vice versa.Parameters
Object date the date
Returns
String date String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// The dateFormat class acts like the dateFormat class of Java to convert from Date to String and vice versa.
// if you don't add a formatting string the string will be the locale string.
// the first string is the date string, the second string is the formatting string
application.output(plugins.it2be_tools.dateFormat('9-January-2007 23:05:10'));
application.output(plugins.it2be_tools.dateFormat('9-January-2007', 'dd-MMMM-yyyy'));
// the examples below take the date to format it into a string
application.output(plugins.it2be_tools.dateFormat(new Date()));
application.output(plugins.it2be_tools.dateFormat(new Date(), 'dd-MMMM-yyyy'));
dateFormat
String dateFormat( Object, String )
The dateFormat class acts like the dateFormat class of Java to convert from Date to String and vice versa.Parameters
Object date the date
String format the format
Returns
String date String
Supported Clients
SmartClient, WebClient, NGClient
dateFormat
Date dateFormat( String )
The dateFormat class acts like the dateFormat class of Java to convert from Date to String and vice versa.Parameters
String date the date
Returns
Date date Date
Supported Clients
SmartClient, WebClient, NGClient
endsWith
Boolean endsWith( String, String )
Return true when the string ends with the suffix.Parameters
String value the value
String suffix the suffix
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return true when the string ends with the suffix.
application.output(plugins.it2be_tools.endsWith("filename.csv", ".csv"));
application.output(plugins.it2be_tools.endsWith("filename.csv", "file"));
getByteLength
Number getByteLength( String, String )
Retrieve length of the byte array of the give String and optional encoding.Parameters
String value the value
String encoding the encoding
Returns
Number length int
Supported Clients
SmartClient, WebClient, NGClient
getByteLength
Number getByteLength( String )
Retrieve length of the byte array of the give String and optional encoding.Parameters
String value the value
Returns
Number length int
Supported Clients
SmartClient, WebClient, NGClient
getBytes
byte[] getBytes( String )
Retrieve the byte array of the give String and optional encoding.Parameters
String value the value
Returns
byte[] array byte[]
Supported Clients
SmartClient, WebClient, NGClient
getBytes
byte[] getBytes( String, String )
Retrieve the byte array of the give String and optional encoding.Parameters
String value the value
String encoding the encoding
Returns
byte[] array byte[]
Supported Clients
SmartClient, WebClient, NGClient
getMaxDay
Number getMaxDay( Number )
Return the maximum day value of the given month.Parameters
Number month the month
Returns
Number day int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the maximum day value of the given month.
// input nothing and you will get the last day of the actual month
application.output(plugins.it2be_tools.getMaxDay());
// input only a month (integer) and you will get the last day of the given month
var d = new Date(2007, 10 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth()));
// input both a month and a year (integers) to recieve the last day of the given month
var d = new Date(2007, 1 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth(), d.getFullYear()));
getMaxDay
Number getMaxDay( Number, Number )
Return the maximum day value of the given month.Parameters
Number month the month
Number year the year
Returns
Number day int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the maximum day value of the given month.
// input nothing and you will get the last day of the actual month
application.output(plugins.it2be_tools.getMaxDay());
// input only a month (integer) and you will get the last day of the given month
var d = new Date(2007, 10 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth()));
// input both a month and a year (integers) to recieve the last day of the given month
var d = new Date(2007, 1 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth(), d.getFullYear()));
getMaxDay
Number getMaxDay( )
Return the maximum day value of the given month.Returns
Number day int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the maximum day value of the given month.
// input nothing and you will get the last day of the actual month
application.output(plugins.it2be_tools.getMaxDay());
// input only a month (integer) and you will get the last day of the given month
var d = new Date(2007, 10 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth()));
// input both a month and a year (integers) to recieve the last day of the given month
var d = new Date(2007, 1 , 1);
application.output(plugins.it2be_tools.getMaxDay(d.getMonth(), d.getFullYear()));
getPrinters
Array<String> getPrinters( )
Get an array of available printers.Returns
Array<String> printers String[]
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Get an Array of available printers.
// capture the printer list in an array
var printers = plugins.it2be_tools.getPrinters();
// show the list in a dialog
var selection = plugins.dialogs.showSelectDialog("printers", "These are your printers", printers);
// get the default printer
var defaultprinter = plugins.it2be_tools.defaultPrinter;
// set the default printer to the selected printer
plugins.it2be_tools.defaultPrinter = selection;
// start printing with a printer dialog
controller.print(true,true);
// reset the default printer to the previously found default printer
plugins.it2be_tools.defaultPrinter = defaultprinter;
// start printing with a printer dialog
controller.print(true,true);
getScreenX
Number getScreenX( Component )
Get the x coordinate of the element relative to the screen.Parameters
Component element the element
Returns
Number x int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Get the x coordinate of the element relative to the screen.
var button = elements.button;
// calculate the new x coordinate for the dialog.
var x = plugins.it2be_tools.getScreenX(button) - button.getLocationX();
// calculate the new y coordinate for the dialog.
var y = plugins.it2be_tools.getScreenY(button) + button.getHeight() - button.getLocationY();
application.showFormInDialog(forms.name, x, y);
getScreenY
Number getScreenY( Component )
Get the y coordinate of the element relative to the screen.Parameters
Component element the element
Returns
Number y int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Get the x coordinate of the element relative to the screen.
var button = elements.button;
// calculate the new x coordinate for the dialog.
var x = plugins.it2be_tools.getScreenX(button) - button.getLocationX();
// calculate the new y coordinate for the dialog.
var y = plugins.it2be_tools.getScreenY(button) + button.getHeight() - button.getLocationY();
application.showFormInDialog(forms.name, x, y);
isEmail
String isEmail( String )
Check the email adress(es) for correct formatting and (optionally) double addresses and removes spaces.Parameters
String email the email address
Returns
String email String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check the email adress(es) for correct formatting and (optionally) double addresses and removes spaces.
// returns a string starting with 'error: ' in case of a found error
// or the correct string with (default) or without double email addresses
for (var i = 0; i < 3 ; i++) {
if (i == 0) {
//error in addresses
var message = plugins.it2be_tools.isEmail("[email protected]; [email protected]; [email protected]");
} else if (i == 1) {
//double addresses with default check
var message = plugins.it2be_tools.isEmail("[email protected]; [email protected]; [email protected]");
} else {
//double addresses with check for double addresses
var message = plugins.it2be_tools.isEmail("[email protected]; [email protected]; [email protected]", true);
}
if (message.indexOf("error: ") > -1) {
message = "you have an Error in the following email adress(es):\n" +message.substring(7);
plugins.dialogs.showErrorDialog("Error", message, "OK");
} else {
message = "The email with de-doubled adress(es):\n" +message;
plugins.dialogs.showInfoDialog("Result", message, "OK");
}
}
isEmail
String isEmail( String, Boolean )
Check the email adress(es) for correct formatting and (optionally) double addresses and removes spaces.Parameters
String email the email address
Boolean dedouble the dedouble
Returns
String email String
Supported Clients
SmartClient, WebClient, NGClient
isExpired
Boolean isExpired( Number, Number )
Check if the given year, month and (optional) date are expired.Parameters
Number year the year
Number month the month
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given year, month and (optional) date are expired.
// input only year, month and the check will be done against the actual month
var d = new Date();
application.output(plugins.it2be_tools.isExpired(d.getFullYear(), d.getMonth()));
// input a date to check agaist the actual date
d.setMonth(d.getMonth() - 1);
application.output(plugins.it2be_tools.isExpired(d));
isExpired
Boolean isExpired( Number, Number, Number )
Check if the given year, month and (optional) date are expired.Parameters
Number year the year
Number month the month
Number day the day
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given year, month and (optional) date are expired.
// input only year, month and the check will be done against the actual month
var d = new Date();
application.output(plugins.it2be_tools.isExpired(d.getFullYear(), d.getMonth()));
// input a date to check agaist the actual date
d.setMonth(d.getMonth() - 1);
application.output(plugins.it2be_tools.isExpired(d));
isExpired
Boolean isExpired( Date )
Check if the given year, month and (optional) date are expired.Parameters
Date date the date
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given year, month and (optional) date are expired.
// input only year, month and the check will be done against the actual month
var d = new Date();
application.output(plugins.it2be_tools.isExpired(d.getFullYear(), d.getMonth()));
// input a date to check agaist the actual date
d.setMonth(d.getMonth() - 1);
application.output(plugins.it2be_tools.isExpired(d));
isInRange
Boolean isInRange( Number, Number, Number )
Check if the given string, number, integer or date is in range.Parameters
Number value the value
Number min the min value
Number max the max value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string, number, integer or date is in range.
// check a string, don't ignore case (default)
application.output(plugins.it2be_tools.isInRange('C', 'a', 'f'));
// check a string, ignore case
application.output(plugins.it2be_tools.isInRange('c', 'a', 'f', true));
// check an integer or number
application.output(plugins.it2be_tools.isInRange(10.5, 5, 9));
// check a date
var d = new Date();
var dmin = new Date();
dmin.setMonth(dmin.getMonth() - 1);
var dmax = new Date();
dmax.setMonth(dmax.getMonth() + 1);
application.output(plugins.it2be_tools.isInRange(d, dmin, dmax));
isInRange
Boolean isInRange( String, String, String )
Check if the given string, number, integer or date is in range.Parameters
String value the value
String min the min value
String max the max value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string, number, integer or date is in range.
// check a string, don't ignore case (default)
application.output(plugins.it2be_tools.isInRange('C', 'a', 'f'));
// check a string, ignore case
application.output(plugins.it2be_tools.isInRange('c', 'a', 'f', true));
// check an integer or number
application.output(plugins.it2be_tools.isInRange(10.5, 5, 9));
// check a date
var d = new Date();
var dmin = new Date();
dmin.setMonth(dmin.getMonth() - 1);
var dmax = new Date();
dmax.setMonth(dmax.getMonth() + 1);
application.output(plugins.it2be_tools.isInRange(d, dmin, dmax));
isInRange
Boolean isInRange( String, String, String, Boolean )
Check if the given string, number, integer or date is in range.Parameters
String value the value
String min the min value
String max the max value
Boolean ignoreCase the ignore case
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string, number, integer or date is in range.
// check a string, don't ignore case (default)
application.output(plugins.it2be_tools.isInRange('C', 'a', 'f'));
// check a string, ignore case
application.output(plugins.it2be_tools.isInRange('c', 'a', 'f', true));
// check an integer or number
application.output(plugins.it2be_tools.isInRange(10.5, 5, 9));
// check a date
var d = new Date();
var dmin = new Date();
dmin.setMonth(dmin.getMonth() - 1);
var dmax = new Date();
dmax.setMonth(dmax.getMonth() + 1);
application.output(plugins.it2be_tools.isInRange(d, dmin, dmax));
isInRange
Boolean isInRange( Object, Object, Object )
Check if the given string, number, integer or date is in range.Parameters
Object value the value
Object min the min value
Object max the max value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string, number, integer or date is in range.
// check a string, don't ignore case (default)
application.output(plugins.it2be_tools.isInRange('C', 'a', 'f'));
// check a string, ignore case
application.output(plugins.it2be_tools.isInRange('c', 'a', 'f', true));
// check an integer or number
application.output(plugins.it2be_tools.isInRange(10.5, 5, 9));
// check a date
var d = new Date();
var dmin = new Date();
dmin.setMonth(dmin.getMonth() - 1);
var dmax = new Date();
dmax.setMonth(dmax.getMonth() + 1);
application.output(plugins.it2be_tools.isInRange(d, dmin, dmax));
isInteger
Boolean isInteger( String )
Check if the given string holds only an integer, number or string value.Parameters
String value the value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string holds only an integer, number or string value.
// The number check takes system settings concerning the decimal separator into account
application.output("check: '1' is integer = " + plugins.it2be_tools.isInteger("1"));
application.output("check: '1' is number = " + plugins.it2be_tools.isNumber("1"));
application.output("check: '1' is text only = " + plugins.it2be_tools.isTextOnly("1"));
application.output("check: '1.5' is integer = " + plugins.it2be_tools.isInteger("1.5"));
application.output("check: '1.5' is number = " + plugins.it2be_tools.isNumber("1.5"));
application.output("check: '1.5' is text only = " + plugins.it2be_tools.isTextOnly("1.5"));
application.output("check: 'it2be' is integer = " + plugins.it2be_tools.isInteger("it2be"));
application.output("check: 'it2be' is number = " + plugins.it2be_tools.isNumber("it2be"));
application.output("check: 'it2be' is text only = " + plugins.it2be_tools.isTextOnly("it2be"));
application.output("check: 'tools' is integer = " + plugins.it2be_tools.isInteger("tools"));
application.output("check: 'tools' is number = " + plugins.it2be_tools.isNumber("tools"));
application.output("check: 'tools' is text only = " + plugins.it2be_tools.isTextOnly("tools"));
isModulus10
Boolean isModulus10( String )
Check if the given string is a valid credit card number.Parameters
String value the value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string is a valid credit card number.
application.output(plugins.it2be_tools.isModulus10('1234 5678 9012 3456'));
isNumber
Boolean isNumber( String )
Check if the given string holds only an integer, number or string value.Parameters
String value the value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string holds only an integer, number or string value.
// The number check takes system settings concerning the decimal separator into account
application.output("check: '1' is integer = " + plugins.it2be_tools.isInteger("1"));
application.output("check: '1' is number = " + plugins.it2be_tools.isNumber("1"));
application.output("check: '1' is text only = " + plugins.it2be_tools.isTextOnly("1"));
application.output("check: '1.5' is integer = " + plugins.it2be_tools.isInteger("1.5"));
application.output("check: '1.5' is number = " + plugins.it2be_tools.isNumber("1.5"));
application.output("check: '1.5' is text only = " + plugins.it2be_tools.isTextOnly("1.5"));
application.output("check: 'it2be' is integer = " + plugins.it2be_tools.isInteger("it2be"));
application.output("check: 'it2be' is number = " + plugins.it2be_tools.isNumber("it2be"));
application.output("check: 'it2be' is text only = " + plugins.it2be_tools.isTextOnly("it2be"));
application.output("check: 'tools' is integer = " + plugins.it2be_tools.isInteger("tools"));
application.output("check: 'tools' is number = " + plugins.it2be_tools.isNumber("tools"));
application.output("check: 'tools' is text only = " + plugins.it2be_tools.isTextOnly("tools"));
isServoyClient
Boolean isServoyClient( )
Check if this is a client or developer running.Returns
Boolean reesult boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if this is a client or developer running.
// this doesn't really check if a client is running
// instead it checks if the name of the running application is 'Servoy Developer'
// if so it will return 'false', otherwise it will return 'true'
var result = plugins.it2be_tools.isServoyClient();
if (result) {
application.output('Servoy client running.');
} else {
application.output('no Servoy client running.');
}
isTextOnly
Boolean isTextOnly( String )
Check if the given string holds only text (not 0-9).Parameters
String value the value
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Check if the given string holds only an integer, number or string value.
// The number check takes system settings concerning the decimal separator into account
application.output("check: '1' is integer = " + plugins.it2be_tools.isInteger("1"));
application.output("check: '1' is number = " + plugins.it2be_tools.isNumber("1"));
application.output("check: '1' is text only = " + plugins.it2be_tools.isTextOnly("1"));
application.output("check: '1.5' is integer = " + plugins.it2be_tools.isInteger("1.5"));
application.output("check: '1.5' is number = " + plugins.it2be_tools.isNumber("1.5"));
application.output("check: '1.5' is text only = " + plugins.it2be_tools.isTextOnly("1.5"));
application.output("check: 'it2be' is integer = " + plugins.it2be_tools.isInteger("it2be"));
application.output("check: 'it2be' is number = " + plugins.it2be_tools.isNumber("it2be"));
application.output("check: 'it2be' is text only = " + plugins.it2be_tools.isTextOnly("it2be"));
application.output("check: 'tools' is integer = " + plugins.it2be_tools.isInteger("tools"));
application.output("check: 'tools' is number = " + plugins.it2be_tools.isNumber("tools"));
application.output("check: 'tools' is text only = " + plugins.it2be_tools.isTextOnly("tools"));
lTrim
String lTrim( String )
Return the string with all leading spaces removed.Parameters
String value the value
Returns
String trimmed String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the string with all leading spaces removed.
application.output(plugins.it2be_tools.lTrim(" input "));
mirror
String mirror( String )
Return the string in reverse order.Parameters
String value the value
Returns
String mirrored String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the string in reverse order.
application.output(plugins.it2be_tools.mirror("mirrorString"));
numberFormat
String numberFormat( Number, String )
The numberFormat class will return a string in the given (localized) format.Parameters
Number number the number
String format the format
Returns
String formatted String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// The numberFormat class will return a string in the given (localized) format.
application.output(plugins.it2be_tools.numberFormat(123.5678, '##.#'));
numberFormat
String numberFormat( String, String )
The numberFormat class will return a string in the given (localized) format.Parameters
String number the number
String format the format
Returns
String formatted String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// The numberFormat class will return a string in the given (localized) format.
application.output(plugins.it2be_tools.numberFormat('123.5678', '##.#'));
rTrim
String rTrim( String )
Return the string with all ltrailings spaces removed.Parameters
String value the value
Returns
String trimmed String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the string with all ltrailings spaces removed.
application.output(plugins.it2be_tools.rTrim(" input "));
secondsFormat
String secondsFormat( Number )
Convert the given number of seconds (integer) to a string formatted like 'HH:mm:ss' and vice versa.Parameters
Number seconds the seconds
Returns
String formatted String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Convert the given number of seconds (integer) to a string formatted like 'HH:mm:ss' and vice versa.
// format the number of seconds to a string
application.output(plugins.it2be_tools.secondsFormat(100));
// return the number of seconds based on the string formatted like 'HH:mm:ss'
application.output(plugins.it2be_tools.secondsFormat('00:01:40'));
secondsFormat
Number secondsFormat( String )
Convert the given number of seconds (integer) to a string formatted like 'HH:mm:ss' and vice versa.Parameters
String seconds the seconds string
Returns
Number count int
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Convert the given number of seconds (integer) to a string formatted like 'HH:mm:ss' and vice versa.
// format the number of seconds to a string
application.output(plugins.it2be_tools.secondsFormat(100));
// return the number of seconds based on the string formatted like 'HH:mm:ss'
application.output(plugins.it2be_tools.secondsFormat('00:01:40'));
server
ITServer server( )
Retrieve (more or less) essential server data.Returns
ITServer ITServer
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Retrieve ITServer data
application.output(plugins.it2be_tools.server().IP);
application.output(plugins.it2be_tools.server().fileSeparator);
application.output(plugins.it2be_tools.server().hostName);
application.output(plugins.it2be_tools.server().javaVendor);
application.output(plugins.it2be_tools.server().javaVendorURL);
application.output(plugins.it2be_tools.server().javaVersion);
application.output(plugins.it2be_tools.server().lineSeparator);
application.output(plugins.it2be_tools.server().osArchitecture);
application.output(plugins.it2be_tools.server().osName);
application.output(plugins.it2be_tools.server().osNumber);
application.output(plugins.it2be_tools.server().osVersion);
application.output(plugins.it2be_tools.server().pathSeparator);
application.output(plugins.it2be_tools.server().tempDir);
application.output(plugins.it2be_tools.server().userDir);
application.output(plugins.it2be_tools.server().userHome);
application.output(plugins.it2be_tools.server().userName);
var a = plugins.it2be_tools.server().MACAddress();
if (a) {
for (var i = 0 ; i < a.length ; i++) {
application.output(a[i]);
}
} else {
application.output('Strange there is no MAC address');
}
setSolutionIcon
void setSolutionIcon( byte[] )
Replace the icon in the window frame (platform dependent).Parameters
byte[] icon the icon
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Replace the icon in the window frame (platform dependent).
// add the image path (or url)
var p = plugins.file.showFileOpenDialog(1)
plugins.it2be_tools.setSolutionIcon(p.getAbsolutePath());
// or use an image from your media database
var image = plugins.http.getMediaData('media:///yourimage.jpg');
plugins.it2be_tools.setSolutionIcon(image);
setSolutionIcon
void setSolutionIcon( String )
Replace the icon in the window frame (platform dependent).Parameters
String url the url
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Replace the icon in the window frame (platform dependent).
// add the image path (or url)
var p = plugins.file.showFileOpenDialog(1)
plugins.it2be_tools.setSolutionIcon(p.getAbsolutePath());
// or use an image from your media database
var image = plugins.http.getMediaData('media:///yourimage.jpg');
plugins.it2be_tools.setSolutionIcon(image);
setSolutionTitle
void setSolutionTitle( String )
Replace the title in the window frame.Parameters
String title the title
Returns
void
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Replace the title in the window frame.
plugins.it2be_tools.setSolutionTitle(plugins.it2be_tools.client().IP);
sortArray
Array<Object> sortArray( Array<Object> )
Sort the entered array.Parameters
Array<Object> array the array
Returns
Array<Object> array Object[]
Supported Clients
SmartClient, WebClient, NGClient
sortArray
Array<Object> sortArray( Array<Object>, Object )
Sort the entered array.Parameters
Array<Object> array the array
Object value order:String (asc/desc) caseseninsitive:boolean
Returns
Array<Object> array Object[]
Supported Clients
SmartClient, WebClient, NGClient
sortArray
Array<Object> sortArray( Array<Object>, String, Boolean )
Sort the entered array.Parameters
Array<Object> array the array
String order the order
Boolean caseinsensitive the caseinsensitive
Returns
Array<Object> array Object[]
Supported Clients
SmartClient, WebClient, NGClient
startsWith
Boolean startsWith( String, String )
Return true when the string starts with the prefix.Parameters
String value the value
String prefix the prefix
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return true when the string starts with the prefix.
application.output(plugins.it2be_tools.startsWith("filename.csv", ".csv")));
application.output(plugins.it2be_tools.startsWith("filename.csv", "file")));
trim
String trim( String )
Return the string with all leading and trailings spaces removed.Parameters
String value the value
Returns
String result String
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Return the string with all leading and trailings spaces removed.
application.output(plugins.it2be_tools.trim(" input "));
unZip
Boolean unZip( String )
Unzip a zip file and optionally delete the zip file.Parameters
String fileName the file name
Returns
Boolean boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Unzip a zip file and optionally delete the zip file.
// Select a file or folde
var p = plugins.file.showFileOpenDialog();
// when something is selected
if (p) {
//read the file or folder and zip it with extension '.zip'.
//application.output(plugins.it2be_tools.zip(p.getAbsolutePath()));
//read the file or folder and zip it with extension '.zip'.
//and add a boolean when you want to delete the original afterwards.
application.output(plugins.it2be_tools.zip(p.getAbsolutePath(), true));
//read the .zip file and unzip it into the same folder.
application.output(plugins.it2be_tools.unZip(p.getAbsolutePath()));
//read the .zip file and unzip it into the same folder.
//and add a boolean when you want to delete the original afterwards.
//application.output(plugins.it2be_tools.unZip(p.getAbsolutePath(), true));
}
unZip
Boolean unZip( String, Boolean )
Unzip a zip file and optionally delete the zip file.Parameters
String fileName the file name
Boolean delete the delete
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Unzip a zip file and optionally delete the zip file.
// Select a file or folde
var p = plugins.file.showFileOpenDialog();
// when something is selected
if (p) {
//read the file or folder and zip it with extension '.zip'.
//application.output(plugins.it2be_tools.zip(p.getAbsolutePath()));
//read the file or folder and zip it with extension '.zip'.
//and add a boolean when you want to delete the original afterwards.
application.output(plugins.it2be_tools.zip(p.getAbsolutePath(), true));
//read the .zip file and unzip it into the same folder.
application.output(plugins.it2be_tools.unZip(p.getAbsolutePath()));
//read the .zip file and unzip it into the same folder.
//and add a boolean when you want to delete the original afterwards.
//application.output(plugins.it2be_tools.unZip(p.getAbsolutePath(), true));
}
zip
Boolean zip( String, Boolean )
Zip a file or folder and optionally delete the original.Parameters
String fileName the file name
Boolean delete the delete
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Zip a file or folder and optionally delete the original.
// Select a file or folde
var p = plugins.file.showFileOpenDialog();
// when something is selected
if (p) {
//read the file or folder and zip it with extension '.zip'.
//application.output(plugins.it2be_tools.zip(p.getAbsolutePath()));
//read the file or folder and zip it with extension '.zip'.
//and add a boolean when you want to delete the original afterwards.
application.output(plugins.it2be_tools.zip(p.getAbsolutePath(), true));
//read the .zip file and unzip it into the same folder.
application.output(plugins.it2be_tools.unZip(p.getAbsolutePath()));
//read the .zip file and unzip it into the same folder.
//and add a boolean when you want to delete the original afterwards.
//application.output(plugins.it2be_tools.unZip(p.getAbsolutePath(), true));
}
zip
Boolean zip( String )
Zip a file or folder and optionally delete the original.Parameters
String fileName the file name
Returns
Boolean result boolean
Supported Clients
SmartClient, WebClient, NGClient
Sample
// Zip a file or folder and optionally delete the original.
// Select a file or folde
var p = plugins.file.showFileOpenDialog();
// when something is selected
if (p) {
//read the file or folder and zip it with extension '.zip'.
//application.output(plugins.it2be_tools.zip(p.getAbsolutePath()));
//read the file or folder and zip it with extension '.zip'.
//and add a boolean when you want to delete the original afterwards.
application.output(plugins.it2be_tools.zip(p.getAbsolutePath(), true));
//read the .zip file and unzip it into the same folder.
application.output(plugins.it2be_tools.unZip(p.getAbsolutePath()));
//read the .zip file and unzip it into the same folder.
//and add a boolean when you want to delete the original afterwards.
//application.output(plugins.it2be_tools.unZip(p.getAbsolutePath(), true));
}