System, method and article of manufacture for type checking appropriateness of port connection and variable type matching in connection with multiport object-oriented components5790855Abstract Method, system and article of manufacture for connecting multiport object oriented components for use in an object oriented based applet or application. The component's ports are all polled to determine if a connection to any one of them has been initiated or ended. Port and variable information is stored and updated as connections are made or broken. If a connection is made, the type and suitability of the ports involved is checked as is the type and suitability of the variable they are to respectively transmit or accept. If the ports and/or the variable are mismatched, the intended connection is prevented and an error message to that effect is posted. If the ports and/or the variable are suitable, the intended connection is permitted and the stored port and variable information updated accordingly. Claims What is claimed is: Description COPYRIGHT NOTIFICATION
______________________________________
importjava.awt.*;
public class VJNetPin extends VJNode {
// Attributes of this component
static int instanceCount = 0
static Image normalImage;
static Image selectedImage;
final static String out = "out_np.gif";
final static String in = "in_np.gif";
final static String port0_info = "input or output and object";
final static String port0_name = "Pin 0";
final static String url_name = "netpin.html";
final static String info_name = "Connects components inside a
container to a pin of the container";
VJ vj;
netpinEditor edit=null;
VJContainer theContainer;
boolean connected = false;
boolean requested = false;
int theLocation;
int requestTime = 0;
int theConnection = -1;
//Constructor
public VJNetPin(VJ v){
super(v);
vj = v;
VJNode dup( ) {
returnnull;
}
public static void getImages(GlFFactoryf){
normalImage = f.GetGIF(out);
selectedImage = f.GetGIF(in);
}
public void setContainer(VJContainerc){
theContainer = c;
}
public void setConnection(int c) {
theConnection = c;
}
// ComponentInitialization
public void VJNetPinInit(intx_pt, int y_pt){
try{
setNormalIcon(out);
setSelectedIcon(in);
setName("VJNetPin");
setComponent(null);
setComponentURL(url.sub.-- name);
setComponenfInfo(info.sub.-- name);
VJNodeInit(false,x_pt,y_pt,false);
addPort(port0_info,port0_name,VJPort.InputOutput,VJPort.SouthCente
r); //Pin 0
setImages(normalImage,selectedImage); //Pass references to the
static images down to the node
nodeRect = new Rectangle(x_pt-3,y_pt-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp_w)+3,selectedI
mage.getHeight(vj.theContainer.theDesktop.vp_w)+3);
} catch(Exception e) {
System.out.println(e);
}
}
public int componentID( ){return 6;}
public void disconnecting(int port) {
connected = false;
}
public void connecting(int port) {
connected = true;
if(requested) {
vj.request(0,requestTime,this);
requested = false;
}
}
public void load(String s)
}
public String save( ) {
return ""; }
public void reset( ) { }
public void request(int port,int time) {
// what if theConnection <0?
theContainer.requestOUT(theConnection,time);
}
public void requestIN(int time) {
if(connected)vj.request(0,time,this);
else {requestTime = time; requested = true; }
}
public void set(Object o,int port,int time) {
if(theConnection>=0)
theContainer.setOUT(o,theConnection,time);
//vj.request(0,request_index0++,this);
}
public void setIN(Object o,int time) {
vj.set(o,0,time,this);
}
public void propertiesEditor( ) {
if(edit==null){
edit = new netpinEditor((Frame)(vj.theFrame),this);
edit.pack( );
edit.show( );
}
}
public void init( ){ };
public void start( ){ };
public void stop( ){ };
public void destroy( ){ };
}
class netpinEditor extends Frame
{
VJNetPin vjc;
TextField tf;
Button b;
Button cancel;
public netpinEditor(Frame parent,VJNetPin c)
}
super("Pin Editor");
setLayout(new BorderLayout( ));
add("North",new Label("Select a pin"));
vjc = c
tf = new TextField(new Integer(vjc.theLocation).toString( ));
add("Center",tf);
b = new Button("OK");
cancel = new Button("Cancel");
Panel sp = new Panel( );
sp.add(b);
sp.add(cancel);
add("South",sp);
}
public boolean handleEvent(Event evt)
{ // System.out.println(evt.toString( ));
switch(evt.id){
case Event.ACTION_EVENT:
{
if("OK".equals(evt.arg))
{
vjc.theLocation =
(Integer.valueOf(tf.getText( ))).intValue( );
//vjc.theContainer.addNewPort(vjc,"fred","jim");
vjc.edit = null;
dispose( );
return true;
}
if("Cancel".equals(evt.arg))
{ vjc.edit = null;
dispose( );
return true;
}
return false;
}
default:
return false;
}
}
}
______________________________________
FIG. 10 shows the two pin capability of scrollbar 604b. Note that each of the pins 902 and 904 are diamond shaped or two way ports. If a value if placed on these ports, it sets the scrollbar to that level. Conversely, if a value is taken from one of these ports, it reflects the position of scrollbar 604b. In practice, the two way or bidirectional ports are first initialized to their two way state. The ports can then function either as an input port or as an output port depending solely on the way they are used. Each bidirectional port is provided with bidirectional capability by having a send message method defined for all outgoing transactions and a receive message method defined for all incoming transactions in the component for each bidirectional port. Thus, the method corresponding to the direction is invoked based on the flow of the message through the port. For example, if inputs are connected to the two-way ports 904a or 904b in FIG. 10, they would function as input ports. Two-way port 906 would then function as the output port since it is the only port left that could serve in that role. In the preferred arrangement, components set themselves internally to reflect the status of each of their bidirectional ports, in accordance with the way they are being used. The bidirectional ports permit greater connective flexibility and save screen real estate as well. When a connection to another component is completed, the connecting component sends a message to the component at the other end of the connection indicating how its connecting port is set, input or output. The message receiving component then makes sure that its connection participating port is set accordingly. If the message receiving component's port is bidirectional, the port is set opposite to the status of the first connected port. If the message receiving component's connecting port is bidirectional, that port is set opposite to the status of the first connected port. If the message receiving component's port is unidirectional and as such is in conflict with the status of the first connected port, that is, it is set to "output" when the first connected port is also set to "output", the connection is prohibited and an appropriate error message is displayed. FIG. 11 illustrates the addition of a second vertical scrollbar that will be set to track the range of the Fahrenheit temperature scale. Note that the vertical scrollbar editor 1104 has been adjusted to set scrollbar 1102 to a maximum value of 212 (boiling point) and a minimum value of 32 (freezing point). Prior to being adjusted, scrollbar 1102 has a current value of 71 with only 10 units of its total range actually visible. Dynamic editing is accomplished by providing each component that would have need of an editor with that capability as an integral part of the class template from which it is instantiated. Each customizer window or editor is defined in predetermined class templates as a method corresponding to the customizer method. Thus, when such edit capable components are instantiated in either the logical view 402 or the physical view 500, their built-in customizer or edit widow 1104 is invoked, see FIG. 11, and opens automatically. The editor appears in the view ready for use to change or customize the properties of the component, in this case scrollbar 604b, based on user interaction with the customizer or editing window 1104. As shown in the flowchart of FIG. 11A, editor capability is added at block 1120 to each class template for which an editing capability is desired in component objects instantiated therefrom. An editing window, as indicated by block 1122 is defined as a method corresponding to the editor. The properties and their limits are also defined for each component editor as shown by block 1124. An editing window is opened by block 1126 when the component with which it is associated is dragged and dropped or instantiated for use. After the user finishes editing the component's properties and clicks "OK", the editing window is closed and the property changes are accepted and displayed immediately in the appropriate view by block 1128. After property editing is completed, the editable components are monitored for a user action (usually a mouse click) which indicates that property re-editing is desired for a specific component, as per block 1130. When that occurs, block 1132 opens the editor widow 1104 again to permit component property changes to be made. Thereafter, control is returned to block 1128 and the user re-editing changes are accepted. Finally, monitoring of the editable components resumes as per block 1130. It is important to note that the user is not required to take any action to invoke an editor or be concerned about the suitability or appropriateness of the editor with respect to the component being customized. Moreover, the editor is customized for the specific component with which it is associated. If an editor appears when a component is instantiated, then the user instantaneously knows that that particular component is customizable. In addition, the user sees and knows just which properties of the component are editable and to what limits. Further, the user can make any desired customizing changes without having to write any code to implement those changes. Other uses of a component editor are shown in FIGS. 12 and 15. FIG. 12 shows how VJ Tool is utilized to add text to scrollbars 604b and 1102 so that the function they perform or represent can be labeled and thereby identified to any user. First, the simple text field component 506 is invoked by clicking on its icon and dragging it onto the physical view 500. The text field representation 1202 can then be dropped at any desired location and, as desired, sized to match the element it will identify, in this case scrollbar 604b. The text field or label editor 1204 is then used to generate the actual text or scrollbar label. The label text field component is coded as follows:
______________________________________
import java.awt.*;
import java.util.*;
public class VJLabel extends VJNode {
// Attributes of this component
public AWTLabel label;
static int instanceCount = 0;
labelEditor edit;
static Image normalImage;
static Image selectedImage;
final static String out = "out.sub.-- 1a.gif";
final static String in = "in.sub.-- 1a.gif";
final static String port0.sub.-- info = "for setting the text";
final static String port0.sub.-- name = "Pin 0";
final static String url.sub.-- name = "label.html";
final static String info.sub.-- name = "A simple AWT label";
VJ vj;
int send.sub.-- index=0;
int request0.sub.-- index=0;
// Constructor
public VJLabel(VJ v){
super(v);
vj = v;
VJNode dup( ) {
VJLabel vj.sub.-- comp = new VJLabel(vj);
try{
int i = x+40;
int j = y+40;
AWTLabel 1 = new AWTLabel(label.getText( ),vj.sub.-- comp);
vj.sub.-- comp.label = 1;
vj.sub.-- comp.setNormalIcon(out);
vj.sub.-- comp.setSelectedIcon(in);
vj.sub.-- comp.setName(label.getText( ));
vj.sub.-- comp.setComponent((Component)1);
vj.sub.-- comp.setComponentURL(url.sub.-- name);
vj.sub.-- comp.setComponentInfo(info.sub.-- name);
vj.sub.-- comp.VJNodeInit(false,i,j,true);
vj.sub.-- comp.addPort(port0.sub.-- info,port0.sub.-- name,VJPort.Input,VJ
Port.NorthCe
nter); // Pin 0
vj.sub.-- comp.setXPt(0,getXPt(0)+40);
vj.sub.-- comp.setYPt(0,getYPt(0)+40);
vj.sub.-- comp.setImages(normalImage,selectedImage); // Pass
references
to the static images down to the node
vj.sub.-- comp.nodeRect = new Rectangle(i-3,j-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,selecte
2
dImage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
vj.sub.-- comp.setSelected(true);
vj.theDocument.add(vj.sub.-- comp.comp);
vj.sub.-- comp.comp.validate( );
vj.sub.-- comp.comp.reshape(comp.bounds( ).x+50,comp.bounds( ).y+50,comp
.bounds( ).width,comp.bounds( ).height);
vj.sub.-- comp.comp.show( );
return vj.sub.-- comp;
} catch(Exception e) {
System.out.println(e);
return null;
}
}
public static void getImages(GIFFactory f){
normalImage = f.GetGIF(out);
selectedImage = f.GetGIF(in);
}
// Component Initialization
public void VJLabelInit(int x.sub.-- pt, int y.sub.-- pt) {
try{
String theText = new String("Label
"+String.valueOf(instanceCount++));
label = new AWTLabel(theText,this);
label.setFont(new Font("Courier", Font.PLAIN, 14));
setNormalIcon(out);
setSelectedIcon(in);
setName(theText);
setComponent((Component)label);
setComponentURL(url.sub.-- name);
setComponentInfo(info.sub.-- name);
VJNodeInit(false,x.sub.-- pt,y.sub.-- pt,true);
addPort(port0.sub.-- info,port0.sub.-- name,VJPort.Input,VJPort.NorthCen
ter);
// Pin0
setImages(normalImage,selectedImage); //Pass references to the
static images down to the node
nodeRect = new Rectangle(x.sub.-- pt-3,y.sub.-- pt-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,selecte
.
dImage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
} catch(Exception e) {
System.out.println(e);
}
}
public void request(int port,int time) { }
public int componentID( ) { return 2; }
public void load(String s) {
}
public String save( ) {
return "";}
public void disconnecting(int port) {
switch(port){
case 0: request0.sub.-- index= -1;
break;
}
}
public void connecting(int port) {
switch(port){
case 0: request0.sub.-- index=0;
vj.request(0,request0.sub.-- index++,this);
break;
}
}
public void set(Object o,int port,int time) {
boolean ok = false;
if(o instanceof Color) { label.setForeground((Color)o); ok=true; }
if(o instanceof String) { label.setText((String)o); ok =true;}
if(o instanceof Long) {
label.setText((String)(((Long)o).toString( ))); ok = true;}
if(o instanceof Double) {
label.setText((String)(((Double)o).toString( ))); ok = true;}
if(o instanceof Float) {
label.setText((String)(((Float)o).toString())); ok = true;}
if(o instanceof Integer) {
label.setText((String)(((Integer)o).toString( ))); ok = true;}
if(o instanceof Boolean) {
label.setText((String)(((Boolean)o).toString( )));ok = true; }
if(ok) {
//System.out.println(name + "has input at"+
String.valueOf(time)+ "="+ getText( ));
if(time<199)vj.request(0,request0.sub.-- index++,this);
}
ok = false;
}
public boolean handleEvent(Event e) {
return false;
{
public void propertiesEditor( ) {
if(edit==null){
edit = new labelEditor((Frame)(vj.theFrame),this);
edit.pack( );
//edit.resize(12*32,6*32);
edit.show( );
}
}
public void init( ){ };
public void start( ){ };
public void stop( ){ };
public void destroy( ){ };
} // end class VJLabel
class labelEditor extends Frame
{
VJLabel vjl;
TextField tf;
Button ok;
Button cancel;
boolean dirty;
public labelEditor (Frame parent,VJLabel 1)
{
super("Label Editor");
setLayout(new BorderLayout( ));
vjl =1;
tf = new TextField(vjl.label.getText( ));
add("Center",tf);
ok = new Button("OK");
cancel = new Button("Cancel");
Panel sp = new Panel( );
sp.add(ok);
sp.add(cancel);
add("South",sp);
}
public boolean handleEvent(Event evt)
{ // System.out.println(evt.toString( ));
switch(evt.id){
case Event.ACTION.sub.-- EVENT:
{
if("OK".equals(evt.arg))
{
vjl.label.setText(tf.getText( ));
vjl.edit null;
dispose( );
return true;
}
if("Cancel".equals(evt.arg))
{ vjl.edit null;
dispose( );
return true;
}
return false;
}
default:
return false;
}
}
}
______________________________________
As shown in FIG. 13, text field 1202 has been made into the "CENTIGRADE" label 1202a above scrollbar 604b through use of the text field editor 1204. Label "FAHRENHEIT" 1302 has been generated in the same manner and positioned above scrollbar 1102 (not shown in FIG. 13). It should be noted that several of the components described herein, vertical scrollbars 604a and 604b and text field 1202 label editor, are provided with their own editors, vertical scrollbar editor 604 and label editor 1204, which permits the predefined properties of the associated components to be directly and dynamically edited. Such editing takes place without the user having to exit VJ Tool or having to write any code to support the desired editorial changes. FIG. 13 also illustrates in logical view 402, representations of scrollbars, text and bicopy objects that will be used to functionally link scrollbars 604b and 1102. Objects 1306 and 1312 logically represent scroll bars 604b and 1102 while label objects 1304 and 1310 represent the labels 1202a and 1302 respectively. Bicopy is a backend component that is only found in the logical view palette. A bicopy object, such as 1308 and 1314, as implemented in accordance with a preferred embodiment of the present invention, will place whatever is input on one of its diamond shaped I/O pins 1308a, 1308b, 1308c or 1398d on the other I/O pins. Bicopy, which functions like a multiplexor, is coded as follows:
______________________________________
import java.awt.*;
import java.util.*;
public class VJBiCopy extends VJNode {
/ / Attributes of this component
static int instanceCount = 0;
static Image normalImage;
static Image selectedImage;
final static String out.sub.-- bi = "out.sub.-- bi.gif";
final static String in.sub.-- bi = "in.sub.-- bi.gif";
final static String port0.sub.-- info = "Pin 0";
final static String port0.sub.-- name = "Pin 0";
final static String port1.sub.-- info = "Pin 1";
final static String port1.sub.-- name = "Pin 1";
final static String port2.sub.-- info = "Pin 2";
final static String port2.sub.-- name = "Pin 2";
final static String port3.sub.-- info = "Pin 3";
final static String port3.sub.-- name = "Pin 3";
final static String url.sub.-- name = "bicopy.html";
final static String info.sub.-- name = "Whatever is input on one pin is
output
on the others";
VJ vj;
int send.sub.-- index0 = -1;
int send.sub.-- index1 = -1;
int send.sub.-- index2 = -1;
int send.sub.-- index3 = -1;
int request.sub.-- index0 = -1;
int request.sub.-- index1 = -1;
int request.sub.-- index2 = -1;
int request.sub.-- index3 = -1;
/ / Constructor
public VJBiCopy(VJ v){
super(v);
vj = v;
VJNode dup( ) {
VJBiCopy b = new VJBiCopy(vj);
try {
int i = x+40;
intj = y+40;
b.setNormalIcon(out.sub.-- bi);
b.setSelectedIcon(in.sub.-- bi);
b.setName("BiCopy");
b.setComponent(null);
b.setComponentURL(url.sub.-- name);
b.setComponentInfo(info.sub.-- name);
b.VJNodeInit(false,i,j,false);
b.addPort(port0.sub.-- info,port0.sub.-- name,VJPort.InputOutput,VJPort.No
rthCen
ter); / / Pin 0
b.addPort(port1.sub.-- info,port1.sub.-- name,VJPort.InputOutput,
VJPort.EastCenter); / / Pin 1
b.addPort(port2.sub.-- info,port2.sub.-- name,VJPort.InputOutput,VJPort.So
uthCen
ter); / / Pin 2
b.addPort(port3.sub.-- info,port3.sub.-- name,VJPort.InputOutput,
VJPort.WestCenter); / / Pin 3
b.setXPt(0,getXPt(0)+40);
b.setYPt(0,getYPt(0)+40);
b.setXPt(1,getXPt(1)+40);
b.setYPt(1,getYPt(1)+40);
b.setXPt(2,getXPt(2)+40);
b.setYPt(2,getYPt(2)+40);
b.setXPt(3,getXPt(3)+40);
b.setYPt(3,getYPt(3)+40);
b.setImages(normalImage,selectedImage); / /Pass references to the
static images down to the node
b.nodeRect = new Rectangle(i-3,j-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,selecte
dI
mage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
b.setSelected(true);
return b;
} catch(Exception e) {
System.out.println(e);
return null;
}
}
public static void getImages(GIFFactoryf){
normalImage = f.GetGIF(out.sub.-- bi);
selectedImage = f.GetGIF(in.sub.-- bi);
}
/ / Component Initialization
public void VJBiCopyInit(int x.sub.-- pt, int y.sub.-- pt) {
try {
setNormalIcon(out.sub.-- bi);
setSelectedIcon(in.sub.-- bi);
setName("bicopy");
setComponent(null);
setComponentURL(url.sub.-- name);
setComponentInfo(info.sub.-- name);
VJNodeInit(false,x.sub.-- pt,y.sub.-- pt,false);
addPort(port0.sub.-- info,port0.sub.-- name,VJPort.InputOutput,
VJPort.NorthCenter); / / Pin 0
addPort(port1.sub.-- info,port1.sub.-- name,VJPort.InputOutput,
VJPort.EastCenter); / / Pin 1
addPort(port2.sub.-- info,port2.sub.-- name,VJPort.InputOutput,
VJPort.SouthCenter); / / Pin 2
addPort(port3.sub.-- info,port3.sub.-- name,VJPort.InputOutput,
VJPort.WestCenter); / / Pin 3
setImages(normalImage,selectedImage); / / Pass references to the
static images down to the node
nodeRect = new Rectangle(x.sub.-- pt-3,y.sub.-- pt-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,selecte
dI
mage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
} catch(Exception e) {
System.out.println(e);
}
}
public void request(int port,int time) { }
public int componentID( ) { return 5; }
public void disconnecting(int port) {
switch(port){
case 0: send.sub.-- index0 = -1; request.sub.-- index0 = -1;
break;
case 1: send.sub.-- index1 = -1; request.sub.-- index1 = -1;
break;
case 2: send.sub.-- index2 = -1; request.sub.-- index2 = -1;
break;
case 3: send.sub.-- index3 = -1; request.sub.-- index3 = -1;
break;
}
}
public void connecting(int port) {
switch(port){
case 0: request.sub.-- index0=0;send.sub.-- index0 = 0;
vj.request(0,request.sub.-- index0++,this);
break;
case 1: request.sub.-- index1=0;send.sub.-- index1 = 0;
vj.request(1,request.sub.-- index1++,this);
break;
case 2: request.sub.-- index2=0;send.sub.-- index2 = 0;
vj.request(2,request.sub.-- index2++,this);
break;
case 3: request.sub.-- index3=0;send.sub.-- index3 = 0;
vj.request(3,request.sub.-- index3++,this);
break;
}
}
public void load(String s) {
}
public String save( ) {
return ""; }
public void set(Object o,int port,int time) {
switch(port){
case 0: if (request.sub.-- index1 > 0) vj.set(o,1,send.sub.-- index1++,thi
s);
if (request.sub.-- index2 > 0) vj.set(o,2,send.sub.-- index2++,this);
if (request.sub.-- index3 > 0) vj.set(o,3,send.sub.-- index3++,this);
vj.request(0,request.sub.-- index0++,this);
break;
case 1: if (request.sub.-- index0 > 0) vj.set(o,0,send.sub.-- index0++,thi
s);
if (request.sub.-- index2 > 0) vj.set(o,2,send.sub.-- index2++,this);
if (request.sub.-- index3 > 0) vj.set(o,3,send.sub.-- index3++,this);
vj.request(1,request.sub.-- index1++,this);
break;
case 2: if (request.sub.-- index1 > 0) vj.set(o,1,send.sub.-- index1++,thi
s);
if (request.sub.-- index0 > 0) vj.set(o,0,send.sub.-- index0++,this);
if (request.sub.-- index3 > 0) vj.set(o,3,send.sub.-- index3++,this);
vj.request(2,request.sub.-- index2++,this);
break;
case 3: if (request.sub.-- index1 > 0) vj.set(o,1,send.sub.-- index1++,thi
s);
if (request.sub.-- index2 > 0) vj.set(o,2,send.sub.-- index2++,this);
if (request.sub.-- index0 > 0) vj.set(o,0,send.sub.-- index0++,this);
vj.request(3,request.sub.-- index3++,this);
break;
}
}
public void propertiesEditor( ) {
}
public void init( ){ };
public void start( ){ };
public void stop( ){ };
public void destroy( ){ };
} / / end class VJButton
______________________________________
FIG. 13A illustrates a flowchart of the process by which the bicopy component 1308 shown in FIG. 13 functions. The act of dragging and dropping a new bicopy component onto the logical desktop 402 or of dropping an assembly from folder 542, which assembly contains a bicopy component, onto the logical view desktop 402 actually starts the bicopy component as called for in block 1330. A test is next made to see there is a saved, prior state for bicopy element 1308 that needs to be restored by decision block 1332. If restoration is needed, control is passed to block 1334 which obtains the necessary values and has the ports set accordingly in block 1344. If the bicopy component is new, its two-way ports are initialized or set to zero in bock 1336. Once that has been done, the ports are polled in block 1338 to monitor connection attempts. Decision block 1340 returns control to block 1338 for continued polling if there were no connections made to any of bicopy's component ports. If a proper connection has been made, a connection sufficient to place a value on one of the bicopy component's ports, control is passed to block 1342 where the type and value of the connection is identified. Thus, if a connection has been made from a text field, a character string is placed on one of the bicopy component's ports and captured by the Bicopy component. Similarly, if an integer value, such as 32, isplaced placed on one of the bicopy component's ports, that type and value is also recognized and captured. Once the type and value of an input are known, the remaining ports are set to provide the same type and value as the input by block 1344. Thus, at this point, see FIG. 16, bicopy component 1308 would have its port 1308c set by the output of scrollbar representation 1306 to the current value (position) of the scrollbar. This means that ports 1308a, 1308b and 1308d, which act as output ports, will carry the output value of scrollbar 1306 until the input connection to port 1308c is changed. Decision block 1346, which is advised of the initial connection by block 1342, checks for removal of the input value to bicopy component 1308 and returns control back to block 1344 if it has not been removed or to block 1336 for reinitialization if it has been removed. FIG. 14 shows addition of splitters 1402 and 1404 in the logical view 402. Splitter objects 1402 and 1404 are used to connect I/O pins to components that are functionally involved in a defined relationship appearing in the logical view 402. Splitters are instantiated form the splitter palette component 558 of logical view 402 and are dragged and dropped to a suitable location on the logical view desktop. Splitter objects are formed pursuant to their implementing code (VJSplit) as follows:
______________________________________
import java.awt.*;
import java.util.*;
public class VJSplit extends VJNode {
/ / Attributes of this component
static int instanceCount = 0;
static Image normalImage;
static Image selectedImage;
final static String out
= "OSplit.gif";
final static String in
= "ISplit.gif";
final static String port0.sub.-- info = "An input/output pin";
final static String port0.sub.-- name = "Pin 0";
final static String port1.sub.-- info = "An output pin";
final static String port1.sub.-- name = "Pin 1";
final static String port2.sub.-- info = "An input pin";
final static String port2.sub.-- name = "Pin 2";
final static String url.sub.-- name = "split.html";
final static String info.sub.-- name = "A Splitter used to connect
input/output pins to componets that are either input or output";
VJ vj;
int send.sub.-- index2 = 0;
int request.sub.-- index0 = 0;
int request.sub.-- index1 = 0;
/ / Constructor
public VJSplit(VJ v){
super(v);
vj = v;
VJNode dup( ) {
VJSplit b = new VJSplit(vj);
try {
int i = x+40;
int j = y+40;
b.setNormalIcon(out);
b.setSelectedIcon(in);
b.setName("Splitter");
b.setComponent(null);
b.setComponentURL(url.sub.-- name);
b.setComponentInfo(info.sub.-- name);
b.VJNodeInit(false,i,j,false);
b.addPort(port0.sub.-- info,port0.sub.-- name,VJPort.InputOutput,VJPort.No
rthCen
ter); // Pin 0
b.addPort(port1.sub.-- info,port1.sub.-- name,VJPort.Output,VJPort.SouthLe
ftCente
r); / / Pin 0
b.addPort(port2.sub.-- info,port2.sub.-- name,VJPort.Input,VJPort.SouthRig
htCente
r); / / Pin 0
b.setXPt(0,getXPt(0)+40);
b.setYPt(0,getYPt(0)+40);
b.setXPt(1,getXPt(1)+40);
b.setYPt(1,getYPt(1)+40);
b.setXPt(2,getXPt(2)+40);
b.setYPt(2,getYPt(2)+40);
b.setImages(normalImage,selectedImage); / /Pass references to the
static images down to the node
b.nodeRect = new Rectangle(i-3,j-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,
selectedI
mage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
b.setSelected(true);
return b;
} catch(Exception e) {
System.out.println(e);
return null;
}
}
public static void getImages(GIFFactoryf){
normalImage = f.GetGIF(out);
selectedImage = f.GetGIF(in);
}
/ / Component Initialization
public void VJSplitInit(int x.sub.-- pt, int y.sub.-- pt) {
try {
setNormalIcon(out);
setSelectedIcon(in);
setName("Splitter");
setComponent(null);
setComponentURL(url.sub.-- name);
setComponentInfo(info.sub.-- name);
VJNodeInit(false,x.sub.-- pt,y.sub.-- pt,false);
addPort(port0.sub.-- info,port0.sub.-- name,VJPort.InputOutput,VJPort.Nort
hCente
r); / / Pin 0
addPort(port1.sub.-- info,port1.sub.-- name,VJPort.Output,VJPort.SouthLeft
Center);
/ / Pin 0
addPort(port2.sub.-- info,port2.sub.-- name,VJPort.Input,VJPort.SouthRight
Center);
/ / Pin 0
setImages(normalImage,selectedImage); / /Pass references to the
static images down to the node
nodeRect = new Rectangle(x.sub.-- pt-3,y.sub.-- pt-
3,selectedImage.getWidth(vj.theContainer.theDesktop.vp.sub.-- w)+3,selecte
dI
mage.getHeight(vj.theContainer.theDesktop.vp.sub.-- w)+3);
} catch(Exception e) {
System.out.println(e);
}
}
public int componentID( ) { return 12; }
public void disconnecting(int port) { }
public void connecting(int port) { }
public void load(String s) {
}
public string save( ) {
return ""; }
public void propertiesEditor( ) { }
public void reset( ) { }
public void request(int port,int time) {
switch(port){
case 0: vj.request(2,time,this);
break;
case 1: vj.request(0,time,this);
break;
}
}
public void set(Object o,int port,int time) {
switch(port){
case 0: vj.set(o,1,time,this);
break;
case 2: vj.set(o,0,time,this);
break;
}
}
public void init( ){ };
public void start( ){
};
public void stop( ){
};
public void destroy( ){ };
}
______________________________________
FIG. 15 shows the addition of a calculator object 1502. Calculator object 1502 is instantiated from calculator component 572 of the logical view palette when the mouse is clicked over the calculator icon and the resulting image is dragged into the logical view window. When calculator object 1502 is created, evaluator editor 1504 is popped up so that expressions to be evaluated by the calculator can be input thereto. In this particular example, the Fahrenheit to Centigrade conversion expression to be evaluated is entered and the calculator is thereby informed what its computational task will be. FIG. 16 illustrates the interconnections of several objects to achieve the appropriate Centigrade/Fahrenheit relationship between scroll bars 604b and 1102. Building on to the arrangement depicted in FIG. 15, the user would add two simple text field objects 1602 and 1603 in physical view 500 by clicking on the simple text field icon 506 twice and then dragging and dropping each resultant text field object 1602 and 1603 so that each is located below and adjacent to the scrollbar it contains information for. When the text field objects are created, logical representations thereof, 1604 and 1606 respectively, are created by VJ Tool in the logical window. The appropriate interconnections between and amongst the several objects in the logical view 402 are then made and the results displayed in the text fields 1602 and 1604 as a direct function of where the scrollbars are actually located. Since scrollbar 604b is at its minimum position, which is zero, text field 1602 accurately displays that result. The display of the position results in a text field without the intervening need to write additional code to transform the scrollbar output, an integer or floating point value to an ASCII string. VJ Tool takes care of that task for the user and permits concentration on the problem being solved. ##SPC5## In this example, interconnections are made by mouse click, drag and drop operations as follows. The output of scrollbars 1306 and 1308 are connected to the bicopy objects 1308 and 1314 respectively. That value is passed from bicopy object 1308 to splitter 1402 and text field representation 1604 and from bicopy object 1314 to splitter 1404 and text field representation 1606. In addition, the output of splitter 1402 is coupled to the input of calculator 1502a while the output of splitter 1404 is coupled to the input of calculator 1502b. Finally, the outputs of calculators 1502a and 1502b are respectively connected to the inputs of splitters 1402 and 1404. Thus, when scrollbar 604b is moved to a new position, the value of that position is transmitted by the scrollbar object 1306 to bicopy object 1308 and from there to text field component representation 1604. This means that the text fields 1602 and 1603 both display the changing values for their associated scrollbars 604b and 1102 when either one of them is moved to a new position. It is rather important to note that the interconnections described above between objects on the logical view are subject to type and functionality checking in a dynamic manner when they are attempted. Thus, the connection in FIG. 16 that was made between the output port of is splitter 1402 and the input port of calculator 1502a is functionally permissible and was permitted to be made in a manner that was transparent to the user. Conversely, if an attempt had been made to connect the output port of splitter 1402 to the output port of calculator 1502a, that attempt would have been denied as functionally impermissible. In a similar manner, had an attempt been made to the output of calculator 1502a to the input of text label object 1304, that connection would have been denied since the input type (a value or number) was mistyped as an input to text label object 1304 which only accepts input of type char or a string of characters. This functional and type compatibility checking is performed by the VJDesktop code as set forth above. The port or netpin type verification works in the following functional manner. When a component or object pin is created by being dropped onto the logical view desktop 402, its presence there and the number and nature of its pins, if any, is logged, stored and tracked by the VJDesktop code. Specifically, the number and types of ports or netpins on the newly instantiated component or object is noted Once a component or object having pins is instantiated, VJDesktop tracks and stores the status of its ports by polling them periodically as depicted by block 1620 in FIG. 16A. The same is true for variables, the information for which is initially stored when a component that can pass, duplicate or manipulate a variable is instantiated. As used herein, the term "initiate a connection" means that the mouse has been clicked over only one port in preparation for tacking the line that appears to another port. Once that other port is clicked on, the connection is deemed to be completed. Decision block 1622 is advised by block 1620 whether or not a connection to one of the ports has been initiated. If no attempt to initiate a connection has been made, polling continues. If a connection has been initiated, the type of port involved (input, output or bidirectional) and, if known, the type of variable expected (character, float, long integer, short integer, string, etc.) on that port are stored as per block 1624 with VJDesktop and control waits for completion of a connection for the involved port while polling continues for the remaining ports. Decision block 1626 sends control back to polling if the pending connection has not yet been made. If the connection is completed, control for the ports involved is passed to decision block 1628 which decides if the attempted complete connection between the ports involved is valid. The type of ports involved and their functional affinity for each other will be checked and verified. Connections directly between an input port on one component will not be allowed to an input port on another component nor will a direct connection between an output port on a first container to an output port on a second container. Also forbidden are connections between ports on the same component regardless of their type. In addition to checking that interport connections are valid, decision block 1628 also ascertains if the variable to be transmitted across the new connection is valid for both ports. By referring to the stored component and object port information, it can be determined, for example, that the variable at the output of calculator 1502a in FIG. 16 is mistyped as to the variable expected at the input of label 1304, a character or string. As a result, when that otherwise valid output to input connection is attempted, it would be prevented by decision block 1628 because of a variable type mismatch. When the attempted connection is invalid, an error message will be sent to the screen for the user to see and notification is sent to block 1620 to keep on polling for completion of the initiated, but not completed connection. If the attempted connection is valid, it is completed and also reflected on the display and the polling block 1620 is so advised. The stored port information is updated and the system waits for the next attempted connection. If a completed connection is ended, decision block 1634 is so advised by polling block 1620 and the stored type information for that connection is appropriately adjusted to reflect that the ports which were involved in the ended connection are now free for other use. FIG. 17 shows the final result of the coupled scrollbars with correct Fahrenheit and Centigrade temperatures shown in text fields 1602 and 1603, respectively. With both scrollbars at their minimum positions, the Centigrade scrollbar 604b position produces the value 0 in text field 1602. In similar fashion, scrollbar 1102 produces a value of 32 in text field 1603. If scrollbar 604b is pulled down to position 1702 where it has a value of 80, as will then be displayed in text field 1602, then scrollbar 1102, because of what are essentially feedback connections made in FIG. 16, will move to position 1704 which will cause text field 1603 to then display its corresponding value of 176 degrees. Because of the cross coupling described in connection with FIG. 16, moving scrollbar 1102 first to a position of 176 would cause scrollbar 604b to be positioned at the point that represents the value 80, which would be displayed in text field 1602. ##SPC6## As described above, the VJ Tool provides a live development or authoring environment in which socialization among objects or components can occur immediately upon their creation or instantation without any wait to plan or test their integration. For example, as shown in FIG. 16, once the output of bicopy object 1308 was connected to text field representation 1604, the output value of scrollbar 1306 was displayed in the physical view 500. If this result is not what was desired, the user can change the connection or add another component on the fly without having to debug code or review a flowchart. Similarly, when the output of splitter 1404 is connected to the input of calculator 1502b and displayed via text field representation 1606, the user is able to make an immediate determination that the conversion calculations are correct and that the displayed arrangement is satisfactory. In other words, being able to make connections on the fly immediately proved or disproved the results obtained because VJ Tool creates a "live" environment wherein applet design creation and trial are integrated so that the result is then played out virtually simultaneously with creation. This is analogous to building a hardware prototype or test board by connecting, disconnecting and moving components around the board while the power is on| Component 542 of FIG. 5 is a folder component in which associated components can be stored to act as templates for other applets to be designed in the future. Say, for example, that a user had designed the specific arrangement shown in FIG. 16 and dragged it as a component assembly into an object folder instantiated from folder 542. That object folder can later be opened and the component assembly stored therein be reused or its calculators modified to display Centigrade versus Kelvin or with slightly more modification to the text and label fields, feet versus meters. In fact, a hierarchy of folders can be built up in this manner. Unlike ordinary folders which are static and store only files that can be copied in an ordinary fashion, component folder 542 actually stores parts or all of a program with its interconnections intact. To build a hierarchial component, a component is instantiated on a logical or physical display. Then, a hierarchial component folder is selected and instantiated on the display. The customization (edit) window is completed to reflect an appropriate name for the particular component folder and the customization window is closed. Another window is presented for receipt of one or more components and their connections to capture and create the "hierarchial component." Thus, the hierarchial component acts as an organizer to capture debugged logic and make it available to other applets without modification. There are several kinds of components in VJ Tool. For example, as shown in FIG. 5, there is a GUI primitive such as 508, a primitive spreadsheet 524, a primitive backend component 570 (calculator) and a backend component 558 (splitter). In addition, some of the components have the ability to be made collaborative, that is, they can interact with each other to show or indicate interdependencies. For example, if three users are working with collaborative spreadsheets, a change made by one user will also be reflected in the spreadsheets of the other two users. This makes it easy to keep all members of a team current with respect to changes in spreadsheet information. Under VJ Tools, collaborative components work as follows. To begin the collaboration process, a standard VJ Tool component, such as a spreadsheet 524, is created from the physical view palette of VJ Tool, see FIG. 5. As shown in FIG. 18, there would be a copy, 524a, 524b and 524c, of each spreadsheet object instantiated for each client user, 1806a, 1806b and 1806c, that wanted their spreadsheet to be collaboratively coupled to other spreadsheets. Collaboration can be extended to the entire spreadsheet or it can be limited to designated cells in the spreadsheet. For example, individual cells in each spreadsheet can be collaborated by simply clicking on them or the entire spreadsheet can be collaboratively coupled by simultaneously pressing the <CONTROL> key while clicking on any portion of the spreadsheet. It is also possible to have two collaborating spreadsheets completely linked to each other while one of these is linked to a third spreadsheet on a designated cell basis only. All such standard components to be collaborated are augmented with code than connects them to a VJ Spreadsheet Server, a Java application, that is running on the same HTTP server as the VJ Tool applet. VJ Spreadsheet Server is responsible for managing the collaboration. This arrangement is necessitated by the fact that this is the only way a Java applet, when VJ Tool is implemented as a Java applet, can interact with a Java server application through a designated socket. The clients, 1808a, 1808b and 1808c, are typically connected across the Internet 1810 to an HTTP server 1802. The HTTP server 1802 can include many applications and applets and it often does, but for the sake of clarity there are only three applications, 1804a, 1804b and 1804c, and three applets, 1806a, 1806b and 1806c, shown. Application 1804c, designated for purposes of this explanation as the Java Server, is usually a daemon server, has full access to the underlying file system and can be used to communicate with related servers, not necessarily Java servers, on the Internet. In the simplest mode, collaborative capable components, are associated with one or more Java servers running on the same HTTP server that houses and services the VJ Tool applet. As each instance of such components are created and deployed in the VJ Tool environment, and collaboration is desired, each collaborative component to be is registered with the Java server, in this case 1804c. The process of registration builds an instance 1812a of the registering component 524a in Server 1804c. It will also build a similar instance of the other components involved, 1812b and 1812c, as they are registered. Once registered with the Java Spreadsheet Server 1804c, the component, assume it's 524a for purposes of this discussion, sends out information to Server 1804c based on interactions with the user and possibly other registered components, 524b and 524c, in the deployment environment; that is; other collaborative components to which a changing component is tied. In addition, the collaborated component 524a will receive information from Server 1804c which it may choose to use as feedback to the user or to the other collaborated components with which it is so associated. Basically, the message set "Publish cell", "Unpublish cell" and "Update cell" is used to alter cell content. However, each time the collaborative arrangement is initialized, nothing is shared between the collaborated components unless the state of the last session was saved and reloaded at initialization into Spreadsheet Server 1802. Since the registration process builds a record in Server 1804c of which portions of which collaborated components are coupled, it is relatively straightforward for the Server to accumulate this information from a changed component, which utilizes a publish message to send it there and then republish or broadcast it to the other collaborated components to effect updating, thereby making it public. Thus, nothing is seen by any of the unchanged collaborated components until the Spreadsheet Server 1802 has relayed the changed information on to them. A flowchart of the collaboration process is illustrated in FIG. 19. When a new component is created as in block 1902, the user is asked by decision block 1904 if the new component should be collaborative. If not, the user and VJ Tool go off via block 1906 and do something else. If the user responds in the affirmative to the query of block 1904, the component properties are examined to determine if this specific component can be collaborated by decision block 1908. If collaboration isn't possible, control is passed to block 1910 which sends an appropriate message to the user and then waits for the user to make another request. If a new component can be collaborated, it is registered with a Java server as shown in function block 1912. The server, as indicated by block 1914, then builds an instance of the registering component in order to know which components it is responsible for. In addition, pursuant to block 1916, the server builds a record listing those portions, some or all, of the registered components which are linked or collaborated. Once that identity and designated linked portions of the components have been identified and recorded, the server changes the information in the collaborated portions when it receives information from a component as shown in block 1918 and broadcasts the changed information to the other collaborated components via block 1920. Collaboration within the VJ Tool, in accordance with the foregoing description, is accomplished utilizing the source code presented below. ##SPC7## FIG. 20 illustrates a screen with the logical view in accordance with a preferred embodiment. A sound component 2000 has been instantiated on the logical view by dropping a sound icon onto the logical desktop 2010. FIG. 21 illustrates a screen with the logical and physical view preparing a hierarchical component in accordance with a preferred embodiment. A button 2120 has been instantiated and customized 2110 on the logical desktop 2114 and its physical representation 2100 is also reflected in the physical desktop 2112. FIG. 22 illustrates a screen with a connection made for playing a sound in accordance with a preferred embodiment. The button component 2200 is connected 2210 to the sound component 2220 in the logical desktop 2230. The Play Sound Button component 2240 is the physical view in the physical desktop 2250. FIG. 23 illustrates an edit screen for a folder component utilized to prepare a hierarchical component in accordance with a preferred embodiment. A Container 1 folder 2300 is instantiated in the logical desktop 2350 by dropping a folder component 2360 on the desktop. A customize or edit window 2310 pops up when the folder is instantiated. This edit window can be utilized to change the name of the folder and the number, location and type of active ports of the folder component. The Container 1 folder is logically represented by a window 2320 where the logic of the folder (hierarchial component) can be created on the fly by adding or deleting components in the window 2320. The button 2330 is also shown in the physical desktop 2340. As shown in FIG. 23A, a folder class with options for unidirectional and bidirectional ports and an editor is first created as depicted by block 2370. The user instantiates a folder component by dragging and dropping it onto the logical desktop 2350 as reflected by block 2372. When the folder is instantiated and its edit window 2310 pops up, as described above, the folder name and the number, location and type of ports can be selected or changed. This capability is reflected in block 2374. Finally, as shown by block 2376, the folder component waits on the user to indicate what other components, including other folders, should be placed within it. This procedure is described hereafter in connection with FIG. 24. FIG. 24 illustrates a hierarchical component creation customization in accordance with a preferred embodiment. The button 2400 which was originally in the logical desktop 2420 has been moved into the Container 1 folder 2410. The internal connectors 2430C and 2440C are represented in the Container 1 folder 2410 and refer back to the logical desktop ports 2440L and 2430L of the folder 2450 in the logical desktop 2420. The ports can be used to transfer information into and out of a folder 2410. One of ordinary skill in the art will readily recognize that other components could be added to the Container 1 folder 2410 to create a more complex hierarchical component which could even include nested and recursive hierarchical components. FIG. 25 illustrates the completed physical view of a hierarchical component in accordance with a preferred embodiment. The sound button 2500 in the physical view 2520 is now inside the folder 2510 which can be used to simplify complex logic on the logical desktop 2530 and reduce screen clutter. This technique can be utilized to capture debugged components and component assemblies in a single representation of many components. Users can thus create their own components. While the invention is described in terms of preferred embodiments in a specific system environment, those skilled in the art will recognize that the invention can be practiced, with modification, in other and different hardware and software environments within the spirit and scope of the appended claims.
|
Same subclass Same class Consider this |
||||||||||
