Package com.google.gwt.xml.client

Examples of com.google.gwt.xml.client.Node


        NodeList list = xml.getElementsByTagName("json");
        List<FormRepresentation> retval = new ArrayList<FormRepresentation>();
        FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
                String json = getText(node);
                try {
                    FormRepresentation form = decoder.decode(json);
                    retval.add(form);
                } catch (FormEncodingException e) {
View Full Code Here


    public Map<String, List<FBMenuItem>> readMenuMap(String responseText) {
        Document xml = XMLParser.parse(responseText);
        Map<String, List<FBMenuItem>> menuItems = new HashMap<String, List<FBMenuItem>>();
        NodeList groups = xml.getElementsByTagName("menuGroup");
        for (int index = 0; index < groups.getLength(); index++) {
            Node groupNode = groups.item(index);
            String groupName = ((Element) groupNode).getAttribute("name");
            NodeList items = ((Element) groupNode).getElementsByTagName("menuItem");
            menuItems.put(groupName, readMenuItems(items, groupName));
        }
        return menuItems;
View Full Code Here

    }
   
    private List<MainMenuOption> readMenuOptions(NodeList menuOptions) {
        List<MainMenuOption> options = new ArrayList<MainMenuOption>();
        for (int index = 0; index < menuOptions.getLength(); index++) {
            Node menuNode = menuOptions.item(index);
            Element menuElement = (Element) menuNode;
            String name = menuElement.getAttribute("name");
            MainMenuOption option = new MainMenuOption();
            option.setHtml(name);
            if (menuElement.hasAttribute("commandClass")) {
View Full Code Here

        return options;
    }

    private String textOfFirstNode(String responseText, String tagName) {
        Document xml = XMLParser.parse(responseText);
        Node node = xml.getElementsByTagName(tagName).item(0);
        return getText(node);
    }
View Full Code Here

    }
    private List<FBMenuItem> readMenuItems(NodeList items, String groupName) {
        List<FBMenuItem> menuItems = new ArrayList<FBMenuItem>();
        for (int index = 0; index < items.getLength(); index ++) {
            Node itemNode = items.item(index);
            String itemClassName = ((Element) itemNode).getAttribute("className");
            try {
                Object obj = ReflectionHelper.newInstance(itemClassName);
                FBMenuItem menuItem = null;
                if (obj instanceof CustomMenuItem) {
View Full Code Here

    }
   
    private List<String> readAllowedEvents(NodeList allowedEvents) {
        List<String> retval = new ArrayList<String>();
        for (int index = 0; index < allowedEvents.getLength(); index++) {
            Node node = allowedEvents.item(index);
            retval.add(getText(node));
        }
        return retval;
    }
View Full Code Here

   
    private FormItemRepresentation makeRepresentation(Node itemNode) throws FormEncodingException {
        NodeList list = ((Element) itemNode).getElementsByTagName("itemJson");
        FormItemRepresentation rep = null;
        if (list.getLength() > 0) {
            Node node = list.item(0);
            String json = getText(node);
            FormRepresentationDecoder decoder = FormEncodingFactory.getDecoder();
            rep = (FormItemRepresentation) decoder.decodeItem(json);
        }
        return rep;
View Full Code Here

    }

    private List<FBFormEffect> readItemEffects(NodeList effects) throws Exception {
        List<FBFormEffect> itemEffects = new ArrayList<FBFormEffect>();
        for (int i = 0; i < effects.getLength(); i++) {
            Node effectNode = effects.item(i);
            String effectClassName = ((Element) effectNode).getAttribute("className");
            Object efobj = ReflectionHelper.newInstance(effectClassName);
            if (efobj instanceof FBFormEffect) {
                itemEffects.add((FBFormEffect) efobj);
            } else {
View Full Code Here

        Document xml = XMLParser.parse(responseText);
        NodeList list = xml.getElementsByTagName("file");
        List<String> retval = new ArrayList<String>();
        if (list != null) {
            for (int index = 0; index < list.getLength(); index++) {
                Node node = list.item(index);
                String url = getText(node);
                retval.add(url);
            }
        }
        return retval;
View Full Code Here

    Document doc = XMLParser.parse((String) data);

    NodeList list = doc.getElementsByTagName(modelType.getRecordName());
    ArrayList<ModelData> records = new ArrayList<ModelData>();
    for (int i = 0; i < list.getLength(); i++) {
      Node node = list.item(i);
      Element elem = (Element) node;
      ModelData model = newModelInstance();
      for (int j = 0; j < modelType.getFieldCount(); j++) {
        DataField field = modelType.getField(j);
        Class type = field.getType();
        String name = field.getName();
        String map = field.getMap() != null ? field.getMap() : field.getName();
        String v = getValue(elem, map);

        if (type != null) {
          if (type.equals(Integer.class)) {
            model.set(name, Integer.parseInt(v));
          } else if (type.equals(Long.class)) {
            model.set(name, Long.parseLong(v));
          } else if (type.equals(Float.class)) {
            model.set(name, Float.parseFloat(v));
          } else if (type.equals(Double.class)) {
            model.set(name, Double.parseDouble(v));
          } else if (type.equals(Date.class)) {
            if (field.getFormat().equals("timestamp")) {
              Date d = new Date(Long.parseLong(v) * 1000);
              model.set(name, d);
            } else {
              DateTimeFormat format = DateTimeFormat.getFormat(field.getFormat());
              Date d = format.parse(v);
              model.set(name, d);
            }
          }
        } else {
          model.set(field.getName(), v);
        }

      }
      records.add(model);
    }

    int totalCount = records.size();
    Node root = doc.getElementsByTagName(modelType.getRoot()).item(0);
    if (root != null && modelType.getTotalName() != null) {
      String tot = getValue((Element)root, modelType.getTotalName());
      if (tot != null) {
        totalCount = Integer.parseInt(tot);
      }
View Full Code Here

TOP

Related Classes of com.google.gwt.xml.client.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.