Skip to content

Commit e72b2d2

Browse files
committed
рефакторинг и реализация архитектуры создателей файлов.
реализован создатель материалов
1 parent 9019585 commit e72b2d2

34 files changed

+957
-115
lines changed

resources/messages/messages.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ EditorBarComponent.asset=Asset
22
EditorBarComponent.asset.openAsset=Open Asset Folder
33
EditorBarComponent.asset.openAsset.DirectoryChooser=Choose Asset
44

5+
AssetComponentResourceTreeContextMenuNewFile=New
56
AssetComponentResourceTreeContextMenuOpenFile=Open
67
AssetComponentResourceTreeContextMenuOpenWithFile=Open with
78
AssetComponentResourceTreeContextMenuCopyFile=Copy
@@ -44,3 +45,11 @@ MaterialRenderStateDepthWrite=Write to depth buffer
4445
MaterialRenderStateColorWrite=Write to color buffer
4546
MaterialRenderStateDepthTest=Test depth
4647
MaterialRenderStateWireframe=Wireframe
48+
49+
FileCreatorButtonOk=Create
50+
FileCreatorButtonCancel=Cancel
51+
FileCreatorFileNameLabel=File name
52+
53+
MaterialFileCreatorTitle=Creating material
54+
MaterialFileCreatorMaterialTypeLabel=Material type
55+
MaterialFileCreatorFileDescription=New material

resources/messages/messages_ru.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ EditorBarComponent.asset=Asset
22
EditorBarComponent.asset.openAsset=Открыть папку Asset
33
EditorBarComponent.asset.openAsset.DirectoryChooser=Выбор Asset
44

5+
AssetComponentResourceTreeContextMenuNewFile=Создать
56
AssetComponentResourceTreeContextMenuOpenFile=Открыть
67
AssetComponentResourceTreeContextMenuOpenWithFile=Открыть с помощью
78
AssetComponentResourceTreeContextMenuCopyFile=Копировать
@@ -44,3 +45,11 @@ MaterialRenderStateDepthWrite=Делать запись в буффер глуб
4445
MaterialRenderStateColorWrite=Делать запись в буффер цвета
4546
MaterialRenderStateDepthTest=Проверять ли буффер глубины
4647
MaterialRenderStateWireframe=Отрисовывать как сетку
48+
49+
FileCreatorButtonOk=Создать
50+
FileCreatorButtonCancel=Отменить
51+
FileCreatorFileNameLabel=Имя файла
52+
53+
MaterialFileCreatorTitle=Создание материала
54+
MaterialFileCreatorMaterialTypeLabel=Тип материала
55+
MaterialFileCreatorFileDescription=Новый материал

resources/ui/css/custom_classes.css

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,29 +98,45 @@
9898
-fx-padding: 0;
9999
}
100100

101+
.transparent-tree-view > .virtual-flow > .clipped-container > .sheet > .tree-cell:filled:selected {
102+
-fx-background: -fx-color-panel-50;
103+
-fx-background-insets: 0;
104+
-fx-table-cell-border-color: transparent;
105+
-fx-border-color: transparent;
106+
-fx-border-width: 0;
107+
}
108+
109+
.transparent-tree-view:focused > .virtual-flow > .clipped-container > .sheet > .tree-cell:filled:selected {
110+
-fx-background: -fx-color-500;
111+
-fx-background-insets: 0;
112+
-fx-table-cell-border-color: transparent;
113+
-fx-border-color: transparent;
114+
-fx-border-width: 0;
115+
}
116+
117+
118+
101119
/* Transparent TreeCell */
102120

103121
.transparent-tree-cell {
104122
-fx-background: transparent;
105123
-fx-padding: 0.25em; /* 3 */
106124
-fx-indent: 1em;
107125
}
126+
108127
.transparent-tree-cell .label {
109128
-fx-padding: 0.0em 0.0em 0.0em 0.25em; /* 0 0 0 3 */
110129
}
111-
.transparent-tree-cell > .tree-disclosure-node,
112-
.transparent-tree-table-row-cell > .tree-disclosure-node {
130+
.transparent-tree-cell > .tree-disclosure-node {
113131
-fx-padding: 4 6 4 8;
114132
-fx-background-color: transparent;
115133
}
116-
.transparent-tree-cell > .tree-disclosure-node > .arrow,
117-
.transparent-tree-table-row-cell > .tree-disclosure-node > .arrow {
134+
.transparent-tree-cell > .tree-disclosure-node > .arrow {
118135
-fx-background-color: -fx-font-color;
119136
-fx-padding: 0.333333em 0.229em 0.333333em 0.229em; /* 4 */
120137
-fx-shape: "M 0 -3.5 L 4 0 L 0 3.5 z";
121138
}
122-
.transparent-tree-cell:expanded > .tree-disclosure-node > .arrow,
123-
.transparent-tree-table-row-cell:expanded > .tree-disclosure-node > .arrow {
139+
.transparent-tree-cell:expanded > .tree-disclosure-node > .arrow {
124140
-fx-rotate: 90;
125141
}
126142

resources/ui/css/custom_ids.css

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,7 @@
110110
-fx-max-width: -fx-min-width;
111111
}
112112

113-
#AssetEditorDialogButtonContainer {
114-
-fx-alignment: center-right;
115-
-fx-min-height: 45;
116-
-fx-pref-height: -fx-min-height;
117-
-fx-max-height: -fx-min-height;
118-
}
119-
120-
#AssetEditorDialogButtonOk {
113+
#EditorDialogButtonOk {
121114
-fx-min-height: 28;
122115
-fx-pref-height: -fx-min-height;
123116
-fx-max-height: -fx-min-height;
@@ -126,7 +119,7 @@
126119
-fx-max-width: -fx-min-width;
127120
}
128121

