package com.gx.obe.management.dialog;

import org.eclipse.swt.core.ImageResolver;
import org.eclipse.swt.core.widgets.EDialog;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

import com.gx.obe.util.utils.LogUtils;
import com.gx.obe.util.utils.ObjectUtils;

import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Text;

/**
 * @Description: 
 * @author guoyr
 */
public class HSTMeetingInfoDialog extends EDialog {
	
	private ImageResolver imageResolver = new ImageResolver();
	private String roomId;
	private String pwd;
	
	{
		LogUtils.logClass(HSTMeetingInfoDialog.class);
	}
	
	/**
	 * Create the dialog.
	 * @param parentShell
	 */
	public HSTMeetingInfoDialog(Shell parentShell, String roomId,String pwd) {
		super(parentShell);
		this.roomId = roomId;
		this.pwd = pwd;
		setTitle("视频会议信息");
	}

	/**
	 * Create contents of the dialog.
	 * @param parent
	 */
	@Override
	protected Control createDialogArea(Composite parent) {
		Composite topContainer = (Composite) super.createDialogArea(parent);
		topContainer.addDisposeListener(new DisposeListener() {
			public void widgetDisposed(DisposeEvent e) {
				imageResolver.disposite();
			}
		});
		GridLayout gl_topContainer = new GridLayout(2, false);
		gl_topContainer.verticalSpacing = 0;
		gl_topContainer.horizontalSpacing = 0;
		gl_topContainer.marginHeight = 0;
		gl_topContainer.marginWidth = 0;
		topContainer.setLayout(gl_topContainer);
		
		Composite composite = new Composite(topContainer, SWT.NONE);
		composite.setLayout(new GridLayout(2, false));
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		
		Label acountLabel = new Label(composite, SWT.NONE);
		acountLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
		acountLabel.setText("会议室号：");
		
		Text text = new Text(composite, SWT.BORDER);
		text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
		text.setText(ObjectUtils.getObjString(roomId));
		text.setEditable(false);
		
		Label pwdLabel = new Label(composite, SWT.NONE);
		pwdLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1));
		pwdLabel.setText("会议室密码：");
		
		Text pwdtext = new Text(composite, SWT.BORDER);
		pwdtext.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
		pwdtext.setText(ObjectUtils.getObjString(pwd));
		pwdtext.setEditable(false);

		return topContainer;
	}


	/**
	 * Return the initial size of the dialog.
	 */
	@Override
	protected Point getInitialSize() {
		return new Point(200, 100);
	}

}
