📄 workplatformview.java
字号:
package login_QD.view;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.part.ViewPart;
import bridge_data_access.BriCraExceptionTaskStr;
import bridge_data_access.BriCraFinishedTaskStr;
import bridge_data_access.BriCraLogoutTaskStr;
import bridge_data_access.BriCraActionStr;
import bridge_data_access.BriCraProcessingTaskStr;
import bridge_data_access.StaticData;
public class WorkPlatformView extends ViewPart {
public static final String ID = "login_QD.view.WorkPlatformView";
public static Table table;
public static TableViewer tv;
public static int number;
public void createPartControl(Composite parent) {
GridLayout gridlayout = new GridLayout(1, false);
gridlayout.verticalSpacing = 8;
parent.setLayout(gridlayout);
final Color bkColor = new Color(Display.getCurrent(), 155, 155, 255);
parent.setBackground(bkColor);
Label l1 = new Label(parent, SWT.CENTER);
final Font font = new Font(Display.getCurrent(), "隶书", 26, SWT.CENTER);
l1.setFont(font);
l1.setText("无线桥吊调度管理系统");
l1.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_BLUE));
l1.setBackground(new Color(Display.getCurrent(), 155, 155, 255));
GridData gd = new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 4;
gd.heightHint = 40;
gd.widthHint = 20;
l1.setLayoutData(gd);
LabelComposite lc = new LabelComposite(parent);
gd = new GridData(GridData.CENTER | GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 1;
gd.verticalSpan = 2;
lc.setLayoutData(gd);
TableViewerControl tvc = new TableViewerControl();
gd = new GridData(GridData.CENTER | GridData.FILL_BOTH);
tv = tvc.open(parent);
tv.getControl().setLayoutData(gd);
ButtonComposite bc = new ButtonComposite(parent);
bc.setBackground(new Color(Display.getCurrent(), 155, 165, 155));
gd = new GridData(GridData.CENTER | GridData.FILL_HORIZONTAL);
bc.setLayoutData(gd);
}
public class LabelComposite extends Composite {
final Text text1, text2, text3, text4;
int textState;
public LabelComposite(Composite c) {
super(c, SWT.BORDER);
GridLayout gl = new GridLayout();
gl.verticalSpacing = 5;
gl.makeColumnsEqualWidth = true;
gl.numColumns = 8;
this.setLayout(gl);
Label l2 = new Label(this, SWT.CENTER);
final Font fontLabel = new Font(null, "华文新魏", 16, SWT.NORMAL);
l2.setFont(fontLabel);
l2.setText(" 机位号:");
l2.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
final Font fontText = new Font(null, "黑体", 18, SWT.NORMAL);
text1 = new Text(this, SWT.SINGLE | SWT.BORDER);
text1.setFont(fontText);
text1.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_GREEN));
text1.setTabs(7);
text1.setFocus();
text1.setEnabled(false);
final Color bkColor1 = new Color(Display.getCurrent(), 200, 200,
220);
text1.setBackground(bkColor1);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = 30;
text1.setLayoutData(gd);
Label l3 = new Label(this, SWT.CENTER);
l3.setFont(fontLabel);
l3.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
l3.setText(" 工号:");
text2 = new Text(this, SWT.SINGLE | SWT.BORDER);
text2.setFont(fontText);
text2.setTabs(8);
text2.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_GREEN));
text2.setBackground(bkColor1);
text2.setLayoutData(gd);
text2.setEnabled(false);
Label l4 = new Label(this, SWT.CENTER);
l4.setFont(fontLabel);
l4.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
l4.setText(" 调度员:");
text3 = new Text(this, SWT.SINGLE | SWT.BORDER);
text3.setFont(fontText);
text3.setTabs(9);
text3.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_GREEN));
text3.setBackground(bkColor1);
text3.setLayoutData(gd);
text3.setEnabled(false);
Label l5 = new Label(this, SWT.CENTER);
l5.setFont(fontLabel);
l5.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
l5.setText(" 作业类别:");
text4 = new Text(this, SWT.SINGLE | SWT.BORDER);
text4.setFont(fontText);
text4.setTabs(9);
text4.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_GREEN));
text4.setBackground(bkColor1);
text4.setLayoutData(gd);
text4.setEnabled(false);
FocusListener focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
Text t = (Text) e.widget;
textState = t.getTabs();
}
public void focusLost(FocusEvent e) {
Text t = (Text) e.widget;
}
};
text1.addFocusListener(focusListener);
text2.addFocusListener(focusListener);
text3.addFocusListener(focusListener);
text4.addFocusListener(focusListener);
}
}
public class ButtonComposite extends Composite {
Button buttonStart, buttonStop, buttonApply, buttonLogout;
public ButtonComposite(Composite c) {
super(c, SWT.BORDER);
RowLayout rl = new RowLayout();
rl.marginLeft = 40;
rl.spacing = 100;
rl.pack = false;
rl.marginBottom = 10;
rl.marginRight = 40;
rl.justify = true;
this.setLayout(rl);
buttonStart = new Button(this, SWT.BORDER);
final Font fontLabel = new Font(null, "华文新魏", 16, SWT.NORMAL);
buttonStart.setFont(fontLabel);
buttonStart.setText("作业开始");
buttonStart.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
buttonStop = new Button(this, SWT.BORDER);
buttonStop.setFont(fontLabel);
buttonStop.setText("作业完成");
buttonStop.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
buttonApply = new Button(this, SWT.BORDER);
buttonApply.setFont(fontLabel);
buttonApply.setText("请求调度");
buttonApply.setForeground(Display.getCurrent().getSystemColor(
SWT.COLOR_DARK_RED));
buttonLogout = new Button(this, SWT.BORDER);
buttonLogout.setFont(fontLabel);
buttonLogout.setText("下班注销");
buttonLogout.setForeground(Display.getCurrent().getSystemColor(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -