package es.dalocar.facturamas.swt.list;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.SWT;

import es.dalocar.facturamas.swt.SWTUtils;
import es.dalocar.facturamas.swt.components.FacturaSearchComposite;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class FacturaListaComposite extends org.eclipse.swt.widgets.Composite {
	private FacturaSearchComposite facturaSearchComposite1;
	private ListaComposite listaComposite1;

	/**
	* Auto-generated main method to display this 
	* org.eclipse.swt.widgets.Composite inside a new Shell.
	*/
	public static void main(String[] args) {
		showGUI();
	}
	
	/**
	* Overriding checkSubclass allows this class to extend org.eclipse.swt.widgets.Composite
	*/	
	protected void checkSubclass() {
	}
	
	/**
	* Auto-generated method to display this 
	* org.eclipse.swt.widgets.Composite inside a new Shell.
	*/
	public static void showGUI() {
		Display display = Display.getDefault();
		Shell shell = new Shell(display);
		FacturaListaComposite inst = new FacturaListaComposite(shell, SWT.NULL);
		Point size = inst.getSize();
		shell.setLayout(new FillLayout());
		shell.layout();
		if(size.x == 0 && size.y == 0) {
			inst.pack();
			shell.pack();
		} else {
			Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
			shell.setSize(shellBounds.width, shellBounds.height);
		}
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
	}
	
	/**
	 * Metodo que abre deja el nuevo composite en el bucle de espera
	 * de eventos
	 */
	public void open(){
		final Display display = Display.getCurrent();
		Shell shell = this.getShell();
		Point size = this.getSize();
		shell.setLayout(new FillLayout());
		shell.layout();
		if(size.x == 0 && size.y == 0) {
			this.pack();
			shell.pack();
		} else {
			Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y);
			shell.setSize(shellBounds.width, shellBounds.height);
		}
		SWTUtils.openCentered(shell);
	}

	public FacturaListaComposite(org.eclipse.swt.widgets.Composite parent, int style) {
		super(parent, style);	
	
		try {
			GridLayout thisLayout = new GridLayout();
			thisLayout.makeColumnsEqualWidth = true;
			this.setLayout(thisLayout);
			{
				facturaSearchComposite1 = new FacturaSearchComposite(this, SWT.NONE);
				GridData facturaSearchComposite1LData = new GridData();
				facturaSearchComposite1.setLayoutData(facturaSearchComposite1LData);
			}
			{
				listaComposite1 = new ListaComposite(this, SWT.NONE);
				GridData listaComposite1LData = new GridData();
				listaComposite1LData.widthHint = 815;
				listaComposite1LData.heightHint = 434;
				listaComposite1.setLayoutData(listaComposite1LData);
			}
			this.layout();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public FacturaSearchComposite getFacturaSearchComposite1() {
		return facturaSearchComposite1;
	}
	
	public ListaComposite getListaComposite1() {
		return listaComposite1;
	}

}
