/* * Copyright (c) 2006 Manuel Traut and Volker Dahnke * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html * * Contributors: Manuel Traut and Volker Dahnke */ package YalpClients.SwtClient.GUI; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /* * Class LoadDialog * * * * @author Volker Dahnke / Manuel Traut * * @version 1 02-04-2006
*/ public class LoadDialog extends Composite{ { //Register as a resource user - SWTResourceManager will //handle the obtaining and disposing of resources SWTResourceManager.registerResourceUser(this); } private CLabel cLabel1; private CLabel cLabel2; private CLabel cLabel3; private Shell parent; public LoadDialog(Composite parent, int style) { super(parent, style); this.parent=(Shell)parent; initDialog(); } private void initDialog(){ GridLayout thisLayout = new GridLayout(); thisLayout.makeColumnsEqualWidth = true; this.setLayout(thisLayout); this.setSize(300,170); { Composite composite = new Composite(this, SWT.NONE); FormLayout compositeLayout = new FormLayout(); composite.setLayout(compositeLayout); GridData compositeLData = new GridData(); compositeLData.widthHint = 287; compositeLData.heightHint = 165; composite.setLayoutData(compositeLData); composite.setVisible(true); { cLabel3 = new CLabel(composite, SWT.LEFT); cLabel3.setText("Copyright (c) 2006 Manuel Traut and Volker Dahnke"); FormData cLabel3LData = new FormData(); cLabel3LData.width = 300; cLabel3LData.height = 20; cLabel3LData.left = new FormAttachment(0, 1000, 0); cLabel3LData.top = new FormAttachment(0, 1000, 145); cLabel3.setLayoutData(cLabel3LData); cLabel3.setFont(SWTResourceManager.getFont("Times", 7, 0, false, false)); } { cLabel2 = new CLabel(composite, SWT.CENTER); cLabel2.setText("Loading..."); FormData cLabel2LData = new FormData(); cLabel2LData.width = 105; cLabel2LData.height = 25; cLabel2LData.left = new FormAttachment(0, 1000, 91); cLabel2LData.top = new FormAttachment(0, 1000, 123); cLabel2.setLayoutData(cLabel2LData); cLabel2.setFont(SWTResourceManager.getFont("Times", 12, 1, false, false)); } { cLabel1 = new CLabel(composite, SWT.CENTER); FormData cLabel1LData = new FormData(); cLabel1LData.width = 200; cLabel1LData.height = 120; cLabel1LData.left = new FormAttachment(0, 1000, 40); cLabel1LData.top = new FormAttachment(0, 1000, 0); cLabel1.setLayoutData(cLabel1LData); cLabel1.setImage(new Image(this.getDisplay(),"img/yalpV2.gif")); } } } public void show(){ Point size = this.getSize(); java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y); this.parent.setLayout(new FillLayout()); this.parent.layout(); this.parent.setBounds(shellBounds); this.parent.open(); } public void close(){ this.parent.close(); } }