📄 xmlportlets.java
字号:
try { while (portletgroupNode != null) { if (portletgroupNode.getNodeType() == Node.ELEMENT_NODE && portletgroupNode.getNodeName().equalsIgnoreCase(PORTLETLIST_TAG)) { if (Integer.parseInt(getParameterValue(portletgroupNode, "page_id")) == thePageID) { Node portletNode = portletgroupNode.getFirstChild(); int Column = 0; int Row = 0; while (portletNode != null) { // we are going through the portletgroup tags which represent list of portlets if (portletNode.getNodeType() == Node.ELEMENT_NODE && portletNode.getNodeName().equalsIgnoreCase(PORTLET_TAG)) { // we are now on a PORTLET tag paramAttrNode = getAttributeValue(portletNode, PARAMETER_TAG_ID_ATTRIBUTE); if (paramAttrNode.equals(new Integer(thePortletID).toString())) { Column = Integer.parseInt(getParameterValue(portletNode, "column_position")); Row = Integer.parseInt(getParameterValue(portletNode, "row_position")); if (Row == 1) { return; } Node paramNode = portletNode.getFirstChild(); while (paramNode != null) { if (paramNode.getNodeType() == Node.ELEMENT_NODE && paramNode.getNodeName().equalsIgnoreCase(PARAMETER_TAG)) { paramAttrNode = getAttributeValue(paramNode, PARAMETER_TAG_NAME_ATTRIBUTE); if (paramAttrNode.equals("row_position")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(Row - 1).toString()); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } } paramNode = paramNode.getNextSibling(); } break; } } portletNode = portletNode.getNextSibling(); } portletNode = portletgroupNode.getFirstChild(); while (portletNode != null) { // we are going through the portletgroup tags which represent list of portlets if (portletNode.getNodeType() == Node.ELEMENT_NODE && portletNode.getNodeName().equalsIgnoreCase(PORTLET_TAG)) { // we are now on a PORTLET tag if (Integer.parseInt(getParameterValue(portletNode, "column_position")) == Column) { if (Integer.parseInt(getParameterValue(portletNode, "row_position")) == (Row - 1)) { paramAttrNode = getAttributeValue(portletNode, PARAMETER_TAG_ID_ATTRIBUTE); if (!paramAttrNode.equals(new Integer(thePortletID).toString())) { Node paramNode = portletNode.getFirstChild(); while (paramNode != null) { if (paramNode.getNodeType() == Node.ELEMENT_NODE && paramNode.getNodeName().equalsIgnoreCase(PARAMETER_TAG)) { paramAttrNode = getAttributeValue(paramNode, PARAMETER_TAG_NAME_ATTRIBUTE); if (paramAttrNode.equals("row_position")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(Row).toString()); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } } paramNode = paramNode.getNextSibling(); } } } } } portletNode = portletNode.getNextSibling(); } saveFile(xmlDocument,theFile.getAbsolutePath()); return; } } portletgroupNode = portletgroupNode.getNextSibling(); } } catch (NumberFormatException n) { throw new JahiaException(ERROR_READING_PLML_FILE_MSG, "Invalid Integer in moveTopPortlet !!! : " + n.toString(), JahiaException.CRITICAL, JahiaException.CONFIG_ERROR); } } // end moveTopPortlet //-------------------------------------------------------------------------- /** * update the portlet settings * * @author Jerome Bedat * */ public void updatePortlet(PortletObj thePortlet) throws JahiaException { portletgroupNode = plmlNode.getFirstChild(); Node theNode; try { while (portletgroupNode != null) { if (portletgroupNode.getNodeType() == Node.ELEMENT_NODE && portletgroupNode.getNodeName().equalsIgnoreCase(PORTLETLIST_TAG)) { if (Integer.parseInt(getParameterValue(portletgroupNode, "page_id")) == thePageID) { Node portletNode = portletgroupNode.getFirstChild(); while (portletNode != null) { // we are going through the portletgroup tags which represent list of portlets if (portletNode.getNodeType() == Node.ELEMENT_NODE && portletNode.getNodeName().equalsIgnoreCase(PORTLET_TAG)) { // we are now on a PORTLET tag String theParam; paramAttrNode = getAttributeValue(portletNode, PARAMETER_TAG_ID_ATTRIBUTE); if (paramAttrNode.equals(new Integer(thePortlet.getPortletID()).toString())) { Node paramNode = portletNode.getFirstChild(); while (paramNode != null) { if (paramNode.getNodeType() == Node.ELEMENT_NODE && paramNode.getNodeName().equalsIgnoreCase(PARAMETER_TAG)) { paramAttrNode = getAttributeValue(paramNode, PARAMETER_TAG_NAME_ATTRIBUTE); if (paramAttrNode.equals("source_id")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(thePortlet.getPortletSourceID()).toString()); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("active")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(thePortlet.getPortletActive()).toString()); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("title")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletTitle().equals("")) ? thePortlet.getPortletTitle() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("bgcolor")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletBgColor().equals("")) ? thePortlet.getPortletBgColor() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("bgimage_url")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletBgImage().equals("")) ? thePortlet.getPortletBgImage() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("font")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletFont().equals("")) ? thePortlet.getPortletFont() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("fontsize")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletFontSize().equals("")) ? thePortlet.getPortletFontSize() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("fontcolor")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theParam = (!thePortlet.getPortletFontColor().equals("")) ? thePortlet.getPortletFontColor() : "-"; theTextNode = xmlDocument.createTextNode(theParam); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("skin_id")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(thePortlet.getPortletSkinID()).toString()); paramNode.replaceChild(theTextNode, theNode); break; } theNode = theNode.getNextSibling(); } } if (paramAttrNode.equals("scrollable")) { theNode = paramNode.getFirstChild(); while (theNode != null) { if (theNode.getNodeType() == Node.TEXT_NODE) { theTextNode = xmlDocument.createTextNode(new Integer(thePortlet.getPortletScrollable()).toString()); paramNode.replaceChild
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -