Wednesday, January 1, 2020
[Docs] Welcome
Sunday, October 5, 2008
[Java How-To] #4 "Splash" Screens without a Plugin (Servoy 4)
Description
Because of the excellent support Servoy provides for scripting Java (via Rhino), creating a custom splash screen is a relatively simple scripting task, and you don't need a plugin to do it. All you need instead is a little knowledge of Swing, and enough skill with Photoshop® to create a cool splash image. ;-)
The code below creates a new frame, undecorates it (which is what makes it look like a "splash"), sizes it, shapes it, centers it, adds a graphic and text component from the media library and then displays the newly created frame for a specified period of time. The frame is disposed automatically thereafter.
You don't need to modify this code at all to get it working. Just upload a PNG image named "splash.png" to your Servoy media library, and also upload a simple text document named credits.txt. If you do want to edit this code though you certainly can. An example of doing so might be adding a progress meter or adding a border to the components etc.
If you want to change how long the splash is displayed for, just change the value of application.sleep(...).
Try this! I think you will be surprised at how good it works/looks.
Java Classes Used
For more information about any of the Java classes used, click their corresponding link below.
- javax.swing.border.EmptyBorder
- javax.swing.ImageIcon
- javax.swing.JFrame
- javax.swing.JPanel
- javax.swing.JLabel
- javax.swing.JEditorPane
- java.awt.BorderLayout
- java.awt.Frame
- java.awt.Insets
- java.awt.GraphicsEnvironment
- java.awt.Point
- java.awt.Rectangle
- java.net.URL
Around 50
The Servoy 4 Code
function showSplash()
{
var pkgs = new JavaImporter(Packages.javax.swing.border.EmptyBorder,
Packages.javax.swing.ImageIcon,
Packages.javax.swing.JFrame,
Packages.javax.swing.JPanel,
Packages.javax.swing.JLabel,
Packages.javax.swing.JEditorPane,
java.awt.BorderLayout,
java.awt.Frame,
java.awt.Insets,
java.awt.GraphicsEnvironment,
java.awt.Point,
java.awt.Rectangle,
java.net.URL);
with(pkgs) {
// Create the splash frame and its components
var splash_panel = new JPanel(new BorderLayout(0,0));
var splash_image = new JLabel(new ImageIcon(new URL("media:///splash.png")));
var splash_credits_pane = new JEditorPane(new URL("media:///credits.txt"));
splash_credits_pane.setEditable(false);
splash_credits_pane.setMargin(new Insets(20,20,20,20));
splash_panel.add(splash_image, BorderLayout.CENTER);
splash_panel.add(splash_credits_pane, BorderLayout.SOUTH);
splash_panel.setBorder(new EmptyBorder(0,0,0,0));
var splash_frame = new JFrame();
splash_frame.setUndecorated(true);
splash_frame.getContentPane().add(splash_panel);
splash_frame.pack();
/*
Size/shape and center the splash frame
The bulk of this code was borrowed from a public post on Sun's
Java forum then converted to Servoy/JS.
See: http://forums.sun.com/thread.jspa?threadID=508444
*/
var ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
var center = ge.getCenterPoint();
var bounds = ge.getMaximumWindowBounds();
var w = Math.max(bounds.width/2, Math.min(splash_frame.getWidth(), bounds.width)); // Using JS Math here, not Java Math
var h = Math.max(bounds.height/2, Math.min(splash_frame.getHeight(), bounds.height));
var x = center.x - w/2;
var y = center.y - h/2;
splash_frame.setBounds(x, y, w, h);
if (w == bounds.width && h == bounds.height)
{
splash_frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}
// splash_frame.pack(); Optionally pack here (instead of above) to have the splash resize to shape of image
splash_frame.validate();
splash_frame.show();
application.sleep(3000);
splash_frame.dispose();
}
}
IMPORTANT: Please be advised that you should always backup your Servoy solution before implementing or attempting any of the techniques described in this blog. None of the techniques described are guaranteed to work in any way shape or form, or for any specific purpose. Use them entirely at your own risk.
Sunday, September 7, 2008
[Commentary] ServoyWorld 2008

