+ setupDrawMapEnabled();
+ setupBackgroundColor();
+ setupColoringObjects();
+ setupColorBarOptions();
+ setupSizingObjects();
+ setupSizeBarOptions();
+ }
+
+ private void setupDrawMapEnabled() {
+ sessionContext.getSession().asyncRequest(new DrawMapEnabledRequest(getInputResource()), new DrawMapEnabledListener(
+ result -> canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), result ? Commands.MAP_ENABLE : Commands.MAP_DISABLE)),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+ private void setupBackgroundColor() {
+ sessionContext.getSession().asyncRequest(new MapBackgroundColorRequest(getInputResource()), new MapBackgroundColorListener(
+ result -> queueBackgroundColorChangeEvent(result),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+ private void queueBackgroundColorChangeEvent(RGB.Integer result) {
+ if (result != null) {
+ Color backgroundColor = new Color(result.red, result.green, result.blue);
+ canvasContext.getDefaultHintContext().setHint(MapCommands.KEY_MAP_BACKGROUND_COLOR, backgroundColor);
+ canvasContext.getEventQueue().queueEvent(new CommandEvent(canvasContext, System.currentTimeMillis(), MapCommands.MAP_BACKGROUND_COLOR_CHANGE));
+ }
+ }
+
+ private void setupColoringObjects() {
+ sessionContext.getSession().asyncRequest(new ColoringObjectsRequest(getInputResource()), new ColoringObjectsListener(
+ result -> queueColoringObjectsChangeEvent(result),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+
+ private void setupColorBarOptions() {
+ sessionContext.getSession().asyncRequest(new ColorBarOptionsRequest(getInputResource()), new ColorBarOptionsListener(
+ result -> queueColorBarOptionsChangeEvent(result),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+ private void setupSizingObjects() {
+ sessionContext.getSession().asyncRequest(new SizingObjectsRequest(getInputResource()), new SizingObjectsListener(
+ result -> queueSizingObjectsChangeEvent(result),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+
+ private void setupSizeBarOptions() {
+ sessionContext.getSession().asyncRequest(new SizeBarOptionsRequest(getInputResource()), new SizeBarOptionsListener(
+ result -> queueSizeBarOptionsChangeEvent(result),
+ () -> DistrictDiagramViewer.this.isDisposed()));
+ }
+
+ public static final Key KEY_MAP_COLOR_BAR_OPTIONS = new KeyOf(ColorBarOptions.class, "colorBarOptions");
+ public static final Command MAP_COLOR_BAR_OPTIONS_CHANGE = new Command("colorBarOptionsChange");
+ public static final Key KEY_MAP_SIZE_BAR_OPTIONS = new KeyOf(SizeBarOptions.class, "sizeBarOptions");
+ public static final Command MAP_SIZE_BAR_OPTIONS_CHANGE = new Command("sizeBarOptionsChange");
+
+ public static final Key KEY_MAP_COLORING_OBJECTS = new KeyOf(Map.class, "coloringObjects");
+ public static final Command MAP_COLORING_OBJECTS_CHANGE = new Command("coloringObjectsChange");
+
+ public static final Key KEY_MAP_SIZING_OBJECTS = new KeyOf(Map.class, "sizingObjects");
+ public static final Command MAP_SIZING_OBJECTS_CHANGE = new Command("sizingObjectsChange");