|
|
|
@ -16,6 +16,7 @@ import javafx.scene.control.CheckBox;
|
|
|
|
|
import javafx.scene.control.ContextMenu;
|
|
|
|
|
import javafx.scene.control.MenuItem;
|
|
|
|
|
import javafx.scene.control.RadioButton;
|
|
|
|
|
import javafx.scene.control.SplitPane;
|
|
|
|
|
import javafx.scene.control.TableCell;
|
|
|
|
|
import javafx.scene.control.TableColumn;
|
|
|
|
|
import javafx.scene.control.TableView;
|
|
|
|
@ -94,11 +95,13 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void start(Stage primaryStage) throws Exception {
|
|
|
|
|
this.primaryStage = primaryStage;
|
|
|
|
|
JavaFxApplication.primaryStage = primaryStage;
|
|
|
|
|
BorderPane root = mMainLoader.getRoot();
|
|
|
|
|
|
|
|
|
|
primaryStage.setTitle("DBtool");
|
|
|
|
|
primaryStage.setScene(new Scene(root, 700, 500));
|
|
|
|
|
primaryStage.setMinWidth(765 + 45);
|
|
|
|
|
primaryStage.setMinHeight(550 + 40);
|
|
|
|
|
primaryStage.setScene(new Scene(root));
|
|
|
|
|
primaryStage.centerOnScreen();
|
|
|
|
|
primaryStage.show();
|
|
|
|
|
|
|
|
|
@ -283,7 +286,7 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
TextFieldTreeCell textFieldTreeCell = new TextFieldTreeCell(new DefaultStringConverter());
|
|
|
|
|
textFieldTreeCell.setEditable(false);
|
|
|
|
|
// creating cell from deafult factory
|
|
|
|
|
TreeCell treeCell = textFieldTreeCell.forTreeView().call(param);
|
|
|
|
|
TreeCell treeCell = TextFieldTreeCell.forTreeView().call(param);
|
|
|
|
|
// setting handlers
|
|
|
|
|
textFieldTreeCell.setOnDragDetected(new EventHandler<MouseEvent>() {
|
|
|
|
|
@Override
|
|
|
|
@ -291,11 +294,7 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
TextFieldTreeCell source = (TextFieldTreeCell) event.getSource();
|
|
|
|
|
String text = source.getText();
|
|
|
|
|
Module dbByDBName = projectManager.findDBByDBName(text);
|
|
|
|
|
if (dbByDBName != null) {
|
|
|
|
|
dragMD = true;
|
|
|
|
|
} else {
|
|
|
|
|
dragMD = false;
|
|
|
|
|
}
|
|
|
|
|
dragMD = dbByDBName != null;
|
|
|
|
|
if (dragMD) {
|
|
|
|
|
System.out.println("拖拽模块:" + text);
|
|
|
|
|
} else {
|
|
|
|
@ -303,7 +302,7 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
}
|
|
|
|
|
Dragboard md = source.startDragAndDrop(TransferMode.ANY);
|
|
|
|
|
ClipboardContent content = new ClipboardContent();
|
|
|
|
|
content.putString((String) source.getText());
|
|
|
|
|
content.putString(source.getText());
|
|
|
|
|
md.setContent(content);
|
|
|
|
|
event.consume();
|
|
|
|
|
}
|
|
|
|
@ -1424,8 +1423,42 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
return checkBoxTableCell;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
columns.get(8).setCellValueFactory(new PropertyValueFactory("isSearch"));
|
|
|
|
|
columns.get(8).setCellValueFactory(new PropertyValueFactory("isLike"));
|
|
|
|
|
columns.get(8).setCellFactory(new Callback<TableColumn, TableCell>() {
|
|
|
|
|
@Override
|
|
|
|
|
public TableCell call(TableColumn param) {
|
|
|
|
|
final DBCheckBoxTableCell checkBoxTableCell = new DBCheckBoxTableCell();
|
|
|
|
|
DBCheckBoxTableCell.sCallback sCallback = checkBoxTableCell.new sCallback() {
|
|
|
|
|
@Override
|
|
|
|
|
public ObservableValue<Boolean> call(Integer param) {
|
|
|
|
|
super.call(param);
|
|
|
|
|
List<Field> fields = currentTable.getFields();
|
|
|
|
|
if (fields.get(param).getIsSystem()) {
|
|
|
|
|
checkBoxTableCell.setInvalid(true);
|
|
|
|
|
} else {
|
|
|
|
|
checkBoxTableCell.setInvalid(false);
|
|
|
|
|
}
|
|
|
|
|
if (fields.get(param).getIsLike()) {
|
|
|
|
|
return new SimpleBooleanProperty(true);
|
|
|
|
|
} else {
|
|
|
|
|
return new SimpleBooleanProperty(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
checkBoxTableCell.setSelectedStateCallback(sCallback);
|
|
|
|
|
checkBoxTableCell.setOnChangeListener(new ChangeListener<Boolean>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
|
|
|
|
|
int param1 = checkBoxTableCell.getParam();
|
|
|
|
|
Field field = currentTable.getFields().get(param1);
|
|
|
|
|
field.setIsLike(newValue);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return checkBoxTableCell;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
columns.get(9).setCellValueFactory(new PropertyValueFactory("isSearch"));
|
|
|
|
|
columns.get(9).setCellFactory(new Callback<TableColumn, TableCell>() {
|
|
|
|
|
@Override
|
|
|
|
|
public TableCell call(TableColumn param) {
|
|
|
|
|
final DBCheckBoxTableCell checkBoxTableCell = new DBCheckBoxTableCell();
|
|
|
|
@ -1458,8 +1491,8 @@ public class JavaFxApplication extends Application {
|
|
|
|
|
return checkBoxTableCell;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
columns.get(9).setCellValueFactory(new PropertyValueFactory("fieldComment"));
|
|
|
|
|
columns.get(9).setCellFactory(new Callback<TableColumn, TableCell>() {
|
|
|
|
|
columns.get(10).setCellValueFactory(new PropertyValueFactory("fieldComment"));
|
|
|
|
|
columns.get(10).setCellFactory(new Callback<TableColumn, TableCell>() {
|
|
|
|
|
@Override
|
|
|
|
|
public TableCell call(TableColumn param) {
|
|
|
|
|
|
|
|
|
|