129-
#AssetEditorDialogButtonCancel {
122+
#EditorDialogButtonCancel {
130123
-fx-min-height: 28;
131124
-fx-pref-height: -fx-min-height;
132125
-fx-max-height: -fx-min-height;
@@ -135,6 +128,13 @@
135128
-fx-max-width: -fx-min-width;
136129
}
137130

131+
#AssetEditorDialogButtonContainer {
132+
-fx-alignment: center-right;
133+
-fx-min-height: 45;
134+
-fx-pref-height: -fx-min-height;
135+
-fx-max-height: -fx-min-height;
136+
}
137+
138138
#AssetEditorDialogPreviewContainer {
139139
-fx-border-color: -fx-color-0;
140140
-fx-border-width: 1;
@@ -239,4 +239,20 @@
239239
-fx-min-height: 25;
240240
-fx-pref-height: -fx-min-height;
241241
-fx-max-height: -fx-min-height;
242-
}
242+
}
243+
244+
#FileCreatorLabel {
245+
-fx-alignment: center-right;
246+
-fx-min-width: 120;
247+
-fx-pref-width: -fx-min-width;
248+
-fx-max-width: -fx-min-width;
249+
-fx-min-height: 25;
250+
-fx-pref-height: -fx-min-height;
251+
-fx-max-height: -fx-min-height;
252+
}
253+
254+
#FileCreatorTextField {
255+
-fx-min-height: 25;
256+
-fx-pref-height: -fx-min-height;
257+
-fx-max-height: -fx-min-height;
258+
}

src/com/ss/editor/Editor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import java.nio.file.Path;
3636
import java.nio.file.Paths;
3737
import java.util.concurrent.locks.StampedLock;
38-
import java.util.logging.Level;
3938