Wednesday, August 6, 2008
[Commentary] Taking a Short Break from Blogging
Tuesday, June 17, 2008
[Harmless Hacks] Accessing Smart Client's Progress Bar

Servoy client's main application frame is comprised of the usual sorts of Swing components. Some of those swing components are accessible through scripting - via the solution object model (and/or the plugin API) - while others are not. For example the status text (JLabel) in the "statusbar" - the one that usually displays "Ready" - is accessible through scripting while the progress bar (JProgressBar) in the very same "statusbar" is not.
// This code compatible with Servoy 4 only (b/c of the use of JavaImporter)
function accessSmartClientsProgressBar()
{
var SwingGui = new JavaImporter(java.awt);
with (SwingGui)
{
var parentframe = new Frame.getFrames();
}
var contentpane = parentframe[0].getContentPane();
var components = contentpane.getComponents();
var subcomponents = components[0].getComponents();
var statusbarcomponents = subcomponents[1].getComponents();
statusbarcomponents[7].indeterminate = true;
}
Friday, June 13, 2008
[Rhino] JavaImporter
Rhino 1.6r7, the release currently included with Servoy 4, is actually a "minor, bug-fix release," but of course includes all the great new features introduced throughout 1.6rx - meaning to the best of my knowledge - no Rhino features have been disabled by Servoy! Alongside other new features introduced in Rhino 1.6rx such as E4X, a new global constructor known as "JavaImporter" surfaced.
Per the Rhino 1.6r1 change log, "JavaImporter...allows [you] to omit explicit package names when scripting Java." On the surface this may not seem like much of a feature, but in addition to the important technical advantages it provides over older techniques (detailed in the change log), JavaImporter can help to keep your code clean, organized and more readable [when scripting Java].
Have a look at how it is used (borrowed from: http://www.mozilla.org/rhino/rhino16R1.html):
var SwingGui = new JavaImporter(Packages.javax.swing,
Packages.javax.swing.event,
Packages.javax.swing.border,
java.awt.event,
java.awt.Point,
java.awt.Rectangle,
java.awt.Dimension);
...
with (SwingGui) {
var mybutton = new JButton(test);
var mypoint = new Point(10, 10);
var myframe = new JFrame();
...
}
In the above code, the variable SwingGui is assigned the value of JavaImporter, an ImporterTopLevel object, which is subsequently used in a with statement to instantiate classes from packages that were initially passed to the JavaImporter constructor. What you can take from this code is that Java packages can now be easily organized and more easily referenced within your Servoy code. You can assign collections of certain packages to certain variables, giving those variables descriptive names such as "SwingGui," then calling them as necessary. Also, you can easily add packages to the JavaImporter constructor as necessary, and the classes from those packages you add will become available throughout your solution, wherever you have used the variable to which they were assigned.
If you script Java from within your Servoy solutions, give JavaImporter a try.
Thursday, May 8, 2008
[Working with Java Beans] Access Quickbooks from Servoy
Basic installation
- Download the Quickbooks Integrator from http://www.nsoftware.com/
- Install or unzip the files
- Find the file "ibizqb.jar" and copy it to the /servoy/beans" directory
- If you want to access the classes and methods of the bean directly without having to place the bean on your Servoy form, also copy the ibizqb.jar file to "/servoy/lib".
- There is a jar file called "deploy.jar" in the same directory. This is the production version of the bean. When you go live, use this file instead of ibizqb.jar, placing it in the same directories as above. ibizqb.jar is a little larger and contains more debug code.
- The trial version of the bean has a 3-sec delay built in to every call. This will make the communication seem slow. This delay is removed when you purchase a licensed version.
- Quickbooks Remote Connector (allows the bean to talk to Quickbooks over an HTTP connection)
- Install the ibiz Quickbooks Remote Connector on the Windows machine where Quickbooks is installed
- After installation, find the Remote Connector program in your Start menu and launch it
- Start the Remote Connector by clicking on the START button
- Note the network name of the computer where Remote Connector is installed. You'll need this on your Servoy machine to connect
Creating a sample form in Servoy using the ibizqb bean:
- Open blank form and name it "beantest". It can be based on any table at this point. For the sample form, we won't actually write any data to a table
- Create a couple of global variable fields you can use to view data from Quickbooks and place them on this form (gTest1, gTest2)
- Place a button on your form to use to fire the method we'll create that talks to Quickbooks
- Select the button object you just created and double-click the onAction property. Create a new Method called "qbTest" and click OK. We'll get to the editor in a minute to finish the method coding
- Click on the Bean icon on the toolbar. It looks like a little brown coffee bean
- Select "Customer" from the list of available bean objects. Servoy will add an object to the form with a name like "bean_315". You'll need to note this name so you can find it under your form elements node in the Editor
- Click on the Editor icon on the toolbar and the editor will open
- The new method you created above should be open and blank in the editor (qbTest). If not, navigate to -Application/Forms/beantest and click on it, then click the "new method" icon to create a new method on our form and name it "qbTest"
Below, are two versions of qbTest that you can try. Make sure to change the method your button uses for onAction to test out the other method shown below.
Reading from Quickbooks: get a customer (copy and paste the code below into your method)
// substitute the name of your Quickbooks computer name for
elements.bean_115.QBConnectionString = "URL='http://yoda:2080'"
elements.bean_115.openQBConnection
// Set QBRequestId to an empty string or to a unique string every time to make a call to QB.
// You can query QB with QBRequestId to see if your request was accepted, but for now we're not using it
elements.bean_115.QBRequestId = '' // this is two single quotes, representing an empty string
// Look in your existing Quickbooks customer list and find the name of a company to put in here
// this method will retrieve a customer record from QB
elements.bean_115.getByName("My Company")
// Now that we have a customer record, show the contact name on our form to prove it
// Make sure your customer actually has a contact name filled in
globals.gTest1 = elements.bean_115.contactName
Try this out by running your form and clicking on the button. If you have everything right, you should get back your contact name. If nothing happens, you will need to troubleshoot. Look for the following errors:
- Is your firewall blocking port 2080 on the Quickbooks machine?
- Did you START the remote connector on the Quickbooks machine and open Quickbooks?
- Did you locate the name of the Quickbooks computer and put that name in the method above in the QBConnectionString property?
- Does your customer have the contact name field populated with a name in Quickbooks?
Now, let's update a piece of information in Quickbooks and show that we can write to it:
elements.bean_115.QBConnectionString = "URL='http://yoda:2080'"If all went well, you're now talking to Quickbooks from Servoy with only 4-5 lines of code!
elements.bean_115.openQBConnection
elements.bean_115.QBRequestId = ''
elements.bean_115.getByName("My Company")
// Now that we have a customer record, let's change the altphone property in QB
elements.bean_115.altPhone = '999-999-9999'
// Write the record back to QB - WARNING: this will overwrite the Alt Phone field on this record
elements.bean_115.update()
HELP Files
When you unzipped the ibiz files, it should have created a Javadoc directory. Go to this directory and open the file "index.html". In this file you will be able to lookup all the properties and methods for each class available in the bean. There are many object types you can work with in Quickbooks (i.e. payments, invoices, customers, etc) All are documented in Javadoc.
In our next article, I will describe how to utilize the ibizqb.jar objects directly, without having to use a bean on a form. This will allow you to create multiple instances of each object and put them into arrays, allowing you to do things like hold all customers in memory at once, instead of reading them one at a time.
Friday, April 4, 2008
[Java Plug-In Development] How to Add Your Own Column Validators and Column Converters with the Plug-In API
Column Validation
Servoy has several built-in validators that are included in the default_validators.jar plugin that ships with Servoy. In addition, I have a free plugin at Servoy Guy: Validator Pro. However, you may want to use the Java Plugin-API to add your own items to that list, so here we go...- Make a new class, lets call it ValidatorPlugin.java and have the class implement IClientPlugin, and IColumnValidatorProvider. (com.servoy.j2db.plugins.IColumnValidatorProvider)
- If you have eclipse automatically include the required methods from those classes, you'll have a few methods you'll need to implement. Most are self-explanatory, but the main one is "public IColumnValidators[] getColumnValidators()". That method needs to return back an array of classes that implement IColumnValidator. So, onto our next class...
- Make a new class, lets call it MyValidator.java, and have the class implement IColumnValidator. (com.servoy.j2db.dataprocessing.IColumnValidator) Again, if you have eclipse move in the required methods, you'll see several to implement
- First, there is "Public Map getDefaultProperties()". This needs to return back a Map of properties that will be shown to the user when they choose this validator. For example, the servoy.SizeValidator shows "length" as a property. So, here you can have it return back the properties you want the user to be able to input
- Second, there is "public String getName()". This returns back the name that shows up in the validator. So that your validator doesn't conflict with any others use a notation like companyName.validatorname.
- Third, there is "public in[] getSupportedColumnTypes()". This returns back an array representing the different column types that this validator can be used on, like TEXT, INTEGER, NUMBER, etc. To get those integers you can use com.servoy.j2db.persistence.IColumnTypes . For example com.servoy.j2db.persistence.IColumnTypes.TEXT
- Finally we get to the meat of this class. There is "public void validate(Map props, Object arg) throws IllegalArgumentException". This passes in the a Map as the props variable which allows you to know what properties the user entered for those available properties. It also passes in arg as an Object, which represents the value in the column being validated. Here is where you'll put you own business logic to determine if the input is valid. If it isn't valid you must throw an IllegalArgumentException
- So, now lets go back to our ValidatorPlugin.java class, and have it return back a new set array, like "return new IColumnValidator[]{MyValidator}
Column Conversion
- Make a new class, lets call it ColumnConverterPlugin.java and have the class implement IClientPlugin and IColumnConverterProvider. (com.servoy.j2db.plugins.IColumnConverterProvider)
- You'll now need to implement "public IColumnConverter[] getColumnConverters()". Just like before, this needs to return back an array of objects, but this time they are IColumnConverter classes.
- So make a new class, lets call it MyColumnConverter.java, and have it implement IColumnConverter (com.servoy.j2db.dataprocessing.IColumnConverter)
- First, there is "Public Map getDefaultProperties()". This needs to return back a Map of properties that will be shown to the user when they choose this validator. For example, the StringSerializer shows "length" as a property. So, here you can have it return back the properties you want the user to be able to input.
- Second, there is "public String getName()". This returns back the name that shows up in the converter. So that your validator doesn't conflict with any others use a notation like companyName.convertername.
- Third, there is "public in[] getSupportedColumnTypes()". This returns back an array representing the different column types that this converter can be used on, like TEXT, INTEGER, NUMBER, etc. To get those integers you can use com.servoy.j2db.persistence.IColumnTypes . For example com.servoy.j2db.persistence.IColumnTypes.TEXT
- Next, there are 2 methods that do the bulk of the work...
- "public Object convertFromObject(Map props, int columnType, Object obj)": passes in the properties that the user defined, an integer representing the column type, and an object representing the value of the data in the column. Here you can write your own business logic to determine what you want returned back to convertFromObject.
- "public Object convertToObject(Map props, int columnType, Object obj)": passes in the properties that the user defined, an integer representing the column type, and an object representing the value of the data in the column. Here you can write your own business logic to determine what you want returned back to convertToObject.
- Finally, lets go back to our ColumnConverterPlugin.java class. Our getColumnConverters needs to return back our converter class. Such as "return new IColumnConverter[]{new MyColumnConverter.java}". In your example, you may choose to return back a new array of IColumnConverter objects, or just return back a static set stored in a variable.
Wednesday, March 5, 2008
[Java How To] #3 Creating MD5 Hashes Without a Plugin
A PDF version of this post, which includes a code walkthru, is available here
Java How-To's are intended to provide real-world examples of how Java can be used to easily extend Servoy in useful ways. I will try to post a new one as often as possible.
Description
If you thought you needed a plugin to create MD5 hashes, think again. Because Servoy has such great support for Java, you can actually create MD5 hashes without using a plugin, by simply embedding some Java code directly within your Servoy method.
Java Classes Used
For more information about any of the Java classes used, click their corresponding link below.
Total Lines of Code
20 or so
The Servoy Code
var string_to_hash = 'Hello World!';
// Get an array of bytes from the input string
var in_array = Array(string_to_hash.length);
var in_char;
for (var i = 0; i < in_char =" string_to_hash.slice(i,i+1)" inbytearray =" new" i =" 0;" md =" Packages.java.security.MessageDigest.getInstance(" md5_bytearray =" md.digest(in_array);" md5_hash =" '';//empty" md5_array =" new" i =" 0;"> 2) {
// Take right most 2 chars
md5_array[i] = md5_array[i].substr(md5_array[i].length - 2, 2);
}
if ((md5_byteArray[i] >= 0 ) && (md5_byteArray[i] <= 15)) { // Pre-pend a '0' since the hex to string fails to do so - typical to forget! md5_array[i] = '0' + md5_array[i]; } md5_hash += md5_array[i];//concatenate } return md5_hash;
In Summary
That's it! Creating MD5 hashes without a plugin. Please post any questions or comments you may have to the blog.
IMPORTANT: Please be advised that you should always backup your Servoy solution before implementing or attempting any of the techniques described in this blog. None of the techniques described are guaranteed to work in any way shape or form, or for any specific purpose. Use them entirely at your own risk.
[Harmless Hacks] Hacking Servoy's Frame Title & Icon
This post is only available in PDF format. You can download it here.
Have you ever wanted to change the title or the icon image when you deploy your Servoy solution?
In this blog post I will show you how it can be done using some Java knowledge...
The Servoy Code
//2008.March.01
/*
Sets the top level window title and/or icon.
Author: T. Parry, Prospect IT Consulting Inc, venture@compmore.net
Ensure this is called after servoy has finished messing with the title.
Default image is/was greek letter psi: 'd:/temp/icons/images/Math/psi.gif';
Default title is/was: 'IT Service & Support Toolkit by Prospect IT Consulting'
The place where it is best to use this is...
*/
var myTitle = null;//no change
var myIconImageLoc = null;//no change
if (arguments && (arguments.length > 0)) {
if ( arguments[0] ) {
myTitle = arguments[0];
}
if (arguments[1]) {
var myIconImageLoc = arguments[1];
}
var frames = Packages.java.awt.Frame.getFrames();
if (myTitle) {
var prevTitle = frames[0].getTitle();//save it or do something with it
frames[0].setTitle(myTitle);// [0] is the top most frame - set a new title
}
if (myIconImageLoc) {
//var myIconImage = new Packages.java.awt.image.BufferedImage;
var kit = new Packages.java.awt.Toolkit.getDefaultToolkit();
var imageToUse = kit.getImage(myIconImageLoc);
frames[0].setIconImage(imageToUse);
}
}//if arguments
return;
The Servoy Code (Using an Image From the Media Library)
frames[0].setIconImage(new Packages.javax.swing.ImageIcon(new Packages.java.net.URL("media:///my_image.gif")).getImage());
IMPORTANT: Please be advised that you should always backup your Servoy solution before implementing or attempting any of the techniques described in this blog. None of the techniques described are guaranteed to work in any way shape or form, or for any specific purpose. Use them entirely at your own risk.
Tuesday, February 19, 2008
[Java How-To] #2 Writing XML Without a Plugin
Description
If you thought you needed a plugin to write XML, think again. Because Servoy has such great support for Java, you can actually write XML documents without using a plugin, by simply embedding some Java code directly within your Servoy methods. The amount of code it takes to create an XML document complete with processing instructions, attributes and comments is minimal, and is shown below...
By the way...Servoy 4 (from what I have heard) introduces the ability to write XML documents without having to script any Java *or* use a plugin :-) To learn more about that, read up on Rhino (1.6 or greater).
Java Classes Used
For more information about any of the Java classes used, click their corresponding link below.
- javax.xml.parsers.DocumentBuilder
- javax.xml.parsers.DocumentBuilderFactory
- org.w3c.dom.Document
- org.w3c.dom.Element
- javax.xml.transform.TransformerFactory
- javax.xml.transform.dom.DOMSource
- java.io.StringWriter
- javax.xml.transform.stream.StreamResult
Less than 15
The Servoy Code (Creating an XML Document)
var document_builder_factory = Packages.javax.xml.parsers.DocumentBuilderFactory.newInstance();
var document_builder = document_builder_factory.newDocumentBuilder();
// Create document
var doc = document_builder.newDocument(); // Doc is an object
// Create and append a processing instruction
var processing_instruction = doc.createProcessingInstruction("xml-stylesheet", "type=\"text/css\" href=\"http://www.domain.tld/style.css\" media=\"all\"");
doc.appendChild(processing_instruction);
// Create root element and append to document
var root_element = doc.createElement("root");
doc.appendChild(root_element);
// Insert a comment in front of the root element
var comment = doc.createComment("I am a comment");
doc.insertBefore(comment, root_element);
// Create a child element ("child1") of the root element
var child_element1 = doc.createElement("child1");
root_element.appendChild(child_element1);
// Create an attribute for child element1
child_element1.setAttribute("attr", "value");
// Add a text node to child_element1
child_element1.appendChild(doc.createTextNode("Child 1"));
The Servoy Code (Writing Your XML Document out to a String)
var transformer_factory = new Packages.javax.xml.transform.TransformerFactory.newInstance();
var transformer = transformer_factory.newTransformer();
var dom_source = new Packages.javax.xml.transform.dom.DOMSource(doc); // Pass in your document object here
var string_writer = new Packages.java.io.StringWriter();
var stream_result = new Packages.javax.xml.transform.stream.StreamResult(string_writer);
transformer.transform(dom_source, stream_result);
var xml_string = string_writer.toString(); // At this point you could use the Servoy XMLReader plugin to read your XML String.
application.output(xml_string);
In Summary
That's it! Writing XML without a plugin. Please post any questions or comments you may have to the blog.
IMPORTANT: Please be advised that you should always backup your Servoy solution before implementing or attempting any of the techniques described in this blog. None of the techniques described are guaranteed to work in any way shape or form, or for any specific purpose. Use them entirely at your own risk.
Monday, February 18, 2008
[Eclipse] Finding an Eclipse Plugin
A PDF version of this post, complete with screenshots, is available here.
One of the issues I had with learning eclipse early on was the frustration of finding all those dependent plugins that were prerequisites for the plugin I wanted to load. First I would find the dependent plugin, load it then load my new plugin only to find another dependency showing up.
Then I stumbled on the update manager and life is far easier now! (Although you can still do the installation the tedious way if you really have to.)
Instead of downloading the files from the supplier site and installing them yourself to the correct eclipse plugins directory use the update approach instead.
The update approach works for most plugins that I have encountered so far. Here is the way that it works:
From the eclipse Help menu select "Software Updates" then "Find and Install". A dialog pops up with a choice of "Search for updates of the currently installed features" or "Search for new features to install". The latter is the choice that you want.
Now a dialog pops up (“Update sites to visit”) with a list of check boxes for features and various buttons. In your case click on the "New Remote Site...". In the next dialog enter some name by which you want to remember the site such as "Omnesoft", and enter the url on the next line.
For example, I know Jeff wanted to use an obfuscator plugin so enter "Obfuscate" for the name. For the url you should open your browser to the site of the plugin provider and search for the eclipse plugin update url. In his case he first chose http://obfuscate4e.partmaster.de/download.
However, this gives rise to errors if you continue. Digging deeper into the site you will find the correct url as follows:
http://obfuscate4e.partmaster.de/updates.
This is the url specifically for the eclipse update manager to use.
Clicking OK closes this dialog and returns you to the “Update sites to visit” dialog. The site that you have entered now shows up with a check box beside it.
Having entered the info for the new remote site you still do not know if there are dependencies for the new plugin (unless you were really diligent and actually read the new plugin site for instructions!).
Now click on the finish button to go to the next stage. At this point the manager is merely searching for the "updates" and "new" plugins.
Now the “Search Results” dialog pops up. It actually shows you the results of the search, amazing! Of course you might get the error message if you site url is incorrect. Now check the box beside the Obfuscate to indicate that you want this to be installed. (If you expand the selection you can find all the components that are in the selection).
Here is where the manager shines: click on the "Select Required" button to allow it to search for dependencies and populate the list of features with those others, if any. You should get into the habit of clicking on this button to save some aggravation later! You may or may not see additional features to be installed. You may have already installed some pre-requisite plugins from an earlier feature install.
One last bit of setup: click next to accept the license terms (or abandon if it is not for you!) in the new dialog box “Feature License”.
Click next again to finally get to the “Installation” dialog. Wow that is a l ot of setup. Now you see a list of the features and their description that have been selected for installation. Usually the default installation location is ok, but you can can change it if you know the consequences. (Meaning that you have some advanced knowledge that has been painfully extricated from the various help guides).
One last click of the “Finish” button and ...oops you may get a “Duplicate Conflicts” detection dialog popup. This really means that some version of a plugin already uses a version of a plugin and there might be two versions. Well now is where your risk taking part of your brain starts to vacillate. (In other words do a backup of your entire eclipse directory structure if you are unsure in case the warning really does kill the eclipse setup!). Being bold we continue anyway...
So the “Update Manager” windows appears and starts to initialize but whoa...another warning pops up! My goodness who wrote all this paranoia code? Well I for one appreciate the warnings so I can make an, ahem, informed decision.
A “Feature Verification” dialog pops up and is requesting you to make yet another commitment. I typically just click the “Install All” button because I get fed up reading all the warnings from all the dependent features! Well I do live dangerously.
Assuming all goes well the last dialog asks if it can restart eclipse for the changes to take effect. So this is it. Might as well continue and take the plunge and test it...restart it is.
So by the time eclipse shuts down and restarts your fourth coffee is now cold. Go and check that the feature you have installed is installed properly. Since there are many types of plugins you will have to do that part on your own.
Good luck now.
“Rolling your own”.
For those wanting to install their own plugins into the eclipse directory and then find that a plugin is still missing from another source then follow these steps.
On the eclipse web site for plugins do a search for the missing plugin.
Try this central site first and choose a secondary site that best suits your needs.:
http://www.eclipse.org/community/pluginsites.php
Read the instructions for this missing plugin/feature in case it too has dependents that have to be loaded. For example Matisse, the GUI designer for Java, has three or more plugins for it to run properly.
Jeff's problem: (finally!)
Searching for documentation on eclipse plugins is somewhat tedious. When I started searching for “org.eclipse.pde” under plugins it failed, so I tried “pde” by itself and got some answers but they did not stem to be a good match. Digging around a bit more I thought I would see if it was a project under eclipse and found:
This has a good description of the project. PDE is the “Plug-in Development Environment“ for those wishing to make plugins for eclipse. There you can find that it is comprised of two components itself.
Note that this statement:
“PDE is built atop the Platform and JDT, and ships as part of the Eclipse SDK. “ indicates that pde should have been installed with the original eclipse install but perhaps there was something not quite right about the initial installation so you might want to revisit that to ensure that pde is already there or not.
By searching for a list of projects I did find the PDE project itself and the download here:
http://www.eclipse.org/projects/project_summary.php?projectid=eclipse.pde
I hope that this is not TMI (too much information).
Regards,
Tom
Monday, February 11, 2008
[Docs] Eclipse QuickStart for Servoy Developers
Wednesday, January 30, 2008
[Java How-To] #1 FTP Without a Plugin
Description
If you thought you needed a plugin for FTP, think again. Because Servoy has such great support for Java, you can actually perform FTP functions without using a plugin, by simply embedding some Java code directly within your Servoy methods. The amount of code it takes to create an FTP client, and perform a non-secure FTP GET or PUT action [for example] is minimal, and is shown below...
Java Classes Used
For more information about any of the Java classes used, click their corresponding link below.
- sun.net.ftp.FtpClient*
- java.io.BufferedInputStream
- java.io.FileOutputStream
- java.io.FileInputStream
- java.io.BufferedOutputStream
- java.lang.reflect.Array
Less than 20
The Servoy Code (GET)
var FTPClient = new Packages.sun.net.ftp.FtpClient();
FTPClient.openServer("myserver.com");
FTPClient.login("usrname", "password");
FTPClient.binary();
//FTPClient.cd();
var buffered_input_stream = new Packages.java.io.BufferedInputStream(FTPClient.get("myfile.txt"));
var output_stream = new Packages.java.io.FileOutputStream("/save/path/myfile.txt");
buffered_output_stream = new Packages.java.io.BufferedOutputStream(output_stream);
var buffer = new Packages.java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024);
var read_count = 0;
while((read_count = buffered_input_stream.read(buffer)) > 0)
{
buffered_output_stream.write(buffer, 0, read_count);
}
buffered_output_stream.close();
FTPClient.closeServer();
The Servoy Code (PUT)
var FTPClient = new Packages.sun.net.ftp.FtpClient();
FTPClient.openServer("myserver.com");
FTPClient.login("usrname", "password");
FTPClient.binary();
//FTPClient.cd();
var write_count = 0;
var bytes_in = new Packages.java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024);
var file_input_stream = new Packages.java.io.FileInputStream("/Local/file/path/foo.gif");
var buffered_output_stream = new Packages.java.io.BufferedOutputStream(FTPClient.put("/Remote/file/path/foo.gif"));
while ((write_count = file_input_stream.read(bytes_in)) >= 0) {
buffered_output_stream.write(bytes_in, 0, write_count);
}
file_input_stream.close();
buffered_output_stream.close();
FTPClient.closeServer();
In Summary
That's it! FTP without a plugin. If you would like to see the code for other FTP functions, drop a comment on the blog.
* The classes that Sun includes with the Java 2 SDK, Standard Edition, fall into package groups java.*, javax.*, org.* and sun.*. All but the sun.* packages are a standard part of the Java platform and will be supported into the future. In general, packages such as sun.*, that are outside of the Java platform, can be different across OS platforms (Solaris, Windows, Linux, Macintosh, etc.) and can change at any time without notice with SDK versions (1.2, 1.2.1, 1.2.3, etc).
IMPORTANT: Please be advised that you should always backup your Servoy solution before implementing or attempting any of the techniques described in this blog. None of the techniques described are guaranteed to work in any way shape or form, or for any specific purpose. Use them entirely at your own risk.
Friday, January 18, 2008
[Misc] 150 Downloads from 20 Countries!

Wednesday, January 2, 2008
[Commentary] Hidden Tasty Goodness
I don't think that functionality is necessarily "hidden" - but it's also not completely obvious, either. We do state all over the place that you can write Java in Servoy - but we don't tell you "how" to do it. That's really not our place as a tool developer.
There are excellent resources available (a lot of them are outline in the paper) - and it just takes a little playing around to familiarize yourself with how stuff works.
I'm not a Java programmer - never even read a book - but I was able to follow Jeff's tutorial and get some basic Java working. There are TONS of things you can do in Java - and the best part is - chances are good that someone else already has!
There is loads of Java code all over the Internet that you can use as reference, as well as hundreds of beans and applets that will make your Servoy experience as advanced as you want to make it.
So - go ahead - try it out. You'll be glad you did.
Bob Cusick
Servoy USA
