📄 storagemanagerview.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 StorageManagerView extends ViewPart
{
private Text productID;// 商品编号
private Text productDate;// 生产日期
private Text productDate2;// 生产日期2
private Combo provider;// 供应商
private Combo subShop;//连锁店
private Combo buyer;// 采购员
private Text stockDate;// 进货日期
private Text stockDate2;// 进货日期2
private Text buyMoney;// 单位进价
private Text buyMoney2;// 单位进价2
private Button storageSearch;// 查询
/** 该视图的ID */
public static final String ID = "chainShopMS.views.StorageManagerView";
/**
* 生成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(8, false));// 信息面板分成6列
new Label(parent, SWT.NONE).setText("编 号:");
productID = new Text(parent, SWT.BORDER);
productID.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3));
new Label(parent, SWT.NONE).setText("供 应 商:");
provider = new Combo(parent, SWT.BORDER);
//从数据库从得到供应商的数据添加
provider.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3));
new Label(parent, SWT.NONE).setText("采 购 员:");
buyer = new Combo(parent, SWT.BORDER);
//在此从数据库中选取采购员数据添加
buyer.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3));
new Label(parent, SWT.NONE).setText("连 锁 店:");
subShop = new Combo(parent, SWT.BORDER);
//从数据库中得到连锁店的值添加到列表
subShop.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3));
new Label(parent, SWT.NONE).setText("生产日期:");
productDate = new Text(parent, SWT.BORDER);
productDate.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent,SWT.NONE).setText("至");
productDate2 = new Text(parent, SWT.BORDER);
productDate2.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent, SWT.NONE).setText("进货日期:");
stockDate = new Text(parent, SWT.BORDER);
stockDate.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent,SWT.NONE).setText("至");
stockDate2 = new Text(parent, SWT.BORDER);
stockDate2.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent, SWT.NONE).setText("单位进价:");
buyMoney= new Text(parent, SWT.BORDER);
buyMoney.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent,SWT.NONE).setText("至");
buyMoney2= new Text(parent, SWT.BORDER);
buyMoney2.setLayoutData(createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1));
new Label(parent, SWT.NONE);
new Label(parent,SWT.NONE);
new Label(parent, SWT.NONE);
//按钮
storageSearch =new Button(parent,SWT.NONE);
storageSearch.setText(" 查询 ");
}
public void setFocus()
{
productID.setFocus();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -