public void init(com.google.gwt.xml.client.Element srcEle, XulDomContainer container) { super.init(srcEle, container); if (srcEle.hasAttribute("selectedIndex") && srcEle.getAttribute("selectedIndex").trim().length() > 0) { try { setSelectedIndex(Integer.parseInt(srcEle.getAttribute("selectedIndex"))); } catch (Exception e) { e.printStackTrace(); } } }
@Override public void addChild(Element ele) { super.addChild(ele); this.container.add((Widget) ((XulComponent) ele).getManagedObject()); // sync with selectedIndex if (this.container.getVisibleWidget() != selectedIndex && selectedIndex < container.getWidgetCount()) { container.showWidget(selectedIndex); } }
@Override public void setAttribute(String name, String value) { super.setAttribute(name, value); try { Property prop = Property.valueOf(name.replace("pen:", "").toUpperCase()); switch (prop) { case SELECTEDINDEX: this.setSelectedIndex(Integer.valueOf(value)); break; } } catch (IllegalArgumentException e) { System.out.println( "Could not find Property in Enum for: " + name + " in class" + getClass().getName()); } }