⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sellstatview.java

📁 java eclipse rcp学习
💻 JAVA
字号:
/**
 * 
 */
package chainShopMS.views;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.part.ViewPart;

/**
 * @author Administrator
 *	总店销售统计视图
 */
public class SellStatView extends ViewPart
{
	private Combo productID;// 商品ID
	
	private Combo productName;//商品名称

	private Text sellDate;// 销售时间
	private Text sellDate2;// 销售时间
	
	private Text sellOprator;// 销售员
	
	private Combo subShop;//分店
	
	private Combo buyCustom;//购买顾客
	
	
	private Button sellStat;// 销售统计

	/** 该视图的ID */
	public static final String ID = "chainShopMS.views.SellStatView";

	/**
	 * 生成GridData对象的重复代码太多,写出一个可以减少程序的行数,用起来也方便,而且要注意一个GridData只能呗一个组件实验
	 * 不能两个组件使用一个GridData,否则一个组件不会显示出来
	 */
	private GridData createGridData(int style,int horizontalSpan)
	{
		GridData gridData=new GridData(style);
		gridData.horizontalSpan=horizontalSpan;
		gridData.grabExcessHorizontalSpace=true;
		gridData.horizontalAlignment=SWT.FILL;
		return gridData;
	}
	
	// 必须实现的两个方法
	public void createPartControl(final Composite parent)
	{
		parent.setLayout(new GridLayout(6, false));// 信息面板分成6列

		new Label(parent, SWT.NONE).setText("商品编码:");
		productID = new Combo(parent, SWT.BORDER);
		//从数据库中得到所有商品的编码
		productID.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));

		new Label(parent, SWT.NONE).setText("商品名称:");
		productName = new Combo(parent, SWT.BORDER);
		//从数据库得到所有商品的名称并对相应的编码设置事件
		productName.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("连锁分店:");
		subShop = new Combo(parent, SWT.BORDER);
		//从数据库得到所有商品的名称并对相应的编码设置事件
		subShop.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));

		new Label(parent, SWT.NONE).setText("销售时间:");
		sellDate = new Text(parent, SWT.BORDER);
		sellDate.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		new Label(parent,SWT.NONE).setText("至");
		sellDate2 = new Text(parent, SWT.BORDER);
		sellDate2.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("售 货 员:");
		sellOprator = new Text(parent, SWT.BORDER);
		sellOprator.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
		
		new Label(parent, SWT.NONE).setText("购买顾客:");
		buyCustom = new Combo(parent, SWT.BORDER);
		//从数据库得到所有商品的名称并对相应的编码设置事件
		buyCustom.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));

		new Label(parent, SWT.NONE);
		new Label(parent, SWT.NONE);
		new Label(parent, SWT.NONE);
		
		
		sellStat =new Button(parent,SWT.NONE);
		sellStat.setText("销售统计");
		
		

	}

	public void setFocus()
	{
		productID.setFocus();
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -