public void select() { ComponentAgent parent = AuUtility.lookupEventTarget(target, Events.ON_SELECT); Set<String> items = new HashSet<String>(); items.add(target.getUuid()); String desktopId = target.getDesktop().getId(); Event event = new SelectEvent( Events.ON_SELECT, (Component) parent.getDelegatee(), items, (Component) target.getDelegatee()); Map<String, Object> data = EventDataManager.getInstance().build(event); ((ClientCtrl) target.getClient()) .postUpdate(desktopId, event.getName(), parent.getUuid(), data, null); }
public RenderAgent getOperation(final ComponentAgent target) { if (!target.is(Listbox.class)) { throw new AgentException("target " + target + " cannot transfer to Listbox"); } return new RendererAgentImpl(target); }
@Test public void test() { DesktopAgent desktop = connect(); ComponentAgent cmdBtn = desktop.query("#cmdBtn"); ComponentAgent addBtn = desktop.query("#addBtn"); ComponentAgent rmBtn = desktop.query("#rmBtn"); ComponentAgent msg = desktop.query("#msg"); cmdBtn.click(); assertEquals("inner command triggered", msg.as(Label.class).getValue()); for (int i = 0; i < 3; i++) { rmBtn.click(); assertEquals("", msg.as(Label.class).getValue()); cmdBtn.click(); assertEquals("inner command triggered", msg.as(Label.class).getValue()); addBtn.click(); assertEquals("", msg.as(Label.class).getValue()); cmdBtn.click(); assertEquals("inner command triggered", msg.as(Label.class).getValue()); assertEquals("inner command triggered", msg.as(Label.class).getValue()); } }
@Test public void test() { DesktopAgent desktop = connect(); ComponentAgent tb1 = desktop.query("#tb1"); ComponentAgent tb2 = desktop.query("#tb2"); ComponentAgent tb3 = desktop.query("#tb3"); ComponentAgent tb4 = desktop.query("#tb4"); ComponentAgent save1 = desktop.query("#save1"); ComponentAgent lb1 = desktop.query("#lb1"); assertEquals("", tb1.as(Textbox.class).getValue()); assertEquals("", tb2.as(Textbox.class).getValue()); assertEquals("", tb3.as(Textbox.class).getValue()); assertEquals("", tb4.as(Textbox.class).getValue()); assertEquals("", lb1.as(Label.class).getValue()); tb1.type("A"); assertEquals("A", tb2.as(Textbox.class).getValue()); assertEquals("A", tb3.as(Textbox.class).getValue()); assertEquals("A", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("A", lb1.as(Label.class).getValue()); tb2.type("B"); assertEquals("B", tb1.as(Textbox.class).getValue()); assertEquals("B", tb3.as(Textbox.class).getValue()); assertEquals("B", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("B", lb1.as(Label.class).getValue()); tb3.type("C"); assertEquals("C", tb1.as(Textbox.class).getValue()); assertEquals("C", tb2.as(Textbox.class).getValue()); assertEquals("C", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("C", lb1.as(Label.class).getValue()); tb4.type("D"); assertEquals("D", tb1.as(Textbox.class).getValue()); assertEquals("D", tb2.as(Textbox.class).getValue()); assertEquals("D", tb3.as(Textbox.class).getValue()); save1.click(); assertEquals("D", lb1.as(Label.class).getValue()); tb1.type("E"); assertEquals("E", tb2.as(Textbox.class).getValue()); assertEquals("E", tb3.as(Textbox.class).getValue()); assertEquals("E", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("E", lb1.as(Label.class).getValue()); tb2.type("F"); assertEquals("F", tb1.as(Textbox.class).getValue()); assertEquals("F", tb3.as(Textbox.class).getValue()); assertEquals("F", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("F", lb1.as(Label.class).getValue()); tb3.type("G"); assertEquals("G", tb1.as(Textbox.class).getValue()); assertEquals("G", tb2.as(Textbox.class).getValue()); assertEquals("G", tb4.as(Textbox.class).getValue()); save1.click(); assertEquals("G", lb1.as(Label.class).getValue()); tb4.type("H"); assertEquals("H", tb1.as(Textbox.class).getValue()); assertEquals("H", tb2.as(Textbox.class).getValue()); assertEquals("H", tb3.as(Textbox.class).getValue()); save1.click(); assertEquals("H", lb1.as(Label.class).getValue()); ComponentAgent tb5 = desktop.query("#tb5"); ComponentAgent tb6 = desktop.query("#tb6"); ComponentAgent tb7 = desktop.query("#tb7"); ComponentAgent tb8 = desktop.query("#tb8"); ComponentAgent save2 = desktop.query("#save2"); ComponentAgent lb2 = desktop.query("#lb2"); ComponentAgent lb3 = desktop.query("#lb3"); assertEquals("", tb5.as(Textbox.class).getValue()); assertEquals("", tb6.as(Textbox.class).getValue()); assertEquals("", tb7.as(Textbox.class).getValue()); assertEquals("", tb8.as(Textbox.class).getValue()); assertEquals("", lb2.as(Label.class).getValue()); assertEquals("", lb3.as(Label.class).getValue()); tb5.type("A"); assertEquals("A", tb6.as(Textbox.class).getValue()); assertEquals("", tb7.as(Textbox.class).getValue()); assertEquals("", tb8.as(Textbox.class).getValue()); tb6.type("B"); assertEquals("B", tb5.as(Textbox.class).getValue()); assertEquals("", tb7.as(Textbox.class).getValue()); assertEquals("", tb8.as(Textbox.class).getValue()); tb7.type("C"); assertEquals("B", tb5.as(Textbox.class).getValue()); assertEquals("B", tb6.as(Textbox.class).getValue()); assertEquals("C", tb8.as(Textbox.class).getValue()); tb8.type("D"); assertEquals("B", tb5.as(Textbox.class).getValue()); assertEquals("B", tb6.as(Textbox.class).getValue()); assertEquals("D", tb7.as(Textbox.class).getValue()); save2.click(); assertEquals("B", lb2.as(Label.class).getValue()); assertEquals("D", lb3.as(Label.class).getValue()); }
@Test public void test() { DesktopAgent desktop = connect(); ComponentAgent outerbox = desktop.query("#outerbox"); ComponentAgent min = desktop.query("#min"); ComponentAgent clean = desktop.query("#clean"); ComponentAgent select = desktop.query("#select"); ComponentAgent showselect = desktop.query("#showselect"); outerbox.queryAll("comboitem").get(0).as(SelectAgent.class).select(); showselect.click(); assertEquals("0", min.as(Label.class).getValue()); outerbox.queryAll("comboitem").get(2).as(SelectAgent.class).select(); showselect.click(); assertEquals("2", min.as(Label.class).getValue()); clean.click(); assertEquals("", outerbox.as(Combobox.class).getValue()); showselect.click(); assertEquals("-1", min.as(Label.class).getValue()); select.click(); assertEquals("B", outerbox.as(Combobox.class).getValue()); showselect.click(); assertEquals("1", min.as(Label.class).getValue()); }