显示尺寸优化

master
王兵 4 years ago
parent 815dc05757
commit 96d4f7e2fb

@ -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) {

@ -4,8 +4,10 @@ import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.SplitPane;
import javafx.scene.control.TableView;
import javafx.scene.control.TreeView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
@ -31,6 +33,10 @@ public class MainController {
private Button sub;
@FXML
private CheckBox mcdx;
@FXML
private BorderPane borderPane;
@FXML
private SplitPane splitPane;
private JavaFxApplication main;
@ -90,6 +96,22 @@ public class MainController {
this.detail = detail;
}
public BorderPane getBorderPane() {
return borderPane;
}
public void setBorderPane(BorderPane borderPane) {
this.borderPane = borderPane;
}
public SplitPane getSplitPane() {
return splitPane;
}
public void setSplitPane(SplitPane splitPane) {
this.splitPane = splitPane;
}
@FXML
public void modelOpen(ActionEvent actionEvent) {
FileChooser fileChooser = new FileChooser();

@ -153,6 +153,22 @@ public class Field extends Table {
}
//10模糊
@Property("isLike")
private BooleanProperty isLike = new SimpleBooleanProperty();
public BooleanProperty isLikeProperty() {
return isLike;
}
public boolean getIsLike() {
return isLike.get();
}
public void setIsLike(boolean isLike) {
this.isLike.set(isLike);
}
//11搜索
@Property("isSearch")
private BooleanProperty isSearch = new SimpleBooleanProperty();

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Menu?>
@ -13,9 +12,8 @@
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.Pane?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0"
prefWidth="700.0" xmlns="http://javafx.com/javafx/8.0.91" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="xyz.wbsite.dbtool.javafx.ctrl.MainController">
<BorderPane xmlns="http://javafx.com/javafx/8.0.112" minWidth="765" minHeight="550" prefWidth="765" prefHeight="550"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="xyz.wbsite.dbtool.javafx.ctrl.MainController">
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
@ -48,15 +46,25 @@
</MenuBar>
</top>
<center>
<SplitPane dividerPositions="0.25" BorderPane.alignment="CENTER">
<SplitPane fx:id="splitPane"
dividerPositions="0.25">
<items>
<TreeView fx:id="dbtree" prefHeight="200.0" prefWidth="200.0"/>
<SplitPane dividerPositions="0.35" orientation="VERTICAL" prefHeight="200.0" prefWidth="160.0">
<TreeView fx:id="dbtree" minWidth="200" prefWidth="200" SplitPane.resizableWithParent="false"/>
<SplitPane dividerPositions="0.35" minWidth="200" prefWidth="200" orientation="VERTICAL" >
<items>
<Pane fx:id="detail" prefHeight="200.0" prefWidth="200.0"/>
<BorderPane>
<Pane fx:id="detail" minHeight="180" prefHeight="180" SplitPane.resizableWithParent="false"/>
<BorderPane fx:id="borderPane" minWidth="200" SplitPane.resizableWithParent="true">
<top>
<ToolBar prefHeight="30.0" BorderPane.alignment="CENTER">
<items>
<Button fx:id="add" mnemonicParsing="false" text=" + "/>
<Button fx:id="sub" mnemonicParsing="false" text=" - "/>
<CheckBox fx:id="mcdx" selected="true" text="表名大写"/>
</items>
</ToolBar>
</top>
<center>
<TableView fx:id="fields" prefHeight="200.0" prefWidth="200.0">
<TableView fx:id="fields">
<columns>
<TableColumn prefWidth="100" text="字段名"/>
<TableColumn prefWidth="90" text="类型"/>
@ -67,19 +75,11 @@
<TableColumn prefWidth="35" text="唯一"/>
<TableColumn prefWidth="35" text="查询"/>
<TableColumn prefWidth="35" text="模糊"/>
<TableColumn prefWidth="35" text="搜索"/>
<TableColumn prefWidth="90" text="注释"/>
</columns>
</TableView>
</center>
<top>
<ToolBar prefHeight="30.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<items>
<Button fx:id="add" mnemonicParsing="false" text=" + "/>
<Button fx:id="sub" mnemonicParsing="false" text=" - "/>
<CheckBox fx:id="mcdx" selected="true" text="表名大写" />
</items>
</ToolBar>
</top>
</BorderPane>
</items>
</SplitPane>

Loading…
Cancel
Save

Powered by TurnKey Linux.