List of usage examples for org.dom4j Element elementText
String elementText(QName qname);
From source file:de.matzefratze123.heavyspleef.persistence.xml.CuboidRegionXMLCodec.java
License:Open Source License
@Override public CuboidRegion asRegion(Element container) { Element pos1Element = container.element("pos1"); Element pos2Element = container.element("pos2"); int x1 = Integer.parseInt(pos1Element.elementText("x")); int y1 = Integer.parseInt(pos1Element.elementText("y")); int z1 = Integer.parseInt(pos1Element.elementText("z")); int x2 = Integer.parseInt(pos2Element.elementText("x")); int y2 = Integer.parseInt(pos2Element.elementText("y")); int z2 = Integer.parseInt(pos2Element.elementText("z")); Vector pos1 = new Vector(x1, y1, z1); Vector pos2 = new Vector(x2, y2, z2); return new CuboidRegion(pos1, pos2); }
From source file:de.matzefratze123.heavyspleef.persistence.xml.CylinderRegionXMLCodec.java
License:Open Source License
@Override public CylinderRegion asRegion(Element container) { Element centerElement = container.element("center"); Element radiusElement = container.element("radius"); Element minYElement = container.element("minY"); Element maxYElement = container.element("maxY"); int cx = Integer.parseInt(centerElement.elementText("x")); int cy = Integer.parseInt(centerElement.elementText("y")); int cz = Integer.parseInt(centerElement.elementText("z")); int rx = Integer.parseInt(radiusElement.elementText("x")); int rz = Integer.parseInt(radiusElement.elementText("z")); int minY = Integer.parseInt(minYElement.getText()); int maxY = Integer.parseInt(maxYElement.getText()); Vector center = new Vector(cx, cy, cz); Vector2D radius = new Vector2D(rx, rz); return new CylinderRegion(center, radius, minY, maxY); }
From source file:de.matzefratze123.heavyspleef.persistence.xml.Polygonal2DRegionXMLCodec.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from w w w . j a v a2 s. c om*/ public Polygonal2DRegion asRegion(Element container) { Element pointsElement = container.element("points"); Element minYElement = container.element("minY"); Element maxYElement = container.element("maxY"); List<Element> pointElementList = pointsElement.elements("point"); List<BlockVector2D> points = Lists.newArrayList(); for (Element pointElement : pointElementList) { int x = Integer.parseInt(pointElement.elementText("x")); int z = Integer.parseInt(pointElement.elementText("z")); BlockVector2D point = new BlockVector2D(x, z); points.add(point); } int minY = Integer.parseInt(minYElement.getText()); int maxY = Integer.parseInt(maxYElement.getText()); return new Polygonal2DRegion((World) null, points, minY, maxY); }
From source file:de.xaniox.heavyspleef.core.extension.SignExtension.java
License:Open Source License
@Override public void unmarshal(Element element) { Element prefixTypeElement = element.element("prefix-type"); prefixType = prefixTypeElement != null ? PrefixType.valueOf(element.elementText("prefix-type")) : PrefixType.SPLEEF;/*from www.j a v a 2 s .co m*/ Element locationElement = element.element("location"); World world = Bukkit.getWorld(locationElement.elementText("world")); int x = Integer.parseInt(locationElement.elementText("x")); int y = Integer.parseInt(locationElement.elementText("y")); int z = Integer.parseInt(locationElement.elementText("z")); location = new Location(world, x, y, z); }
From source file:de.xaniox.heavyspleef.flag.defaults.FlagTeam.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from ww w . j a va 2s.c om*/ public void unmarshal(Element element) { super.unmarshal(element); List<Element> spawnpointElements = element.elements("spawnpoint"); for (Element spawnpointElement : spawnpointElements) { TeamColor color = TeamColor.valueOf(spawnpointElement.elementText("color")); Element locationElement = spawnpointElement.element("location"); World world = Bukkit.getWorld(locationElement.elementText("world")); double x = Double.parseDouble(locationElement.elementText("x")); double y = Double.parseDouble(locationElement.elementText("y")); double z = Double.parseDouble(locationElement.elementText("z")); float yaw = Float.parseFloat(locationElement.elementText("yaw")); float pitch = Float.parseFloat(locationElement.elementText("pitch")); Location location = new Location(world, x, y, z, yaw, pitch); spawnpoints.put(color, location); } }
From source file:de.xaniox.leaderboardextensions.ExtensionLeaderboardPodium.java
License:Open Source License
@Override public void unmarshal(Element element) { name = element.elementText("name"); Element locElement = element.element("base-location"); World world = Bukkit.getWorld(locElement.elementText("world")); int x = Integer.parseInt(locElement.elementText("x")); int y = Integer.parseInt(locElement.elementText("y")); int z = Integer.parseInt(locElement.elementText("z")); baseLocation = new Location(world, x, y, z); direction = BlockFace2D.valueOf(element.elementText("direction")); size = PodiumSize.valueOf(element.elementText("size")); }
From source file:de.xaniox.leaderboardextensions.ExtensionLeaderboardWall.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*w w w . j a v a 2 s.c o m*/ public void unmarshal(Element element) { name = element.elementText("name"); List<Element> rowElements = element.elements("row"); for (Element rowElement : rowElements) { SignRow row = new SignRow(); row.unmarshal(rowElement); rows.add(row); } }
From source file:delphsim.model.Categoria.java
License:Open Source License
/** * Mtodo para cargar los datos contenidos en un objeto de tipo * <CODE>org.dom4j.Element</CODE> en este objeto. * @param elementoCategoria El objeto <CODE>org.dom4j.Element</CODE>. *///from w ww .j a v a 2 s. c o m public void cargarDesdeXML(Element elementoCategoria) { this.setNombre(elementoCategoria.attributeValue("nombre")); this.setDescripcion(elementoCategoria.elementText("descripcion")); }
From source file:delphsim.model.Parametro.java
License:Open Source License
/** * Mtodo para cargar los datos contenidos en un objeto de tipo * <CODE>org.dom4j.Element</CODE> en este objeto. * @param elementoParametro El objeto <CODE>org.dom4j.Element</CODE>. */// w w w. j av a 2s.c o m public void cargarDesdeXML(Element elementoParametro) { this.setNombre(elementoParametro.attributeValue("nombre")); this.setDescripcion(elementoParametro.elementText("descripcion")); String[] parVinculados = new String[elementoParametro.elements("parametroVinculado").size()]; int indice = 0; for (Iterator i = elementoParametro.elementIterator("parametroVinculado"); i.hasNext();) { Element elementoParametroVinculado = (Element) i.next(); parVinculados[indice++] = elementoParametroVinculado.attributeValue("nombre"); } this.setParametrosVinculados(parVinculados); String[] procVinculados = new String[elementoParametro.elements("procesoVinculado").size()]; indice = 0; for (Iterator i = elementoParametro.elementIterator("procesoVinculado"); i.hasNext();) { Element elementoProcesoVinculado = (Element) i.next(); procVinculados[indice++] = elementoProcesoVinculado.attributeValue("nombre"); } this.setProcesosVinculados(procVinculados); String[] compVinculados = new String[elementoParametro.elements("compartimentoVinculado").size()]; indice = 0; for (Iterator i = elementoParametro.elementIterator("compartimentoVinculado"); i.hasNext();) { Element elementoCompartimentoVinculado = (Element) i.next(); compVinculados[indice++] = elementoCompartimentoVinculado.attributeValue("nombre"); } this.setCompartimentosVinculados(compVinculados); Element elementoDefinicionContinua = elementoParametro.element("definicionContinua"); if (elementoDefinicionContinua != null) { this.setDefinicionContinua(elementoDefinicionContinua.attributeValue("definicion")); } }
From source file:delphsim.model.Proceso.java
License:Open Source License
/** * Mtodo para cargar los datos contenidos en un objeto de tipo * <CODE>org.dom4j.Element</CODE> en este objeto. * @param elementoProceso El objeto <CODE>org.dom4j.Element</CODE>. *//*from ww w . j a v a 2s . c o m*/ public void cargarDesdeXML(Element elementoProceso) { this.setNombre(elementoProceso.attributeValue("nombre")); this.setDescripcion(elementoProceso.elementText("descripcion")); String[] procVinculados = new String[elementoProceso.elements("procesoVinculado").size()]; int indice = 0; for (Iterator i = elementoProceso.elementIterator("procesoVinculado"); i.hasNext();) { Element elementoProcesoVinculado = (Element) i.next(); procVinculados[indice++] = elementoProcesoVinculado.attributeValue("nombre"); } this.setProcesosVinculados(procVinculados); String[] compVinculados = new String[elementoProceso.elements("compartimentoVinculado").size()]; indice = 0; for (Iterator i = elementoProceso.elementIterator("compartimentoVinculado"); i.hasNext();) { Element elementoCompartimentoVinculado = (Element) i.next(); compVinculados[indice++] = elementoCompartimentoVinculado.attributeValue("nombre"); } this.setCompartimentosVinculados(compVinculados); Element elementoDefinicionContinua = elementoProceso.element("definicionContinua"); if (elementoDefinicionContinua != null) { this.tramosContinua = new TramoContinua[elementoDefinicionContinua.elements("tramo").size()]; indice = 0; for (Iterator i = elementoDefinicionContinua.elementIterator("tramo"); i.hasNext();) { Element elementoTramo = (Element) i.next(); this.tramosContinua[indice] = new TramoContinua(); this.tramosContinua[indice++].cargarDesdeXML(elementoTramo); } } }