|
@@ -19,6 +19,7 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
|
private final ToolbarContext context;
|
|
|
private JLabel demoToolStatus;
|
|
|
private Timer uiTimer;
|
|
|
+ HashMap<String, JCheckBox> boxes=new HashMap<>();
|
|
|
|
|
|
|
|
|
MyToolbarContribution(ToolbarContext context) {
|
|
@@ -36,11 +37,21 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
CompletableFuture<Integer> fPos = Activator.daemonInterface.getpos();
|
|
|
- CompletableFuture<String> fStatus = Activator.daemonInterface.getstatus();
|
|
|
+ CompletableFuture<Map<String, Object>> fStatus = Activator.daemonInterface.getstatus();
|
|
|
CompletableFuture.allOf(fPos, fStatus).whenComplete((aVoid, throwable) -> {
|
|
|
Date now = new Date();
|
|
|
try {
|
|
|
- updateText(String.format("Position: %d, read at %tF %tT.<br/>%s", fPos.get(), now, now, fStatus.get()));
|
|
|
+ Map<String, Object> asd = fStatus.get();
|
|
|
+ for(JCheckBox cb: boxes.values()) {
|
|
|
+ String cbName=cb.getName();
|
|
|
+ Object val= asd.get(cbName);
|
|
|
+ if(val instanceof Boolean) {
|
|
|
+ cb.setSelected((Boolean) val);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //updateText(String.format("Position: %d, read at %tF %tT.<br/>%s", fPos.get(), now, now, fStatus.get()));
|
|
|
+ updateText(String.format("Position: %d, read at %tF %tT.<br/>", fPos.get(), now, now));
|
|
|
} catch (InterruptedException|ExecutionException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -113,7 +124,10 @@ class MyToolbarContribution implements SwingToolbarContribution {
|
|
|
}
|
|
|
|
|
|
private JCheckBox newCheckbox(String name) {
|
|
|
- return new JCheckBox(name);
|
|
|
+ JCheckBox cb=new JCheckBox(name);
|
|
|
+ cb.setName(name);
|
|
|
+ boxes.put(name, cb);
|
|
|
+ return cb;
|
|
|
}
|
|
|
|
|
|
private Box createHeader() {
|