/* * Copyright (c) 2007 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.client; import org.eclipse.swt.SWT; import com.foundation.tcv.swt.IRowLayout; import com.foundation.tcv.view.ViewMessage; public class RowLayout extends Layout implements IRowLayout { public int type = SWT.HORIZONTAL; public int marginWidth = 0; public int marginHeight = 0; public int spacing = 3; public boolean wrap = true; public boolean pack = true; public int alignment = SWT.BEGINNING; public boolean justify = false; public int marginLeft = 3; public int marginTop = 3; public int marginRight = 3; public int marginBottom = 3; /** * RowLayout constructor. */ public RowLayout() { }//RowLayout()// /* (non-Javadoc) * @see com.foundation.tcv.swt.client.Layout#createLayout(java.lang.Object) */ public org.eclipse.swt.widgets.Layout createLayout(Object rowObject) { com.foundation.view.swt.layout.RowLayout result = new com.foundation.view.swt.layout.RowLayout(); result.type = type; result.marginHeight = marginHeight; result.marginWidth = marginWidth; result.spacing = spacing; result.wrap = wrap; result.pack = pack; result.alignment = alignment; result.justify = justify; result.marginLeft = marginLeft; result.marginTop = marginTop; result.marginRight = marginRight; result.marginBottom = marginBottom; return result; }//createLayout()// /* (non-Javadoc) * @see com.foundation.tcv.swt.client.Layout#initialize() */ public void initialize() { }//initialize()// /* (non-Javadoc) * @see com.foundation.tcv.swt.client.Layout#release() */ public void release() { }//release()// /* (non-Javadoc) * @see com.foundation.tcv.swt.client.Layout#synchronize() */ public void synchronize() { }//synchronize()// /* (non-Javadoc) * @see com.foundation.tcv.swt.client.Layout#processMessage(com.foundation.tcv.view.ViewMessage) */ public Object processMessage(ViewMessage viewMessage) { Object result = null; switch(viewMessage.getMessageNumber()) { case MESSAGE_INITIALIZE: { setContainer((AbstractComponent) getComponent(viewMessage.getMessageInteger())); break; }//case// case MESSAGE_SET_TYPE: { this.type = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_MARGIN_HEIGHT: { this.marginHeight = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_MARGIN_WIDTH: { this.marginWidth = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_SPACING: { this.spacing = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_WRAP: { this.wrap = viewMessage.getMessageInteger() != 0; break; }//case// case MESSAGE_SET_PACK: { this.pack = viewMessage.getMessageInteger() != 0; break; }//case// case MESSAGE_SET_ALIGNMENT: { this.alignment = viewMessage.getMessageInteger() == 0 ? SWT.BEGINNING : viewMessage.getMessageInteger(); //The test is just to avoid version incompatibilities.// break; }//case// case MESSAGE_SET_JUSTIFY: { this.justify = viewMessage.getMessageInteger() != 0; break; }//case// case MESSAGE_SET_MARGIN_TOP: { this.marginTop = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_MARGIN_BOTTOM: { this.marginBottom = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_MARGIN_LEFT: { this.marginLeft = viewMessage.getMessageInteger(); break; }//case// case MESSAGE_SET_MARGIN_RIGHT: { this.marginRight = viewMessage.getMessageInteger(); break; }//case// default: { result = super.processMessage(viewMessage); break; }//default// }//switch// return result; }//processMessage()// }//RowLayout//