|
|
@ -1,6 +1,7 @@ |
|
|
|
package me.lensferno.dogename.controllers; |
|
|
|
package me.lensferno.dogename.controllers; |
|
|
|
|
|
|
|
|
|
|
|
import com.jfoenix.controls.JFXButton; |
|
|
|
import com.jfoenix.controls.JFXButton; |
|
|
|
|
|
|
|
import javafx.beans.property.StringProperty; |
|
|
|
import javafx.event.ActionEvent; |
|
|
|
import javafx.event.ActionEvent; |
|
|
|
import javafx.event.EventHandler; |
|
|
|
import javafx.event.EventHandler; |
|
|
|
import javafx.fxml.FXML; |
|
|
|
import javafx.fxml.FXML; |
|
|
@ -28,17 +29,17 @@ public class MiniPaneController { |
|
|
|
@FXML |
|
|
|
@FXML |
|
|
|
private JFXButton miniModeBtn; |
|
|
|
private JFXButton miniModeBtn; |
|
|
|
|
|
|
|
|
|
|
|
Stage forwStage; |
|
|
|
Stage oldStage; |
|
|
|
|
|
|
|
|
|
|
|
public Stage getForwStage() { |
|
|
|
public Stage getOldStage() { |
|
|
|
return forwStage; |
|
|
|
return oldStage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setForwStage(Stage forwStage) { |
|
|
|
public void setOldStage(Stage oldStage) { |
|
|
|
this.forwStage = forwStage; |
|
|
|
this.oldStage = oldStage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Random random=new Random(); |
|
|
|
private Random random = new Random(); |
|
|
|
private Data data; |
|
|
|
private Data data; |
|
|
|
|
|
|
|
|
|
|
|
Stage currentStage; |
|
|
|
Stage currentStage; |
|
|
@ -52,24 +53,32 @@ public class MiniPaneController { |
|
|
|
this.currentStage = currentStage; |
|
|
|
this.currentStage = currentStage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setBase(Data data, MainConfig mainConfig, Selector selector){ |
|
|
|
StringProperty[] oldTextProperties = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setBase(Data data, MainConfig mainConfig, Selector selector) { |
|
|
|
this.data = data; |
|
|
|
this.data = data; |
|
|
|
this.mainConfig=mainConfig; |
|
|
|
this.mainConfig = mainConfig; |
|
|
|
this.selector = selector; |
|
|
|
this.selector = selector; |
|
|
|
|
|
|
|
this.selector.setLabelTexts(chosenNameLabel.textProperty()); |
|
|
|
|
|
|
|
this.oldTextProperties = oldTextProperties; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@FXML |
|
|
|
@FXML |
|
|
|
void recoverMode(ActionEvent event) { |
|
|
|
void recoverMode(ActionEvent event) { |
|
|
|
this.forwStage.show(); |
|
|
|
this.oldStage.setOnShown((e) -> { |
|
|
|
|
|
|
|
selector.setLabelTexts(oldTextProperties); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
this.oldStage.show(); |
|
|
|
|
|
|
|
|
|
|
|
currentStage.close(); |
|
|
|
currentStage.close(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setListeners(){ |
|
|
|
public void setListeners() { |
|
|
|
EventHandler<MouseEvent> mouseHandler=new MoveWindowByMouse(currentStage); |
|
|
|
EventHandler<MouseEvent> mouseHandler = new MoveWindowByMouse(currentStage); |
|
|
|
chosenNameLabel.setOnMousePressed(mouseHandler); |
|
|
|
chosenNameLabel.setOnMousePressed(mouseHandler); |
|
|
|
chosenNameLabel.setOnMouseDragged(mouseHandler); |
|
|
|
chosenNameLabel.setOnMouseDragged(mouseHandler); |
|
|
|
|
|
|
|
|
|
|
|
EventHandler<TouchEvent> touchHandler=new MoveWindowByTouch(currentStage); |
|
|
|
EventHandler<TouchEvent> touchHandler = new MoveWindowByTouch(currentStage); |
|
|
|
chosenNameLabel.setOnTouchPressed(touchHandler); |
|
|
|
chosenNameLabel.setOnTouchPressed(touchHandler); |
|
|
|
chosenNameLabel.setOnTouchMoved(touchHandler); |
|
|
|
chosenNameLabel.setOnTouchMoved(touchHandler); |
|
|
|
|
|
|
|
|
|
|
@ -87,22 +96,22 @@ public class MiniPaneController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private MainConfig mainConfig; |
|
|
|
private MainConfig mainConfig; |
|
|
|
private Selector selector =new Selector(); |
|
|
|
private Selector selector = new Selector(); |
|
|
|
|
|
|
|
|
|
|
|
@FXML |
|
|
|
@FXML |
|
|
|
void anPai() { |
|
|
|
void anPai() { |
|
|
|
|
|
|
|
|
|
|
|
if(selector.isWorkerRunning()){ |
|
|
|
if (selector.isWorkerRunning()) { |
|
|
|
selector.forceStop(); |
|
|
|
selector.forceStop(); |
|
|
|
anPaiBtn.setText("安排一下"); |
|
|
|
anPaiBtn.setText("安排一下"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(mainConfig.getRandomCount()) { |
|
|
|
if (mainConfig.getRandomCount()) { |
|
|
|
mainConfig.setMaxTotalCount(100+random.nextInt(151)); |
|
|
|
mainConfig.setMaxTotalCount(100 + random.nextInt(151)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(mainConfig.getNameChoose()){ |
|
|
|
if (mainConfig.getNameChoose()) { |
|
|
|
runNameMode(); |
|
|
|
runNameMode(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
runNumberMode(); |
|
|
|
runNumberMode(); |
|
|
@ -110,13 +119,13 @@ public class MiniPaneController { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void runNameMode(){ |
|
|
|
private void runNameMode() { |
|
|
|
|
|
|
|
|
|
|
|
if(data.isEmpty()){ |
|
|
|
if (data.isEmpty()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(data.compareNameIgnoreList()&&mainConfig.getPassSelectedResult()){ |
|
|
|
if (data.compareNameIgnoreList() && mainConfig.getPassSelectedResult()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -125,22 +134,22 @@ public class MiniPaneController { |
|
|
|
selector.run(); |
|
|
|
selector.run(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void runNumberMode(){ |
|
|
|
private void runNumberMode() { |
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
int minNumber=Integer.parseInt(mainConfig.getMinNumber()); |
|
|
|
int minNumber = Integer.parseInt(mainConfig.getMinNumber()); |
|
|
|
int maxNumber=Integer.parseInt(mainConfig.getMaxNumber()); |
|
|
|
int maxNumber = Integer.parseInt(mainConfig.getMaxNumber()); |
|
|
|
|
|
|
|
|
|
|
|
if(maxNumber-minNumber<=0){ |
|
|
|
if (maxNumber - minNumber <= 0) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(data.getNumberIgnoreListSize()>=(maxNumber-minNumber+1) && mainConfig.getPassSelectedResult()){ |
|
|
|
if (data.getNumberIgnoreListSize() >= (maxNumber - minNumber + 1) && mainConfig.getPassSelectedResult()) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
} catch (Exception e) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|