CustomWindowNewDemo.java
6.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package cn.csbr.app.gui.page;
import cn.csbr.app.gui.page.useAndBackTab.*;
import cn.csbr.app.gui.util.CsButtonGroup;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.image.ImageView;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.stage.WindowEvent;
import org.controlsfx.control.PropertySheet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
@Component
public class CustomWindowNewDemo extends AbstractPage {
private Label inbtn=new Label(" 【入库】 0件");
private Label usebtn=new Label(" 【取货】 0件");
private Label backbtn=new Label(" 【还货】 0件");
@Autowired
private UseTabPage2 useTabPage;
@Autowired
private BackTabPage2 backTabPage;
@Autowired
private InboundTabPage2 inboundTabPage;
List<AppPage> apps=new ArrayList<AppPage>();
HBox hBbtns=null;
int curbtns=0;
Stage primaryStage;
int isshow = 0;
VBox center=null;
public void start(Stage stage) {
if(isshow == 1) {
isshow = 0;
primaryStage.close();
}
primaryStage = new Stage();
primaryStage.initOwner(stage);
//primaryStage.initModality(Modality.APPLICATION_MODAL);
primaryStage.initStyle(StageStyle.TRANSPARENT);
VBox root = new VBox();
hBbtns=new HBox();
hBbtns.getChildren().addAll(inbtn);
hBbtns.setStyle("-fx-border-width: 0 1 1 1;-fx-border-style: solid;-fx-border-color: #5BA7AA;");
hBbtns.setMinHeight(58);
hBbtns.setMaxHeight(58);
hBbtns.setMinWidth(1000);
hBbtns.setMaxWidth(1000);
inbtn.setStyle("-fx-background-color: #649fa3;-fx-background-radius: 0;-fx-text-alignment: center;-fx-text-fill: white");
inbtn.setMinWidth(140);
inbtn.setMinHeight(56);
inbtn.setOnMouseClicked(e->{
tablabe(0);
});
inbtn.setVisible(true);
if(inboundTabPage.getInbonudItemLength()<=0){
// inbtn.setVisible(false);
// inbtn.setMaxWidth(0);
hBbtns.getChildren().remove(inbtn);
}else {
inbtn.setText(" 【入库】 "+inboundTabPage.getInbonudItemLength()+"件");
apps.add(inboundTabPage);
}
hBbtns.getChildren().addAll(usebtn);
usebtn.setStyle("-fx-text-fill: white;-fx-background-color: #649fa3;-fx-background-radius: 0;-fx-text-alignment: center");
usebtn.setMinWidth(140);
usebtn.setMinHeight(56);
usebtn.setVisible(true);
usebtn.setOnMouseClicked(e->{
tablabe(1);
});
if(useTabPage.getInbonudItemLength()<=0){
hBbtns.getChildren().remove(usebtn);
}else {
usebtn.setText(" 【取货】 "+useTabPage.getInbonudItemLength()+"件");
apps.add(useTabPage);
}
hBbtns.getChildren().addAll(backbtn);
backbtn.setStyle("-fx-text-fill: white;-fx-background-color: #649fa3;-fx-background-radius: 0;-fx-text-alignment: center");
backbtn.setMinWidth(140);
backbtn.setMinHeight(56);
backbtn.setOnMouseClicked(e->{
tablabe(2);
});
backbtn.setVisible(true);
if(backTabPage.getInbonudItemLength()<=0){
hBbtns.getChildren().remove(backbtn);
}
else {
usebtn.setText(" 【还货】 "+backTabPage.getInbonudItemLength()+"件");
apps.add(backTabPage);
}
Label lbczr=new Label("操作人: 陈道箐");
lbczr.setTranslateX(460);
lbczr.setTranslateY(-20);
lbczr.setMinHeight(100);
lbczr.setMaxHeight(100);
lbczr.setMinWidth(100);
lbczr.setMaxWidth(100);
lbczr.setStyle("-fx-text-fill: black");
center=new VBox();
// center.setStyle("-fx-border-width: 1 1 1 1;-fx-border-style: solid;-fx-border-color: #5BA7AA;");
center.setMinHeight(800);
center.setMaxHeight(800);
center.setMinWidth(550);
center.setMaxWidth(550);
center.setTranslateX(25);
center.setTranslateY(-45);
center.getChildren().add(inboundTabPage.tabInboundContent());
Button closebtn=new Button("确认");
closebtn.setStyle("-fx-background-color: white;-fx-border-color: #bababa;-fx-border-radius: 6");
closebtn.setMinHeight(40);
closebtn.setMaxHeight(40);
closebtn.setMinWidth(160);
closebtn.setMaxWidth(160);
closebtn.setTranslateX(400);
closebtn.setTranslateY(-30);
closebtn.setOnMouseClicked(e->{
primaryStage.close();
});
root.getChildren().addAll(hBbtns,lbczr,center,closebtn);
// root.setStyle("");
Scene scene = new Scene(root, 600, 1000);
primaryStage.setScene(scene);
primaryStage.setX(70);
primaryStage.setY(120);
root.setStyle("-fx-background-color: white;-fx-border-color: #bababa;-fx-border-insets: 1 1 1 1");
tabfirst();
//tablabe(0);
if(isshow == 0) {
isshow = 1;
primaryStage.show();
}
primaryStage.setOnCloseRequest((WindowEvent event)->{
//mainPage.refreturn();
});
}
public void tablabe(int index){
this.curbtns=index;
for(int i=0;i<hBbtns.getChildren().size();i++){
if(i!=index){
// ((Label)hBbtns.getChildren().get(i)).setBackground((new Background(new BackgroundFill(Color.rgb(186, 186, 186), CornerRadii.EMPTY, Insets.EMPTY))));
hBbtns.getChildren().get(i).setStyle("-fx-background-color: #bababa");
}else {
hBbtns.getChildren().get(i).setStyle("-fx-background-color: #649fa3");
center.getChildren().clear();
center.getChildren().add(apps.get(i).constructNode());
//((Label)hBbtns.getChildren().get(i)).setBackground((new Background(new BackgroundFill(Color.rgb(100, 159, 163), CornerRadii.EMPTY, Insets.EMPTY))));
}
((Label)hBbtns.getChildren().get(i)).setTextFill(Color.WHITE);
}
}
public void tabfirst(){
for(int i=0;i<hBbtns.getChildren().size();i++){
if(hBbtns.getChildren().get(i).isVisible()){
tablabe(i);
return;
}
}
}
@Override
protected Node constructNode() {
return null;
}
@Override
public void refresh() {
}
}