4039
import rlib.concurrent.atomic.AtomicInteger;
4140
import rlib.logging.Logger;
@@ -62,7 +61,6 @@ public void done(LightProbe result) {
6261

6362
private static final Editor EDITOR = new Editor();
6463

65-
6664
public static Editor getInstance() {
6765
return EDITOR;
6866
}
@@ -108,7 +106,7 @@ public static void start(String[] args) throws IOException {
108106
protected static void configureLogger() {
109107

110108
// выключаем стандартный логгер
111-
java.util.logging.Logger.getLogger("").setLevel(Level.SEVERE);
109+
// java.util.logging.Logger.getLogger("").setLevel(Level.SEVERE);
112110

113111
// настраиваем логгер
114112
LoggerLevel.DEBUG.setEnabled(false);

src/com/ss/editor/FolderAssetLocator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public class FolderAssetLocator implements AssetLocator {
2020

2121
@Override
2222
public void setRootPath(String rootPath) {
23-
2423
}
2524

2625
@Override

src/com/ss/editor/Messages.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class Messages {
1515
public static final String EDITOR_BAR_ASSET_OPEN_ASSET;
1616
public static final String EDITOR_BAR_ASSET_OPEN_ASSET_DIRECTORY_CHOOSER;
1717

18+
public static final String ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_NEW_FILE;
1819
public static final String ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_OPEN_FILE;
1920
public static final String ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_OPEN_WITH_FILE;
2021
public static final String ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_COPY_FILE;
@@ -58,6 +59,14 @@ public class Messages {
5859
public static final String POST_FILTER_EDITOR_NAME;
5960
public static final String MATERIAL_EDITOR_NAME;
6061

62+
public static final String FILE_CREATOR_BUTTON_OK;
63+
public static final String FILE_CREATOR_BUTTON_CANCEL;
64+
public static final String FILE_CREATOR_FILE_NAME_LABEL;
65+
66+
public static final String MATERIAL_FILE_CREATOR_TITLE;
67+
public static final String MATERIAL_FILE_CREATOR_MATERIAL_TYPE_LABEL;
68+
public static final String MATERIAL_FILE_CREATOR_FILE_DESCRIPTION;
69+
6170
static {
6271

6372
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, ResourceControl.getInstance());
@@ -66,6 +75,7 @@ public class Messages {
6675
EDITOR_BAR_ASSET_OPEN_ASSET = bundle.getString("EditorBarComponent.asset.openAsset");
6776
EDITOR_BAR_ASSET_OPEN_ASSET_DIRECTORY_CHOOSER = bundle.getString("EditorBarComponent.asset.openAsset.DirectoryChooser");
6877

78+
ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_NEW_FILE = bundle.getString("AssetComponentResourceTreeContextMenuNewFile");
6979
ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_OPEN_FILE = bundle.getString("AssetComponentResourceTreeContextMenuOpenFile");
7080
ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_OPEN_WITH_FILE = bundle.getString("AssetComponentResourceTreeContextMenuOpenWithFile");
7181
ASSET_COMPONENT_RESOURCE_TREE_CONTEXT_MENU_COPY_FILE = bundle.getString("AssetComponentResourceTreeContextMenuCopyFile");
@@ -108,5 +118,13 @@ public class Messages {
108118
TEXT_FILE_EDITOR_NAME = bundle.getString("TextFileEditorName");
109119
POST_FILTER_EDITOR_NAME = bundle.getString("PostFilterEditorName");
110120
MATERIAL_EDITOR_NAME = bundle.getString("MaterialEditorName");
121+
122+
FILE_CREATOR_BUTTON_OK = bundle.getString("FileCreatorButtonOk");
123+
FILE_CREATOR_BUTTON_CANCEL = bundle.getString("FileCreatorButtonCancel");
124+
FILE_CREATOR_FILE_NAME_LABEL = bundle.getString("FileCreatorFileNameLabel");
125+
126+
MATERIAL_FILE_CREATOR_TITLE = bundle.getString("MaterialFileCreatorTitle");
127+
MATERIAL_FILE_CREATOR_MATERIAL_TYPE_LABEL = bundle.getString("MaterialFileCreatorMaterialTypeLabel");
128+
MATERIAL_FILE_CREATOR_FILE_DESCRIPTION = bundle.getString("MaterialFileCreatorFileDescription");
111129
}
112130
}

src/com/ss/editor/executor/impl/EditorThreadExecutor.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.ss.editor.executor.impl;
22

3-
import rlib.logging.Logger;
4-
import rlib.logging.LoggerManager;
53
import rlib.util.array.Array;
64
import rlib.util.array.ArrayFactory;
75

@@ -12,8 +10,6 @@
1210
*/
1311
public class EditorThreadExecutor {
1412

15-
private static final Logger LOGGER = LoggerManager.getLogger(EditorThreadExecutor.class);
16-
1713
private static final EditorThreadExecutor INSTANCE = new EditorThreadExecutor();
1814

1915
public static EditorThreadExecutor getInstance() {

src/com/ss/editor/manager/ExecutorManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class ExecutorManager {
2424

2525
private static final Runtime RUNTIME = Runtime.getRuntime();
2626

27-
public static final int PROP_BACKGROUND_TASK_EXECUTORS = RUNTIME.availableProcessors();
27+
private static final int PROP_BACKGROUND_TASK_EXECUTORS = RUNTIME.availableProcessors();
2828

2929
private static ExecutorManager instance;
3030

src/com/ss/editor/manager/FileIconManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import rlib.logging.LoggerManager;
1818
import rlib.manager.InitializeManager;
1919

20-
import static com.ss.editor.util.EditorUtil.normalizePath;
20+
import static com.ss.editor.util.EditorUtil.toClasspath;
2121
import static java.lang.String.valueOf;
2222

2323
/**
@@ -71,7 +71,7 @@ public Image getIcon(final Path path, int size) {
7171
LOGGER.warning(e);
7272
}
7373

74-
if(contentType == null && FILE_TYPE_MAP != null) {
74+
if (contentType == null && FILE_TYPE_MAP != null) {
7575
contentType = FILE_TYPE_MAP.getContentType(path.toFile());
7676
}
7777

@@ -90,13 +90,13 @@ public Image getIcon(final Path path, int size) {
9090
final Path mimeTypes = Paths.get("/ui/icons/faenza/mimetypes");
9191

9292
Path iconPath = mimeTypes.resolve(valueOf(size)).resolve(contentType + ".png");
93-
String url = normalizePath(iconPath);
93+
String url = toClasspath(iconPath);
9494

9595
LOGGER.info("url " + url);
9696

9797
if (!EditorUtil.checkExists(url)) {
9898
iconPath = mimeTypes.resolve(valueOf(size)).resolve("none.png");
99-
url = normalizePath(iconPath);
99+
url = toClasspath(iconPath);
100100
}
101101

102102
return getImage(url);

0 commit comments

Comments
 (0)