@SuppressWarnings("unused") @CallOnUpdate private void privateMethod() { privateCount++; }
private static Collection<Binding> wire(final CallOnUpdate callOnUpdate, final BindingContext context, final ObjectFieldMethod method) { final String to = callOnUpdate.model(); final BindableModel model; if (Strings.isNullOrEmpty(to)) { Set<BindableModel> models = context.getBindableModels(); if (models.size() != 1) { throw new BindingException("more than one bindable model for empty 'to'"); //$NON-NLS-1$ } model = models.iterator().next(); } else { model = context.getBindableModel(to); if (model == null) { throw new BindingException("can't find method to bind to: " + to); //$NON-NLS-1$ } } final String[] ons = callOnUpdate.on(); List<Object> onObjects = BindingContext.getOnObjects(ons, model); Binding binding = makeBinding(method, onObjects); model.bind(binding); return ImmutableList.of(binding); }
@CallOnUpdate(model = "DerivedView.otherModel") public void otherCount2() { otherCount++; } }
@CallOnUpdate(model = "demoModel", on = "LIST") public void callback2() { count2++; }
@CallOnUpdate(model = "otherModel") public void otherCount() { otherCount++; }
@CallOnUpdate(model = "demoModel") public void callback1() { count1++; }
@CallOnUpdate(on = {"MULTI_1", "MULTI_2"}) public void multiMethod() { multiCount++; }
@CallOnUpdate(on = "SPECIFIC") public void specificMethod() { specificCount++; }
@CallOnUpdate(model = "m2") public void m2Update() { m2Count++; } }
@CallOnUpdate public void publicMethod() { publicCount++; }
@CallOnUpdate(model = "BaseView.model") public void superCount() { superCount++; }
@CallOnUpdate(model = "demoModel", on = "LIST") public void callback2() { count2++; }
@CallOnUpdate(model = "demoModel") public void callback1() { count1++; }
@CallOnUpdate(model = "m1") public void m1Update() { m1Count++; }
@CallOnUpdate(model = "DerivedView.model") public void thisCount() { thisCount++; }
@CallOnUpdate(model = "demoModel", on = "LIST") public void listChanged() { ++listChangeCount; listChangedLabel.setText("list changes: " + listChangeCount); }
@CallOnUpdate(model = "foo") public void shouldFail() { throw new IllegalStateException(); } }
@CallOnUpdate public void shouldFail() { throw new IllegalStateException(); } }
@CallOnUpdate(on = "foo") public void shouldFail() { throw new IllegalStateException(); } }
@CallOnUpdate(model = "demoModel") public void updateBackgroundColor() { Color color = null; if (demoModel.getDemoEnum() == DemoEnum.BAZ) { color = Color.RED; } panel.setBackground(color); panel.repaint(); }