Properties under jWPS

Object-oriented design Is based on a few fundamental principles. One of the most basic is that there are object which have properties associated with them. So for example, an OS/2 object might not allow copies of itself to be made, or it might not be printable (how would you print your mouse?) Not surprisingly, OS/2 WPS objects have properties. There are two basic ways that one may make properties available. Either have a set and get method for each property (OS/2 uses set/query pairs mostly, but it is the same idea), or have key/value pairs, where the key is usually an integer and the value varies as a property – maybe a string value for a title or logical value to control whether the object can be dragged). The plus with the first method is that is immediately clear which properties are there. The downside is that it does not scale well. Having 200 or so methods to set/get values is a nightmare. The latter method requires very few methods but many keys and a knowledge of what they can do. This is the best that can be done and the onus is then on the documentation to keep it clear.

OS/2 of course used not quite either of these systems, having certain set/get pairs for some properties, key value pairs for others and still an even more opaque system of bit switches for others.

Setting and Getting Properties

There is a single point of access for properties. This is set of methods of the form

setPropertyXXX(int key, <value>)

getPropertyXXX(int key)

Where XXX is the type of the property and <value> is of this type. So for example there are methods named setPropertyString(int key, String value) and as well getPropertyString(int key) etc.. The key constants are defined in JWPConstants. There is a table of them included in this document and that is the reference for the system.

Setup strings

One other way of setting properties exists in OS/2 and this a so-called setup string. You do not need these, although if you are really insistent there is a method supplied to let you set a setup string. If you don't know what these are, there is no reason for you to try and learn them. This is included because there is quite a bit of arcane voodoo involved in creating these and people who are porting their apps to jWPS might have very painstakingly constructed setup strings. These can just be dropped in place and used. 


There are several views whose properties are defines in the views package. If you need a view on an object, you instantiate it like this. This example gets the settings notebook view properties:
      // whatever you need in your program
JWPObject myObject = new JWPObject("some id or file name");
SettingsViewProperties svp = new SettingsViewProperties(myObject);
// let's set this as the default for this object:
// .. drive on ...

Let me stress that these are the properties of the view , not the view itself. For instance the IconViewProperties object has properties for the font, the color of text used by shadow objects and such. In the table are listed the view objects. You might ask if there are there other views