@Override public void setValue(PersonProxy value) { createMutablePerson(value); addressPresenter.setValue(person.getAddress()); display.getName().setValue(person.getName()); display.getNote().setValue(person.getNote()); display.getDescription().setValue(person.getDescription()); mentorSelector.setValue(person.getMentor()); scheduleEditor.setValue(person.getClassSchedule()); }
@Override public PersonProxy getValue() { if (person == null) return person; person.setAddress(addressPresenter.getValue()); person.setName(display.getName().getValue()); person.setNote(display.getNote().getValue()); person.setDescription(display.getDescription().getValue()); person.setMentor(mentorSelector.getValue()); person.setClassSchedule(scheduleEditor.getValue()); return person; }
@Test public void testCreate() { final ImageJ context = ImageJ.createContext(DisplayService.class); final DisplayService displayService = context.getService(DisplayService.class); final String name = "Create"; // TODO: Reenable once DefaultDisplay is discoverable again. // final Double value = 12.34; final String value = "Some text to display."; final Display<?> display = displayService.createDisplay(name, value); // was the display created successfully? assertNotNull(display); // does the display have the proper context? assertEquals(context, display.getContext()); // does the display have the proper name? assertEquals(name, display.getName()); // does the display contain the required object? final Object result = display.get(0); assertNotNull(result); assertEquals(value, result); }