59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
|
|
/*
|
||
|
|
* Copyright (c) 2003,2009 Declarative Engineering LLC.
|
||
|
|
* All rights reserved. This program and the accompanying materials
|
||
|
|
* are made available under the terms of the Declarative Engineering LLC
|
||
|
|
* verson 1 which accompanies this distribution, and is available at
|
||
|
|
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||
|
|
*/
|
||
|
|
package com.foundation.tcv.swt;
|
||
|
|
|
||
|
|
public class FormAttachment implements java.io.Externalizable {
|
||
|
|
public int numerator = 0;
|
||
|
|
public int denominator = 100;
|
||
|
|
public int offset = 0;
|
||
|
|
public int control = -1;
|
||
|
|
public int alignment = org.eclipse.swt.SWT.DEFAULT;
|
||
|
|
/**
|
||
|
|
* FormAttachment constructor.
|
||
|
|
*/
|
||
|
|
public FormAttachment() {
|
||
|
|
super();
|
||
|
|
}//FormAttachment()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see java.io.Externalizable#readExternal(java.io.ObjectInput)
|
||
|
|
*/
|
||
|
|
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, ClassNotFoundException {
|
||
|
|
numerator = in.readInt();
|
||
|
|
denominator = in.readInt();
|
||
|
|
offset = in.readInt();
|
||
|
|
control = in.readInt();
|
||
|
|
alignment = in.readInt();
|
||
|
|
}//readExternal()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
|
||
|
|
*/
|
||
|
|
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
|
||
|
|
out.writeInt(numerator);
|
||
|
|
out.writeInt(denominator);
|
||
|
|
out.writeInt(offset);
|
||
|
|
out.writeInt(control);
|
||
|
|
out.writeInt(alignment);
|
||
|
|
}//writeExternal()//
|
||
|
|
/**
|
||
|
|
* Creates an SWT form attachment object.
|
||
|
|
* @param controlLocator The locator capable of finding the SWT control for a given component number.
|
||
|
|
* @return The attachment object.
|
||
|
|
*/
|
||
|
|
public com.foundation.view.swt.layout.FormAttachment createSwtAttachment(IControlLocator controlLocator) {
|
||
|
|
com.foundation.view.swt.layout.FormAttachment attachment = null;
|
||
|
|
|
||
|
|
if(control != -1) {
|
||
|
|
attachment = new com.foundation.view.swt.layout.FormAttachment(controlLocator.getControl(control), offset, alignment);
|
||
|
|
}//if//
|
||
|
|
else {
|
||
|
|
attachment = new com.foundation.view.swt.layout.FormAttachment(numerator, denominator, offset);
|
||
|
|
}//else//
|
||
|
|
|
||
|
|
return attachment;
|
||
|
|
}//createSwtAttachment()//
|
||
|
|
}//FormAttachment//
|