Skip to content

Commit d07499d

Browse files
committed
updated dialogs
1 parent 6a6f5d6 commit d07499d

File tree

5 files changed

+72
-54
lines changed

5 files changed

+72
-54
lines changed

resources/ui/css/custom_ids.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@
677677
-fx-min-height: 24;
678678
-fx-pref-height: -fx-min-height;
679679
-fx-max-height: -fx-min-height;
680-
-fx-min-width: 350;
680+
-fx-min-width: 250;
681681
-fx-pref-width: -fx-min-width;
682682
-fx-max-width: -fx-min-width;
683683
}

src/com/ss/editor/ui/component/asset/tree/context/menu/action/RenameFileAction.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.ss.editor.ui.component.asset.tree.resource.ResourceElement;
66
import com.ss.editor.ui.dialog.RenameDialog;
77
import com.ss.editor.ui.event.FXEventManager;
8-
import com.ss.editor.ui.event.impl.RenamedFileEvent;
98
import com.ss.editor.ui.scene.EditorFXScene;
109
import com.ss.editor.util.EditorUtil;
1110

@@ -85,13 +84,6 @@ private void processRename(final String newFileName) {
8584
Files.move(file, newFile);
8685
} catch (IOException e) {
8786
EditorUtil.handleException(null, this, e);
88-
return;
8987
}
90-
91-
final RenamedFileEvent event = new RenamedFileEvent();
92-
event.setPrevFile(file);
93-
event.setNewFile(newFile);
94-
95-
FX_EVENT_MANAGER.notify(event);
9688
}
9789
}

src/com/ss/editor/ui/dialog/EditorDialog.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import javafx.geometry.Pos;
1616
import javafx.scene.control.Button;
1717
import javafx.scene.control.Label;
18+
import javafx.scene.input.KeyCode;
19+
import javafx.scene.input.KeyEvent;
1820
import javafx.scene.layout.HBox;
1921
import javafx.scene.layout.StackPane;
2022
import javafx.scene.layout.VBox;
@@ -55,6 +57,13 @@ protected void createControls(final VBox root) {
5557
createHeader(root);
5658
createContent(root);
5759
createActions(root);
60+
addEventHandler(KeyEvent.KEY_RELEASED, this::processKey);
61+
}
62+
63+
protected void processKey(final KeyEvent event) {
64+
if (event.getCode() == KeyCode.ESCAPE) {
65+
hide();
66+
}
5867
}
5968

6069
@Override

src/com/ss/editor/ui/dialog/RenameDialog.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.ss.editor.ui.css.CSSClasses;
66
import com.ss.editor.ui.css.CSSIds;
77

8-
import java.awt.*;
8+
import java.awt.Point;
99
import java.util.function.Consumer;
1010
import java.util.function.Function;
1111

@@ -15,42 +15,44 @@
1515
import javafx.scene.control.Label;
1616
import javafx.scene.control.TextField;
1717
import javafx.scene.input.KeyCode;
18+
import javafx.scene.input.KeyEvent;
1819
import javafx.scene.layout.HBox;
1920
import javafx.scene.layout.VBox;
2021
import javafx.stage.Window;
2122
import rlib.ui.util.FXUtils;
2223

