-
Notifications
You must be signed in to change notification settings - Fork 4
/
IGui.java
599 lines (516 loc) · 12.3 KB
/
IGui.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
/*******************************************************************************************************
*
* IGui.java, in msi.gama.core, is part of the source code of the GAMA modeling and simulation platform (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
********************************************************************************************************/
package msi.gama.common.interfaces;
import java.util.List;
import java.util.Map;
import msi.gama.common.interfaces.IDisplayCreator.DisplayDescription;
import msi.gama.kernel.experiment.IExperimentPlan;
import msi.gama.kernel.experiment.IParameter;
import msi.gama.kernel.model.IModel;
import msi.gama.kernel.simulation.SimulationAgent;
import msi.gama.metamodel.agent.IAgent;
import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.IShape;
import msi.gama.outputs.IDisplayOutput;
import msi.gama.outputs.LayeredDisplayOutput;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaColor;
import msi.gama.util.GamaFont;
import msi.gama.util.GamaMapFactory;
import msi.gama.util.IList;
import msi.gama.util.IMap;
import msi.gama.util.file.IFileMetaDataProvider;
import msi.gaml.architecture.user.UserPanelStatement;
import msi.gaml.descriptions.ActionDescription;
import msi.gaml.statements.test.CompoundSummary;
import msi.gaml.statements.test.TestExperimentSummary;
/**
* The interface IGui. Represents objects that act on behalf of a concrete GUI implementation (RCP, Headless, etc.)
*
* @author drogoul
* @since 18 dec. 2011
*
*/
public interface IGui {
/** The error. */
int ERROR = 0;
/** The wait. */
int WAIT = 1;
/** The inform. */
int INFORM = 2;
/** The neutral. */
int NEUTRAL = 3;
/** The user. */
int USER = 4;
/** The displays. */
Map<String, DisplayDescription> DISPLAYS = GamaMapFactory.createUnordered();
/** The monitor view id. */
String MONITOR_VIEW_ID = "msi.gama.application.view.MonitorView";
/** The interactive console view id. */
String INTERACTIVE_CONSOLE_VIEW_ID = "msi.gama.application.view.InteractiveConsoleView";
/** The agent view id. */
String AGENT_VIEW_ID = "msi.gama.application.view.AgentInspectView";
/** The table view id. */
String TABLE_VIEW_ID = "msi.gama.application.view.TableAgentInspectView";
/** The layer view id. */
String LAYER_VIEW_ID = "msi.gama.application.view.LayeredDisplayView";
/** The gl layer view id. */
String GL_LAYER_VIEW_ID = "msi.gama.application.view.OpenGLDisplayView";
/** The gl layer view id2. */
String GL_LAYER_VIEW_ID2 = "msi.gama.application.view.OpenGLDisplayView2";
/** The gl layer view id3. */
String GL_LAYER_VIEW_ID3 = "msi.gama.application.view.WebDisplayView";
/** The error view id. */
String ERROR_VIEW_ID = "msi.gama.application.view.ErrorView";
/** The test view id. */
String TEST_VIEW_ID = "msi.gama.application.view.TestView";
/** The parameter view id. */
String PARAMETER_VIEW_ID = "msi.gama.application.view.ParameterView";
/** The navigator view id. */
String NAVIGATOR_VIEW_ID = "msi.gama.gui.view.GamaNavigator";
/** The navigator lightweight decorator id. */
String NAVIGATOR_LIGHTWEIGHT_DECORATOR_ID = "msi.gama.application.decorator";
/** The console view id. */
String CONSOLE_VIEW_ID = "msi.gama.application.view.ConsoleView";
/** The user control view id. */
String USER_CONTROL_VIEW_ID = "msi.gama.views.userControlView";
/** The paused. */
String PAUSED = "STOPPED";
/** The finished. */
String FINISHED = "FINISHED";
/** The running. */
String RUNNING = "RUNNING";
/** The notready. */
String NOTREADY = "NOTREADY";
/** The none. */
String NONE = "NONE";
/** The perspective modeling id. */
String PERSPECTIVE_MODELING_ID = "msi.gama.application.perspectives.ModelingPerspective";
/**
* Gets the status.
*
* @param scope
* the scope
* @return the status
*/
IStatusDisplayer getStatus();
/**
* Gets the console.
*
* @return the console
*/
IConsoleDisplayer getConsole();
/**
* Show view.
*
* @param scope
* the scope
* @param viewId
* the view id
* @param name
* the name
* @param code
* the code
* @return the i gama view
*/
IGamaView showView(IScope scope, String viewId, String name, int code);
/**
* Tell.
*
* @param message
* the message
*/
void tell(String message);
/**
* Error.
*
* @param error
* the error
*/
void error(String error);
/**
* Show parameter view.
*
* @param scope
* the scope
* @param exp
* the exp
*/
void showParameterView(IScope scope, IExperimentPlan exp);
/**
* Clear errors.
*
* @param scope
* the scope
*/
void clearErrors(IScope scope);
/**
* Runtime error.
*
* @param scope
* the scope
* @param g
* the g
*/
void runtimeError(final IScope scope, GamaRuntimeException g);
/**
* Confirm close.
*
* @param experiment
* the experiment
* @return true, if successful
*/
boolean confirmClose(IExperimentPlan experiment);
/**
* Copy to clipboard.
*
* @param text
* the text
* @return true, if successful
*/
boolean copyToClipboard(String text);
/**
* Open simulation perspective.
*
* @param model
* the model
* @param experimentId
* the experiment id
* @return true, if successful
*/
boolean openSimulationPerspective(IModel model, String experimentId);
/**
* Gets the all display surfaces.
*
* @return the all display surfaces
*/
Iterable<IDisplaySurface> getAllDisplaySurfaces();
/**
* Gets the frontmost display surface.
*
* @return the frontmost display surface
*/
IDisplaySurface getFrontmostDisplaySurface();
/**
* Creates the display surface for.
*
* @param output
* the output
* @param args
* the args
* @return the i display surface
*/
IDisplaySurface createDisplaySurfaceFor(final LayeredDisplayOutput output, final Object... args);
/**
* Open user input dialog.
*
* @param scope
* the scope
* @param title
* the title
* @param parameters
* the parameters
* @param font
* the font
* @param color
* the color
* @return the map
*/
Map<String, Object> openUserInputDialog(IScope scope, String title, List<IParameter> parameters, GamaFont font,
GamaColor color);
/**
* Open wizard.
*
* @param scope
* the scope
* @param title
* the title
* @param finish
* the finish
* @param pages
* the pages
* @return the i map
*/
IMap<String, IMap<String, Object>> openWizard(IScope scope, String title, ActionDescription finish,
IList<IMap<String, Object>> pages);
/**
* Open user input dialog confirm.
*
* @param scope
* the scope
* @param title
* the title
* @param message
* the message
* @return the boolean
*/
Boolean openUserInputDialogConfirm(final IScope scope, final String title, final String message);
/**
* Open user control panel.
*
* @param scope
* the scope
* @param panel
* the panel
*/
void openUserControlPanel(IScope scope, UserPanelStatement panel);
/**
* Close dialogs.
*
* @param scope
* the scope
*/
void closeDialogs(IScope scope);
/**
* Gets the highlighted agent.
*
* @return the highlighted agent
*/
IAgent getHighlightedAgent();
/**
* Sets the highlighted agent.
*
* @param a
* the new highlighted agent
*/
void setHighlightedAgent(IAgent a);
/**
* Sets the selected agent.
*
* @param a
* the new selected agent
*/
void setSelectedAgent(IAgent a);
/**
* Update parameter view.
*
* @param scope
* the scope
* @param exp
* the exp
*/
void updateParameterView(IScope scope, IExperimentPlan exp);
/**
* Prepare for experiment.
*
* @param scope
* the scope
* @param exp
* the exp
*/
void prepareForExperiment(IScope scope, IExperimentPlan exp);
/**
* Clean after experiment.
*/
void cleanAfterExperiment();
/**
* Edits the model.
*
* @param scope
* the scope
* @param eObject
* the e object
*/
void editModel(IScope scope, Object eObject);
/**
* Run model.
*
* @param object
* the object
* @param exp
* the exp
*/
void runModel(final Object object, final String exp);
/**
* Update speed display.
*
* @param scope
* the scope
* @param d
* the d
* @param notify
* the notify
*/
void updateSpeedDisplay(IScope scope, Double d, boolean notify);
/**
* Gets the meta data provider.
*
* @return the meta data provider
*/
IFileMetaDataProvider getMetaDataProvider();
/**
* Close simulation views.
*
* @param scope
* the scope
* @param andOpenModelingPerspective
* the and open modeling perspective
* @param immediately
* the immediately
*/
void closeSimulationViews(IScope scope, boolean andOpenModelingPerspective, boolean immediately);
/**
* Gets the display description for.
*
* @param name
* the name
* @return the display description for
*/
DisplayDescription getDisplayDescriptionFor(final String name);
/**
* Gets the experiment state.
*
* @param uid
* the uid
* @return the experiment state
*/
String getExperimentState(String uid);
/**
* Update experiment state.
*
* @param scope
* the scope
* @param state
* the state
*/
void updateExperimentState(IScope scope, String state);
/**
* Update experiment state.
*
* @param scope
* the scope
*/
void updateExperimentState(IScope scope);
/**
* Update view title.
*
* @param output
* the output
* @param agent
* the agent
*/
void updateViewTitle(IDisplayOutput output, SimulationAgent agent);
/**
* Open welcome page.
*
* @param b
* the b
*/
void openWelcomePage(boolean b);
/**
* Update decorator.
*
* @param string
* the string
*/
void updateDecorator(String string);
/**
* Run.
*
* @param taskName
* the task name
* @param opener
* the opener
* @param asynchronous
* the asynchronous
*/
void run(String taskName, Runnable opener, boolean asynchronous);
/**
* Sets the focus on.
*
* @param o
* the new focus on
*/
void setFocusOn(IShape o);
/**
* Apply layout.
*
* @param scope
* the scope
* @param layout
* the layout
*/
void applyLayout(IScope scope, Object layout);
/**
* Display errors.
*
* @param scope
* the scope
* @param newExceptions
* the new exceptions
*/
void displayErrors(IScope scope, List<GamaRuntimeException> newExceptions);
/**
* Gets the mouse location in model.
*
* @return the mouse location in model
*/
GamaPoint getMouseLocationInModel();
/**
* Sets the mouse location in model.
*
* @param modelCoordinates
* the new mouse location in model
*/
void setMouseLocationInModel(GamaPoint modelCoordinates);
/**
* Gets the gaml label provider.
*
* @return the gaml label provider
*/
IGamlLabelProvider getGamlLabelProvider();
/**
* Exit.
*/
void exit();
// Tests
/**
* Open test view.
*
* @param scope
* the scope
* @param remainOpen
* the remain open
* @return the i gama view. test
*/
IGamaView.Test openTestView(IScope scope, boolean remainOpen);
/**
* Display tests results.
*
* @param scope
* the scope
* @param summary
* the summary
*/
void displayTestsResults(IScope scope, CompoundSummary<?, ?> summary);
/**
* End test display.
*/
void endTestDisplay();
/**
* Run headless tests.
*
* @param model
* the model
* @return the list
*/
List<TestExperimentSummary> runHeadlessTests(final Object model);
/**
* Refresh navigator.
*/
void refreshNavigator();
/**
* Checks if is in display thread.
*
* @return true, if is in display thread
*/
boolean isInDisplayThread();
}