[pal-cvs 2904] [648] added page class for property editor.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 10月 22日 (月) 16:54:12 JST


Revision: 648
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=648
Author:   shinsuke
Date:     2007-10-22 16:54:12 +0900 (Mon, 22 Oct 2007)

Log Message:
-----------
added page class for property editor.

Added Paths:
-----------
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutPropertyEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletPropertyEditorPage.java


-------------- next part --------------
Added: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutPropertyEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutPropertyEditorPage.java	2007-10-22 07:53:13 UTC (rev 647)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutPropertyEditorPage.java	2007-10-22 07:54:12 UTC (rev 648)
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2005-2007 Portal Application Laboratory and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package jp.sf.pal.admin.web.site;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import jp.sf.pal.admin.entity.NodeInfo;
+import jp.sf.pal.common.CommonException;
+import jp.sf.pal.common.util.FacesMessageUtil;
+
+import org.seasar.framework.log.Logger;
+import org.seasar.teeda.extension.annotation.takeover.TakeOver;
+import org.seasar.teeda.extension.annotation.takeover.TakeOverType;
+import org.seasar.teeda.extension.annotation.validator.Required;
+
+public class LayoutPropertyEditorPage extends AbstractSiteEditorPage implements
+        Serializable {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = -7433703093804486330L;
+
+    /**
+     * Logger for this class
+     */
+    private static final Logger logger = Logger
+            .getLogger(LayoutPropertyEditorPage.class);
+
+    private int propertyIndex;
+
+    private List<Map<String, Object>> propertyItems;
+
+    private String propertyName;
+
+    private String propertyValue;
+
+    @Required
+    private String newPropertyName;
+
+    private String newPropertyValue;
+
+    private String action;
+
+    public Class<?> initialize() {
+        return null;
+    }
+
+    public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
+        if (getPath() == null) {
+            setPath("/");
+        }
+
+        if (getReturnPath() == null) {
+            setReturnPath("/");
+        }
+
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        }
+
+        if ("delete".equals(getAction())) {
+            // delete
+            if (getPropertyName() != null) {
+                doDelete();
+            } else {
+                FacesMessageUtil.addWarnMessage("could.not.find.property");
+            }
+
+            setPropertyName(null);
+            setPropertyValue(null);
+        }
+
+        try {
+            getSiteEditorService().loadPage(this);
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0008", new Object[] { this.toString() }, e);
+        }
+
+        // render FacesMessages
+        FacesMessageUtil.renderMessages();
+        return null;
+    }
+
+    @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath")
+    public Class<?> doAdd() {
+        try {
+            getSiteEditorService().addProperty(this);
+            FacesMessageUtil.addInfoMessage("added.property");
+            return LayoutPropertyEditorPage.class;
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0009", new Object[] { this.toString() }, e);
+        } catch (Exception e) {
+            FacesMessageUtil.addErrorMessage("could.not.add.property");
+            logger.log("EPA0010", new Object[] { this.toString() }, e);
+        }
+        return null;
+    }
+
+    @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath")
+    public Class<?> doDelete() {
+        try {
+            getSiteEditorService().deleteProperty(this);
+            FacesMessageUtil.addInfoMessage("deleted.property");
+            return LayoutPropertyEditorPage.class;
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0011", new Object[] { this.toString() }, e);
+        } catch (Exception e) {
+            FacesMessageUtil.addErrorMessage("could.not.delete.property");
+            logger.log("EPA0012", new Object[] { this.toString() }, e);
+        }
+        return null;
+    }
+
+    /**
+     * @return the propertyIndex
+     */
+    public int getPropertyIndex() {
+        return propertyIndex;
+    }
+
+    /**
+     * @param propertyIndex the propertyIndex to set
+     */
+    public void setPropertyIndex(int propertyIndex) {
+        this.propertyIndex = propertyIndex;
+    }
+
+    /**
+     * @return the propertyItems
+     */
+    public List<Map<String, Object>> getPropertyItems() {
+        return propertyItems;
+    }
+
+    /**
+     * @param propertyItems the propertyItems to set
+     */
+    public void setPropertyItems(List<Map<String, Object>> propertyItems) {
+        this.propertyItems = propertyItems;
+    }
+
+    /**
+     * @return the propertyName
+     */
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    /**
+     * @param propertyName the propertyName to set
+     */
+    public void setPropertyName(String propertyName) {
+        this.propertyName = propertyName;
+    }
+
+    /**
+     * @return the propertyValue
+     */
+    public String getPropertyValue() {
+        return propertyValue;
+    }
+
+    /**
+     * @param propertyValue the propertyValue to set
+     */
+    public void setPropertyValue(String propertyValue) {
+        this.propertyValue = propertyValue;
+    }
+
+    /**
+     * @return the newPropertyName
+     */
+    public String getNewPropertyName() {
+        return newPropertyName;
+    }
+
+    /**
+     * @param newPropertyName the newPropertyName to set
+     */
+    public void setNewPropertyName(String newPropertyName) {
+        this.newPropertyName = newPropertyName;
+    }
+
+    /**
+     * @return the newPropertyValue
+     */
+    public String getNewPropertyValue() {
+        return newPropertyValue;
+    }
+
+    /**
+     * @param newPropertyValue the newPropertyValue to set
+     */
+    public void setNewPropertyValue(String newPropertyValue) {
+        this.newPropertyValue = newPropertyValue;
+    }
+
+    /**
+     * @return the action
+     */
+    public String getAction() {
+        return action;
+    }
+
+    /**
+     * @param action the action to set
+     */
+    public void setAction(String action) {
+        this.action = action;
+    }
+}
\ No newline at end of file


