Skip to content

Commit

Permalink
界面还是更新也英文的并优化按钮颜色
Browse files Browse the repository at this point in the history
  • Loading branch information
zouzg committed Aug 22, 2016
1 parent 189673e commit 1d7d36e
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 29 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ mybatis-generator-gui

mybatis-generator-gui是基于[mybatis generator](http://www.mybatis.org/generator/index.html)开发一款界面工具, 本工具可以使你非常容易及快速生成Mybatis的Java POJO文件及数据库Mapping文件。

![MainUI](https://cloud.githubusercontent.com/assets/3505708/16894610/0416f83a-4b8e-11e6-9a25-904f8d2e5583.png)
![MainUI](https://cloud.githubusercontent.com/assets/3505708/17854987/ab4ed078-68a8-11e6-824e-ada64d0b4ad1.png)

### 核心特性
* 按照界面步骤轻松生成代码,省去XML繁琐的学习与配置过程
* 保存数据库连接与配置,每次代码生成轻松搞定
* 保存数据库连接与Generator配置,每次代码生成轻松搞定
* 内置常用插件,比如offset
* 可选的去除掉对版本管理不友好的注释,这样新增或删除字段重新生成的文件比较过来清楚
* 目前已经支持Mysql、Oracle与PostgreSQL,如果有对其它数据库有需求的请提Issue我会跟进。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ protected void updateItem(Object item, boolean empty) {
setText(null);
setGraphic(null);
} else {
Button btn1 = new Button("应用");
Button btn2 = new Button("删除");
Button btn1 = new Button("Apply");
Button btn2 = new Button("Delete");
HBox hBox = new HBox();
hBox.setSpacing(10);
hBox.getChildren().add(btn1);
Expand Down
60 changes: 40 additions & 20 deletions src/main/resources/fxml/MainUI.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
</MenuBar>
<ToolBar minHeight="70.0" prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<items>
<Label fx:id="connectionLabel" contentDisplay="TOP" text="数据库连接">
<Label fx:id="connectionLabel" contentDisplay="TOP" text="Connections">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
<Label fx:id="configsLabel" contentDisplay="TOP" text="生成器配置" />
<Label fx:id="configsLabel" contentDisplay="TOP" text="Generator Configs" />
</items>
</ToolBar>
</children>
Expand Down Expand Up @@ -77,36 +77,44 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="数据库连接驱动" />
<Label text="Connector Jar" />
<TextField fx:id="connectorPathField" promptText="C:\path\mysql-connector-java-5.1.37.jar" GridPane.columnIndex="1" GridPane.columnSpan="2" />
<Button mnemonicParsing="false" onAction="#chooseConnectorFile" text="选择" GridPane.columnIndex="3">
<Button mnemonicParsing="false" onAction="#chooseConnectorFile" text="Choose" GridPane.columnIndex="3">
<GridPane.margin>
<Insets left="5.0" />
</GridPane.margin></Button>
<Label text="数据库表名" GridPane.rowIndex="1" />
</GridPane.margin>
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
<Label text="Table Name" GridPane.rowIndex="1" />
<TextField fx:id="tableNameField" promptText="person" GridPane.columnIndex="1" GridPane.rowIndex="1">
<GridPane.margin>
<Insets right="5.0" />
</GridPane.margin>
</TextField>
<Label text="Java Domain名" GridPane.rowIndex="2" />
<Label text="Domain Object Name" GridPane.rowIndex="2" />
<TextField fx:id="domainObjectNameField" promptText="Person" GridPane.columnIndex="1" GridPane.rowIndex="2">
<GridPane.margin>
<Insets right="5.0" />
</GridPane.margin>
</TextField>
<Label text="项目目录" GridPane.rowIndex="3" />
<Label text="Project Folder" GridPane.rowIndex="3" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="3">
<children>
<TextField fx:id="projectFolderField" prefHeight="27.0" prefWidth="348.0" promptText="D:\workspace\example">
<HBox.margin>
<Insets right="5.0" />
</HBox.margin>
</TextField>
<Button mnemonicParsing="false" onAction="#chooseProjectFolder" text="选择" />
<Button mnemonicParsing="false" onAction="#chooseProjectFolder" text="Choose">
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
</children>
</HBox>
<Label text="Model包名" GridPane.rowIndex="4" />
<Label text="Model Package" GridPane.rowIndex="4" />
<HBox alignment="CENTER_LEFT" prefHeight="27.0" prefWidth="261.0" spacing="10.0" GridPane.columnIndex="1" GridPane.rowIndex="4">
<children>
<TextField fx:id="modelTargetPackage" prefHeight="27.0" prefWidth="248.0" promptText="com.example.model">
Expand All @@ -116,9 +124,9 @@
</TextField>
</children>
</HBox>
<Label text="目标目录" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<Label text="Target Folder" GridPane.columnIndex="2" GridPane.rowIndex="4" />
<TextField fx:id="modelTargetProject" promptText="src/main/java" GridPane.columnIndex="3" GridPane.rowIndex="4" />
<Label text="DAO包名" GridPane.rowIndex="5" />
<Label text="DAO Package" GridPane.rowIndex="5" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0" GridPane.columnIndex="1" GridPane.rowIndex="5">
<children>
<TextField fx:id="daoTargetPackage" prefHeight="27.0" prefWidth="248.0" promptText="com.example.mapper">
Expand All @@ -128,9 +136,9 @@
</TextField>
</children>
</HBox>
<Label text="目标目录" GridPane.columnIndex="2" GridPane.rowIndex="5" />
<Label text="Target Folder" GridPane.columnIndex="2" GridPane.rowIndex="5" />
<TextField fx:id="daoTargetProject" promptText="src/main/java" GridPane.columnIndex="3" GridPane.rowIndex="5" />
<Label text="XML包名" GridPane.rowIndex="6" />
<Label text="Mapping XML Package" GridPane.rowIndex="6" />
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" spacing="10.0" GridPane.columnIndex="1" GridPane.rowIndex="6">
<children>
<TextField fx:id="mapperTargetPackage" prefHeight="27.0" prefWidth="248.0" promptText="com.example">
Expand All @@ -140,19 +148,31 @@
</TextField>
</children>
</HBox>
<Label text="目标目录" GridPane.columnIndex="2" GridPane.rowIndex="6" />
<Label text="Target Folder" GridPane.columnIndex="2" GridPane.rowIndex="6" />
<TextField fx:id="mappingTargetProject" promptText="src/main/resources" GridPane.columnIndex="3" GridPane.rowIndex="6" />
<HBox alignment="CENTER_LEFT" spacing="10.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="7">
<children>
<CheckBox fx:id="offsetLimitCheckBox" mnemonicParsing="false" selected="true" text="分页" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<CheckBox fx:id="commentCheckBox" mnemonicParsing="false" selected="true" text="数据库列注释作为Model属性注释" />
<CheckBox fx:id="offsetLimitCheckBox" mnemonicParsing="false" selected="true" text="Pagination" GridPane.columnIndex="1" GridPane.rowIndex="7" />
<CheckBox fx:id="commentCheckBox" mnemonicParsing="false" selected="true" text="Use Column Comments As Java Model Comments" />
</children>
</HBox>
<Button mnemonicParsing="false" onAction="#openTableColumnCustomizationPage" text="选择" GridPane.columnIndex="2" GridPane.rowIndex="2" />
<Button mnemonicParsing="false" onAction="#openTableColumnCustomizationPage" text="Choose" GridPane.columnIndex="2" GridPane.rowIndex="2">
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="10.0" GridPane.columnIndex="1" GridPane.columnSpan="3" GridPane.rowIndex="8">
<children>
<Button mnemonicParsing="false" onAction="#generateCode" text="代码生成" />
<Button mnemonicParsing="false" onAction="#saveGeneratorConfig" text="保存配置" />
<Button mnemonicParsing="false" onAction="#generateCode" text="Generate">
<styleClass>
<String fx:value="btn-success" />
<String fx:value="btn" />
</styleClass></Button>
<Button mnemonicParsing="false" onAction="#saveGeneratorConfig" text="Save Config">
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
</children>
</HBox>
</children>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fxml/generatorConfigs.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<children>
<TableView fx:id="configTable" layoutX="47.0" layoutY="53.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columns>
<TableColumn fx:id="nameColumn" prefWidth="75.0" text="配置名称" />
<TableColumn fx:id="opsColumn" editable="false" prefWidth="75.0" sortable="false" text="操作" />
<TableColumn fx:id="nameColumn" prefWidth="75.0" text="Config Name" />
<TableColumn fx:id="opsColumn" editable="false" prefWidth="75.0" sortable="false" text="Operations" />
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" />
Expand Down
18 changes: 15 additions & 3 deletions src/main/resources/fxml/newConnection.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,21 @@
</GridPane>
<AnchorPane layoutY="390.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0">
<children>
<Button layoutX="27.0" layoutY="6.0" mnemonicParsing="false" onAction="#testConnection" text="Test Connection" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="10.0" />
<Button layoutX="467.0" layoutY="12.0" mnemonicParsing="false" onAction="#saveConnection" prefHeight="28.0" prefWidth="61.0" styleClass="btn-primary" text="OK" textFill="WHITE" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0" />
<Button layoutX="427.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" AnchorPane.bottomAnchor="5.0" />
<Button layoutX="27.0" layoutY="6.0" mnemonicParsing="false" onAction="#testConnection" text="Test Connection" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="10.0">
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
<Button layoutX="467.0" layoutY="12.0" mnemonicParsing="false" onAction="#saveConnection" prefHeight="28.0" prefWidth="61.0" text="OK" textFill="WHITE" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0">
<styleClass>
<String fx:value="btn-success" />
<String fx:value="btn" />
</styleClass></Button>
<Button layoutX="427.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" AnchorPane.bottomAnchor="5.0">
<styleClass>
<String fx:value="btn" />
<String fx:value="btn-default" />
</styleClass></Button>
</children>
</AnchorPane>
</children>
Expand Down
28 changes: 28 additions & 0 deletions src/main/resources/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
-fx-border: none;
}

.btn {
-fx-border: 1px solid transparent;
-fx-border-radius: 4px;
}

.btn-primary {
-fx-background-color: #378bfa;
-fx-text-fill: white;
Expand All @@ -19,6 +24,29 @@
-fx-background-color: #579efa;
}

.btn-default {
-fx-text-fill: #333;
-fx-background-color: #fff;
-fx-border-color: #ccc;
}

.btn-default:hover {
-fx-background-color: #e6e6e6;
-fx-border-color: #adadad;
}

.btn-success:hover {
-fx-text-fill: #fff;
-fx-background-color: #449d44;
-fx-border-color: #398439;
}

.btn-success {
-fx-text-fill: #fff;
-fx-background-color: #5cb85c;
-fx-border-color: #4cae4c;
}

.consoleTextArea {
-fx-stroke: white;
-fx-fill: black;
Expand Down

0 comments on commit 1d7d36e

Please sign in to comment.