Skip to content

Commit 3d7ea25

Browse files
committed
Format changes.
1 parent 5139de9 commit 3d7ea25

File tree

1 file changed

+148
-149
lines changed

1 file changed

+148
-149
lines changed

src/main/java/workspace/Editor.java

Lines changed: 148 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -23,153 +23,152 @@
2323

2424
public class Editor implements ModelListener {
2525

26-
protected List<SceneObject> sceneObjects;
27-
28-
protected UiComponent rootUi;
29-
30-
protected KeyCommandMap commands;
31-
32-
protected WorkspaceModel model;
33-
34-
protected ViewportCompass gizmo;
35-
36-
protected WorkspaceSideBarUi sideBar;
37-
38-
protected UiEditorMenu menu;
39-
40-
public Editor() {
41-
setup();
42-
}
43-
44-
private void setup() {
45-
setupLookAndFeel();
46-
initializeModel();
47-
initializeSceneObjects();
48-
initializeRootUi();
49-
createUi();
50-
initializeCommandMap();
51-
registerKeyCommands();
52-
}
53-
54-
@Override
55-
public void onModelChanged() {
56-
rootUi.setVisible(model.isUiVisible());
57-
}
58-
59-
private void initializeSceneObjects() {
60-
sceneObjects = new ArrayList<SceneObject>();
61-
}
62-
63-
private void createUi() {
64-
rootUi.add(getSideBar());
65-
rootUi.add(getGizmo());
66-
rootUi.add(getMenu());
67-
}
68-
69-
private WorkspaceSideBarUi getSideBar() {
70-
if (sideBar == null) {
71-
sideBar = new WorkspaceSideBarUi(model);
72-
}
73-
return sideBar;
74-
}
75-
76-
private ViewportCompass getGizmo() {
77-
if (gizmo == null) {
78-
gizmo = new ViewportCompass();
79-
}
80-
return gizmo;
81-
}
82-
83-
private UiEditorMenu getMenu() {
84-
if (menu == null) {
85-
menu = new UiEditorMenu();
86-
}
87-
return menu;
88-
}
89-
90-
private void initializeRootUi() {
91-
rootUi = new UiComponent();
92-
}
93-
94-
private void setupLookAndFeel() {
95-
LookAndFeel.setup();
96-
}
97-
98-
private void initializeCommandMap() {
99-
commands = new KeyCommandMap();
100-
}
101-
102-
private void initializeModel() {
103-
model = new WorkspaceModel();
104-
}
105-
106-
private void registerKeyCommands() {
107-
commands.register(new ShowHideGridCommand(model));
108-
commands.register(new ShowHideXAxisCommand(model));
109-
commands.register(new ShowHideYAxisCommand(model));
110-
commands.register(new ShowHideZAxisCommand(model));
111-
commands.register(new ShowHideSideBarCommand(model));
112-
commands.register(new ShowHideFaceNormalsCommand(model));
113-
commands.register(new ResetPanningCommand(model));
114-
commands.register(new ShowHideVertexNormalsCommand(model));
115-
commands.register(new ShowHideEdgesCommand(model));
116-
commands.register(new WireframeCommand(model));
117-
commands.register(new ShadeSmoothFlatCommand(model));
118-
}
119-
120-
private void resizeRootUi(int x, int y, int width, int height) {
121-
rootUi.setX(x);
122-
rootUi.setY(y);
123-
rootUi.setWidth(width);
124-
rootUi.setHeight(height);
125-
}
126-
127-
public void resize(int x, int y, int width, int height) {
128-
resizeRootUi(x, y, width, height);
129-
updateGizmo(width, height);
130-
}
131-
132-
public void handleMouseClicked(int x, int y) {
133-
rootUi.onMouseClicked(x, y);
134-
}
135-
136-
public void handleMousePressed(int x, int y) {
137-
rootUi.onMousePressed(x, y);
138-
}
139-
140-
public void handleMouseDragged(int x, int y) {
141-
rootUi.onMouseDragged(x, y);
142-
}
143-
144-
public void handleMouseReleased(int x, int y) {
145-
rootUi.onMouseReleased(x, y);
146-
}
147-
148-
public void handleMouseWheel(float amount) {
149-
float scale = model.getScale();
150-
scale -= amount * scale * 0.2f;
151-
model.setScale(scale);
152-
}
153-
154-
private void updateGizmo(int width, int height) {
155-
gizmo.setX(width - 80);
156-
gizmo.setY(130);
157-
}
158-
159-
public void add(UiComponent component) {
160-
rootUi.add(component);
161-
}
162-
163-
public void addSceneObject(SceneObject sceneObject) {
164-
sceneObjects.add(sceneObject);
165-
}
166-
167-
public void addAll(Collection<SceneObject> sceneObjects) {
168-
this.sceneObjects.addAll(sceneObjects);
169-
}
170-
171-
public void clearSceneObjects() {
172-
sceneObjects.clear();
173-
}
174-
26+
protected List<SceneObject> sceneObjects;
27+
28+
protected UiComponent rootUi;
29+
30+
protected KeyCommandMap commands;
31+
32+
protected WorkspaceModel model;
33+
34+
protected ViewportCompass gizmo;
35+
36+
protected WorkspaceSideBarUi sideBar;
37+
38+
protected UiEditorMenu menu;
39+
40+
public Editor() {
41+
setup();
42+
}
43+
44+
private void setup() {
45+
setupLookAndFeel();
46+
initializeModel();
47+
initializeSceneObjects();
48+
initializeRootUi();
49+
createUi();
50+
initializeCommandMap();
51+
registerKeyCommands();
52+
}
53+
54+
@Override
55+
public void onModelChanged() {
56+
rootUi.setVisible(model.isUiVisible());
57+
}
58+
59+
private void initializeSceneObjects() {
60+
sceneObjects = new ArrayList<SceneObject>();
61+
}
62+
63+
private void createUi() {
64+
rootUi.add(getSideBar());
65+
rootUi.add(getGizmo());
66+
rootUi.add(getMenu());
67+
}
68+
69+
private WorkspaceSideBarUi getSideBar() {
70+
if (sideBar == null) {
71+
sideBar = new WorkspaceSideBarUi(model);
72+
}
73+
return sideBar;
74+
}
75+
76+
private ViewportCompass getGizmo() {
77+
if (gizmo == null) {
78+
gizmo = new ViewportCompass();
79+
}
80+
return gizmo;
81+
}
82+
83+
private UiEditorMenu getMenu() {
84+
if (menu == null) {
85+
menu = new UiEditorMenu();
86+
}
87+
return menu;
88+
}
89+
90+
private void initializeRootUi() {
91+
rootUi = new UiComponent();
92+
}
93+
94+
private void setupLookAndFeel() {
95+
LookAndFeel.setup();
96+
}
97+
98+
private void initializeCommandMap() {
99+
commands = new KeyCommandMap();
100+
}
101+
102+
private void initializeModel() {
103+
model = new WorkspaceModel();
104+
}
105+
106+
private void registerKeyCommands() {
107+
commands.register(new ShowHideGridCommand(model));
108+
commands.register(new ShowHideXAxisCommand(model));
109+
commands.register(new ShowHideYAxisCommand(model));
110+
commands.register(new ShowHideZAxisCommand(model));
111+
commands.register(new ShowHideSideBarCommand(model));
112+
commands.register(new ShowHideFaceNormalsCommand(model));
113+
commands.register(new ResetPanningCommand(model));
114+
commands.register(new ShowHideVertexNormalsCommand(model));
115+
commands.register(new ShowHideEdgesCommand(model));
116+
commands.register(new WireframeCommand(model));
117+
commands.register(new ShadeSmoothFlatCommand(model));
118+
}
119+
120+
private void resizeRootUi(int x, int y, int width, int height) {
121+
rootUi.setX(x);
122+
rootUi.setY(y);
123+
rootUi.setWidth(width);
124+
rootUi.setHeight(height);
125+
}
126+
127+
public void resize(int x, int y, int width, int height) {
128+
resizeRootUi(x, y, width, height);
129+
updateGizmo(width, height);
130+
}
131+
132+
public void handleMouseClicked(int x, int y) {
133+
rootUi.onMouseClicked(x, y);
134+
}
135+
136+
public void handleMousePressed(int x, int y) {
137+
rootUi.onMousePressed(x, y);
138+
}
139+
140+
public void handleMouseDragged(int x, int y) {
141+
rootUi.onMouseDragged(x, y);
142+
}
143+
144+
public void handleMouseReleased(int x, int y) {
145+
rootUi.onMouseReleased(x, y);
146+
}
147+
148+
public void handleMouseWheel(float amount) {
149+
float scale = model.getScale();
150+
scale -= amount * scale * 0.2f;
151+
model.setScale(scale);
152+
}
153+
154+
private void updateGizmo(int width, int height) {
155+
gizmo.setX(width - 80);
156+
gizmo.setY(130);
157+
}
158+
159+
public void add(UiComponent component) {
160+
rootUi.add(component);
161+
}
162+
163+
public void addSceneObject(SceneObject sceneObject) {
164+
sceneObjects.add(sceneObject);
165+
}
166+
167+
public void addAll(Collection<SceneObject> sceneObjects) {
168+
this.sceneObjects.addAll(sceneObjects);
169+
}
170+
171+
public void clearSceneObjects() {
172+
sceneObjects.clear();
173+
}
175174
}

0 commit comments

Comments
 (0)