2324
/**
24-
* Реализация диалога для ввода нового имени.
25+
* The implementation of a dialog for renaming.
2526
*
26-
* @author Ronn
27+
* @author JavaSaBr
2728
*/
2829
public class RenameDialog extends EditorDialog {
2930

3031
private static final Insets OK_BUTTON_OFFSET = new Insets(0, 4, 0, 0);
3132
private static final Insets CANCEL_BUTTON_OFFSET = new Insets(0, 15, 0, 0);
33+
private static final Insets NAME_OFFSET = new Insets(20, CANCEL_BUTTON_OFFSET.getRight(), 20, 0);
3234

3335
private static final Point DIALOG_SIZE = new Point(400, 140);
3436

3537
private static final ExecutorManager EXECUTOR_MANAGER = ExecutorManager.getInstance();
3638

3739
/**
38-
* Функция валидирования имени.
40+
* The function for validation name.
3941
*/
4042
private Function<String, Boolean> validator;
4143

4244
/**
43-
* Функция обработки введеного имени.
45+
* The function for handling a new name.
4446
*/
4547
private Consumer<String> handler;
4648

4749
/**
48-
* Поле для ввода имени.
50+
* The text field.
4951
*/
5052
private TextField nameField;
5153

5254
/**
53-
* Кнопка приминения.
55+
* The ok button.
5456
*/
5557
private Button okButton;
5658

@@ -76,16 +78,7 @@ protected void createContent(final VBox root) {
7678
FXUtils.addClassTo(nameLabel, CSSClasses.MAIN_FONT_13);
7779
FXUtils.addClassTo(nameField, CSSClasses.MAIN_FONT_13);
7880

79-
VBox.setMargin(nameContainer, new Insets(20, CANCEL_BUTTON_OFFSET.getRight(), 20, 0));
80-
81-
root.setOnKeyReleased(event -> {
82-
83-
final Button okButton = getOkButton();
84-
85-
if (event.getCode() == KeyCode.ENTER && !okButton.isDisable()) {
86-
processOk();
87-
}
88-
});
81+
VBox.setMargin(nameContainer, NAME_OFFSET);
8982
}
9083

9184
@Override
@@ -100,57 +93,57 @@ protected String getTitleText() {
10093
}
10194

10295
/**
103-
* @param initName изначальное имя.
96+
* @param initName the initial name.
10497
*/
10598
public void setInitName(final String initName) {
10699
final TextField nameField = getNameField();
107100
nameField.setText(initName);
108101
}
109102

110103
/**
111-
* @return поле для ввода имени.
104+
* @return the text field.
112105
*/
113106
private TextField getNameField() {
114107
return nameField;
115108
}
116109

117110
/**
118-
* @return кнопка приминения.
111+
* @return the ok button.
119112
*/
120113
private Button getOkButton() {
121114
return okButton;
122115
}
123116

124117
/**
125-
* @return функция валидирования имени.
118+
* @return the function for validation name.
126119
*/
127120
public Function<String, Boolean> getValidator() {
128121
return validator;
129122
}
130123

131124
/**
132-
* @param validator функция валидирования имени.
125+
* @param validator the function for validation name.
133126
*/
134127
public void setValidator(final Function<String, Boolean> validator) {
135128
this.validator = validator;
136129
}
137130

138131
/**
139-
* @return функция обработки введеного имени.
132+
* @return the function for handling a new name.
140133
*/
141134
private Consumer<String> getHandler() {
142135
return handler;
143136
}
144137

145138
/**
146-
* @param handler функция обработки введеного имени.
139+
* @param handler the function for handling a new name.
147140
*/
148141
public void setHandler(final Consumer<String> handler) {
149142
this.handler = handler;
150143
}
151144

152145
/**
153-
* Валидация нового имени.
146+
* Validate a new name.
154147
*/
155148
private void validateName(final String name) {
156149
final Function<String, Boolean> validator = getValidator();
@@ -177,12 +170,23 @@ protected void createActions(final VBox root) {
177170
FXUtils.addToPane(cancelButton, container);
178171
FXUtils.addToPane(container, root);
179172

173+
FXUtils.addClassTo(okButton, CSSClasses.SPECIAL_FONT_16);
174+
FXUtils.addClassTo(cancelButton, CSSClasses.SPECIAL_FONT_16);
175+
180176
HBox.setMargin(okButton, OK_BUTTON_OFFSET);
181177
HBox.setMargin(cancelButton, CANCEL_BUTTON_OFFSET);
182178
}
183179

180+
@Override
181+
protected void processKey(final KeyEvent event) {
182+
super.processKey(event);
183+
if (event.getCode() == KeyCode.ENTER) {
184+
processOk();
185+
}
186+
}
187+
184188
/**
185-
* Процесс принятия выборанного имени.
189+
* Finish this dialog.
186190
*/
187191
private void processOk() {
188192

src/com/ss/editor/ui/dialog/model/GenerateTangentsDialog.java

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.ss.editor.ui.dialog.model;
22

3+
import static javafx.collections.FXCollections.observableArrayList;
4+
35
import com.jme3.scene.Geometry;
46
import com.jme3.scene.Mesh;
57
import com.ss.editor.Messages;
@@ -13,7 +15,7 @@
1315
import com.ss.editor.ui.dialog.EditorDialog;
1416
import com.ss.editor.util.GeomUtils;
1517

16-
import java.awt.*;
18+
import java.awt.Point;
1719

1820
import javafx.geometry.Insets;
1921
import javafx.geometry.Pos;
@@ -22,23 +24,23 @@
2224
import javafx.scene.control.ComboBox;
2325
import javafx.scene.control.Label;
2426
import javafx.scene.control.SingleSelectionModel;
27+
import javafx.scene.input.KeyCode;
28+
import javafx.scene.input.KeyEvent;
2529
import javafx.scene.layout.HBox;
2630
import javafx.scene.layout.VBox;
2731
import rlib.ui.util.FXUtils;
2832

29-
import static javafx.collections.FXCollections.observableArrayList;
30-
3133
/**
32-
* Реализация диалога генерации тангентов.
34+
* The implementation of a dialog for generating tangents.
3335
*
34-
* @author Ronn
36+
* @author JavaSaBr
3537
*/
3638
public class GenerateTangentsDialog extends EditorDialog {
3739

3840
private static final Insets OK_BUTTON_OFFSET = new Insets(0, 4, 0, 0);
3941
private static final Insets CANCEL_BUTTON_OFFSET = new Insets(0, 15, 0, 0);
4042

41-
private static final Point DIALOG_SIZE = new Point(600, 160);
43+
private static final Point DIALOG_SIZE = new Point(500, 160);
4244

4345
private static final Insets ALGORITHM_OFFSET = new Insets(15, 0, 0, 0);
4446
private static final Insets SPLIT_OFFSET = new Insets(8, 0, 10, 150);
@@ -50,27 +52,27 @@ public enum AlgorithmType {
5052
}
5153

5254
/**
53-
* Компонент структуры модели.
55+
* The model tree component.
5456
*/
5557
private final ModelNodeTree nodeTree;
5658

5759
/**
58-
* Узел модели.
60+
* The generated node.
5961
*/
6062
private final ModelNode<?> node;
6163

6264
/**
63-
* Комбобокс с выбором алгоритма.
65+
* The list of types.
6466
*/
6567
private ComboBox<AlgorithmType> algorithmTypeComboBox;
6668

6769
/**
68-
* Флаг необходимости разделять зеркальные UV.
70+
* The check box about spliting morrored.
6971
*/
7072
private CheckBox splitMirroredCheckBox;
7173

7274
/**
73-
* Кнопка генерации.
75+
* The ok button.
7476
*/
7577
private Button okButton;
7678

@@ -80,14 +82,14 @@ public GenerateTangentsDialog(final ModelNodeTree nodeTree, final ModelNode<?> n
8082
}
8183

8284
/**
83-
* @return компонент структуры модели.
85+
* @return the model tree component.
8486
*/
8587
protected ModelNodeTree getNodeTree() {
8688
return nodeTree;
8789
}
8890

8991
/**
90-
* @return узел модели.
92+
* @return the generated node.
9193
*/
9294
protected ModelNode<?> getNode() {
9395
return node;
@@ -125,14 +127,22 @@ protected void createContent(final VBox root) {
125127

126128
FXUtils.addToPane(splitMirroredCheckBox, root);
127129

128-
FXUtils.addClassTo(algorithmTypeLabel, CSSClasses.MAIN_FONT_13);
129-
FXUtils.addClassTo(splitMirroredCheckBox, CSSClasses.MAIN_FONT_13);
130-
FXUtils.addClassTo(splitMirroredCheckBox, CSSClasses.MAIN_FONT_13);
130+
FXUtils.addClassTo(algorithmTypeLabel, CSSClasses.SPECIAL_FONT_13);
131+
FXUtils.addClassTo(splitMirroredCheckBox, CSSClasses.SPECIAL_FONT_13);
132+
FXUtils.addClassTo(splitMirroredCheckBox, CSSClasses.SPECIAL_FONT_13);
131133

132134
VBox.setMargin(algorithmTypeContainer, ALGORITHM_OFFSET);
133135
VBox.setMargin(splitMirroredCheckBox, SPLIT_OFFSET);
134136
}
135137

138+
@Override
139+
protected void processKey(final KeyEvent event) {
140+
super.processKey(event);
141+
if (event.getCode() == KeyCode.ENTER) {
142+
processOk();
143+
}
144+
}
145+
136146
@Override
137147
protected void createActions(final VBox root) {
138148
super.createActions(root);
@@ -152,26 +162,29 @@ protected void createActions(final VBox root) {
152162
FXUtils.addToPane(cancelButton, container);
153163
FXUtils.addToPane(container, root);
154164

165+
FXUtils.addClassTo(okButton, CSSClasses.SPECIAL_FONT_16);
166+
FXUtils.addClassTo(cancelButton, CSSClasses.SPECIAL_FONT_16);
167+
155168
HBox.setMargin(okButton, OK_BUTTON_OFFSET);
156169
HBox.setMargin(cancelButton, CANCEL_BUTTON_OFFSET);
157170
}
158171

159172
/**
160-
* @return флаг необходимости разделять зеркальные UV.
173+
* @return the check box about spliting morrored.
161174
*/
162175
private CheckBox getSplitMirroredCheckBox() {
163176
return splitMirroredCheckBox;
164177
}
165178

166179
/**
167-
* @return комбобокс с выбором алгоритма.
180+
* @return the list of types.
168181
*/
169182
private ComboBox<AlgorithmType> getAlgorithmTypeComboBox() {
170183
return algorithmTypeComboBox;
171184
}
172185

173186
/**
174-
* Обработка генерации.
187+
* Handle generating.
175188
*/
176189
private void processOk() {
177190

0 commit comments

Comments
 (0)