Property changes on: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutPropertyEditorPage.java
___________________________________________________________________
Name: svn:eol-style
   + native

Added: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletPropertyEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletPropertyEditorPage.java	2007-10-22 07:53:13 UTC (rev 647)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletPropertyEditorPage.java	2007-10-22 07:54:12 UTC (rev 648)
@@ -0,0 +1,237 @@
+/*
+ * Copyright 2005-2007 Portal Application Laboratory and the Others.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package jp.sf.pal.admin.web.site;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import jp.sf.pal.admin.entity.NodeInfo;
+import jp.sf.pal.common.CommonException;
+import jp.sf.pal.common.util.FacesMessageUtil;
+
+import org.seasar.framework.log.Logger;
+import org.seasar.teeda.extension.annotation.takeover.TakeOver;
+import org.seasar.teeda.extension.annotation.takeover.TakeOverType;
+import org.seasar.teeda.extension.annotation.validator.Required;
+
+public class PortletPropertyEditorPage extends AbstractSiteEditorPage implements
+        Serializable {
+
+    /**
+     * 
+     */
+    private static final long serialVersionUID = 1628021934053317733L;
+
+    /**
+     * Logger for this class
+     */
+    private static final Logger logger = Logger
+            .getLogger(PortletPropertyEditorPage.class);
+
+    private int propertyIndex;
+
+    private List<Map<String, Object>> propertyItems;
+
+    private String propertyName;
+
+    private String propertyValue;
+
+    @Required
+    private String newPropertyName;
+
+    private String newPropertyValue;
+
+    private String action;
+
+    public Class<?> initialize() {
+        return null;
+    }
+
+    public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
+        if (getPath() == null) {
+            setPath("/");
+        }
+
+        if (getReturnPath() == null) {
+            setReturnPath("/");
+        }
+
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        }
+
+        if ("delete".equals(getAction())) {
+            // delete
+            if (getPropertyName() != null) {
+                doDelete();
+            } else {
+                FacesMessageUtil.addWarnMessage("could.not.find.property");
+            }
+
+            setPropertyName(null);
+            setPropertyValue(null);
+        }
+
+        try {
+            getSiteEditorService().loadPage(this);
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0013", new Object[] { this.toString() }, e);
+        }
+
+        // render FacesMessages
+        FacesMessageUtil.renderMessages();
+        return null;
+    }
+
+    @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath")
+    public Class<?> doAdd() {
+        try {
+            getSiteEditorService().addProperty(this);
+            FacesMessageUtil.addInfoMessage("added.property");
+            return PortletPropertyEditorPage.class;
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0014", new Object[] { this.toString() }, e);
+        } catch (Exception e) {
+            FacesMessageUtil.addErrorMessage("could.not.add.property");
+            logger.log("EPA0015", new Object[] { this.toString() }, e);
+        }
+        return null;
+    }
+
+    @TakeOver(type = TakeOverType.INCLUDE, properties = "mode,path,returnPath")
+    public Class<?> doDelete() {
+        try {
+            getSiteEditorService().deleteProperty(this);
+            FacesMessageUtil.addInfoMessage("deleted.property");
+            return PortletPropertyEditorPage.class;
+        } catch (CommonException e) {
+            FacesMessageUtil.addErrorMessage(e.getMessageId());
+            logger.log("EPA0016", new Object[] { this.toString() }, e);
+        } catch (Exception e) {
+            FacesMessageUtil.addErrorMessage("could.not.delete.property");
+            logger.log("EPA0017", new Object[] { this.toString() }, e);
+        }
+        return null;
+    }
+
+    /**
+     * @return the propertyIndex
+     */
+    public int getPropertyIndex() {
+        return propertyIndex;
+    }
+
+    /**
+     * @param propertyIndex the propertyIndex to set
+     */
+    public void setPropertyIndex(int propertyIndex) {
+        this.propertyIndex = propertyIndex;
+    }
+
+    /**
+     * @return the propertyItems
+     */
+    public List<Map<String, Object>> getPropertyItems() {
+        return propertyItems;
+    }
+
+    /**
+     * @param propertyItems the propertyItems to set
+     */
+    public void setPropertyItems(List<Map<String, Object>> propertyItems) {
+        this.propertyItems = propertyItems;
+    }
+
+    /**
+     * @return the propertyName
+     */
+    public String getPropertyName() {
+        return propertyName;
+    }
+
+    /**
+     * @param propertyName the propertyName to set
+     */
+    public void setPropertyName(String propertyName) {
+        this.propertyName = propertyName;
+    }
+
+    /**
+     * @return the propertyValue
+     */
+    public String getPropertyValue() {
+        return propertyValue;
+    }
+
+    /**
+     * @param propertyValue the propertyValue to set
+     */
+    public void setPropertyValue(String propertyValue) {
+        this.propertyValue = propertyValue;
+    }
+
+    /**
+     * @return the newPropertyName
+     */
+    public String getNewPropertyName() {
+        return newPropertyName;
+    }
+
+    /**
+     * @param newPropertyName the newPropertyName to set
+     */
+    public void setNewPropertyName(String newPropertyName) {
+        this.newPropertyName = newPropertyName;
+    }
+
+    /**
+     * @return the newPropertyValue
+     */
+    public String getNewPropertyValue() {
+        return newPropertyValue;
+    }
+
+    /**
+     * @param newPropertyValue the newPropertyValue to set
+     */
+    public void setNewPropertyValue(String newPropertyValue) {
+        this.newPropertyValue = newPropertyValue;
+    }
+
+    /**
+     * @return the action
+     */
+    public String getAction() {
+        return action;
+    }
+
+    /**
+     * @param action the action to set
+     */
+    public void setAction(String action) {
+        this.action = action;
+    }
+}
\ No newline at end of file


Property changes on: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletPropertyEditorPage.java
___________________________________________________________________
Name: svn:eol-style
   + native


pal-cvs メーリングリストの案内
Back to archive index