87 lines
3.0 KiB
Java
87 lines
3.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.server;
|
||
|
|
|
||
|
|
import com.foundation.view.*;
|
||
|
|
import com.foundation.tcv.swt.*;
|
||
|
|
import com.foundation.tcv.view.*;
|
||
|
|
|
||
|
|
public class Sash extends Component implements ISash {
|
||
|
|
private boolean hasSetAttachments = false;
|
||
|
|
/**
|
||
|
|
* Sash constructor.
|
||
|
|
* @param parent A composite control which will be the parent of the new instance (cannot be null).
|
||
|
|
* @param name The unique component name.
|
||
|
|
* @param style The style of control to construct.
|
||
|
|
* @see #STYLE_ARROW
|
||
|
|
* @see #STYLE_CHECK
|
||
|
|
* @see #STYLE_PUSH
|
||
|
|
* @see #STYLE_RADIO
|
||
|
|
* @see #STYLE_TOGGLE
|
||
|
|
* @see #STYLE_FLAT
|
||
|
|
* @see #STYLE_LEFT
|
||
|
|
* @see #STYLE_RIGHT
|
||
|
|
* @see #STYLE_CENTER
|
||
|
|
* @see #STYLE_UP
|
||
|
|
* @see #STYLE_DOWN
|
||
|
|
*/
|
||
|
|
public Sash(Container parent, String name, int style) {
|
||
|
|
super(parent, name, style);
|
||
|
|
|
||
|
|
sendMessage(MESSAGE_INITIALIZE, new int[] {parent.getNumber(), style});
|
||
|
|
}//Sash()//
|
||
|
|
/**
|
||
|
|
* Sets the components on either side of the sash.
|
||
|
|
* @param attachment1 The first of two components.
|
||
|
|
* @param attachment2 The second of two components.
|
||
|
|
* @throws IllegalArgumentException If this method is called more than once.
|
||
|
|
*/
|
||
|
|
public void setAttachments(Component attachment1, Component attachment2) {
|
||
|
|
verifyThread();
|
||
|
|
|
||
|
|
if(!hasSetAttachments) {
|
||
|
|
sendMessage(MESSAGE_SET_ATTACHMENTS, new int[] {attachment1.getNumber(), attachment2.getNumber()});
|
||
|
|
hasSetAttachments = true;
|
||
|
|
}//if//
|
||
|
|
else {
|
||
|
|
throw new IllegalArgumentException("Cannot set the attachments more than once.");
|
||
|
|
}//else//
|
||
|
|
}//setAttachments()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see com.foundation.view.swt.Component#internalOnValueChanged(com.foundation.view.swt.IAttributeAssociation)
|
||
|
|
*/
|
||
|
|
protected void internalOnValueChanged(IAttributeAssociation attributeAssociation) {
|
||
|
|
super.internalOnValueChanged(attributeAssociation);
|
||
|
|
}//internalOnValueChanged()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see com.foundation.tcv.swt.server.AbstractComponent#internalOnEventFired(com.foundation.tcv.swt.server.IEventAssociation, java.lang.Object[])
|
||
|
|
*/
|
||
|
|
protected void internalOnEventFired(IEventAssociation eventAssociation, Object[] eventArguments) {
|
||
|
|
super.internalOnEventFired(eventAssociation, eventArguments);
|
||
|
|
}//internalOnEventFired()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see com.foundation.tcv.view.IViewComponent#processMessage(com.foundation.tcv.model.ViewMessage)
|
||
|
|
*/
|
||
|
|
public Object processMessage(ViewMessage viewMessage) {
|
||
|
|
Object retVal = null;
|
||
|
|
|
||
|
|
switch(viewMessage.getMessageNumber()) {
|
||
|
|
default: {
|
||
|
|
retVal = super.processMessage(viewMessage);
|
||
|
|
}//default//
|
||
|
|
}//switch//
|
||
|
|
|
||
|
|
return retVal;
|
||
|
|
}//processMessage()//
|
||
|
|
/* (non-Javadoc)
|
||
|
|
* @see com.foundation.tcv.swt.server.AbstractComponent#getClientClassName()
|
||
|
|
*/
|
||
|
|
protected String getClientClassName() {
|
||
|
|
return "com.foundation.tcv.swt.client.Sash";
|
||
|
|
}//getClientClassName()//
|
||
|
|
}//Sash//
|