001: /***************************************************************
002: * This file is part of the [fleXive](R) project.
003: *
004: * Copyright (c) 1999-2007
005: * UCS - unique computing solutions gmbh (http://www.ucs.at)
006: * All rights reserved
007: *
008: * The [fleXive](R) project is free software; you can redistribute
009: * it and/or modify it under the terms of the GNU General Public
010: * License as published by the Free Software Foundation;
011: * either version 2 of the License, or (at your option) any
012: * later version.
013: *
014: * The GNU General Public License can be found at
015: * http://www.gnu.org/copyleft/gpl.html.
016: * A copy is found in the textfile GPL.txt and important notices to the
017: * license from the author are found in LICENSE.txt distributed with
018: * these libraries.
019: *
020: * This library is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU General Public License for more details.
024: *
025: * For further information about UCS - unique computing solutions gmbh,
026: * please see the company website: http://www.ucs.at
027: *
028: * For further information about [fleXive](R), please see the
029: * project website: http://www.flexive.org
030: *
031: *
032: * This copyright notice MUST APPEAR in all copies of the file!
033: ***************************************************************/package com.flexive.war.beans.admin.structure;
034:
035: import com.flexive.faces.FxJsfUtils;
036: import com.flexive.shared.CacheAdmin;
037: import com.flexive.shared.structure.FxPropertyAssignment;
038:
039: import javax.faces.context.FacesContext;
040: import javax.faces.event.ActionEvent;
041: import java.util.Map;
042:
043: /**
044: * Provides getters and setters for boolean flags that
045: * control the modification of the structure tree
046: *
047: * @author Gerhard Glos (gerhard.glos@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
048: */
049:
050: public class StructureTreeControllerBean {
051: public static final String ACTION_RENAME_TYPE = "RENAME_TYPE";
052: public static final String ACTION_RENAME_ASSIGNMENT = "RENAME_ASSIGNMENT";
053: public static final String ACTION_RELOAD_SELECT_TYPE = "RELOAD_SELECT_TYPE";
054: public static final String ACTION_RELOAD_SELECT_ASSIGNMENT = "RELOAD_SELECT_ASSIGNMENT";
055: public static final String ACTION_RELOAD_EXPAND_TYPE = "RELOAD_EXPAND_TYPE";
056: public static final String ACTION_RELOAD_EXPAND_ASSIGNMENT = "RELOAD_EXPAND_ASSIGNMENT";
057: public static final String ACTION_RENAME_SELECT_TYPE = "RENAME_SELECT_TYPE";
058: public static final String ACTION_RENAME_SELECT_ASSIGNMENT = "RENAME_SELECT_ASSIGNMENT";
059:
060: private String action = null;
061: private long id = -1;
062: private String value = null;
063:
064: public long getId() {
065: return id;
066: }
067:
068: public void setId(long id) {
069: this .id = id;
070: }
071:
072: public String getValue() {
073: return value;
074: }
075:
076: public void setValue(String value) {
077: this .value = value;
078: }
079:
080: public String getAction() {
081: return action;
082: }
083:
084: public void setAction(String action) {
085: this .action = action;
086: }
087:
088: /*
089: public static final String KEY_ACTION="ACTION";
090: public static final String KEY_ID="ID";
091: public static final String KEY_VALUE="VALUE";
092:
093: private static List<HashMap> treeActions = null;
094:
095: public Object[] getTreeActions() {
096: return treeActions.toArray();
097: }
098: */
099:
100: public void addAction(String action, long id, String value) {
101: this .action = action;
102: this .value = value;
103: this .id = id;
104: }
105:
106: public boolean isDoAction() {
107: return action != null;
108: }
109:
110: // action listener for script mapping links; supports navigation from scriptEditor to structureEditor
111: public void structureOpener(ActionEvent e) {
112: FacesContext context = FacesContext.getCurrentInstance();
113: Map requestParams = context.getExternalContext()
114: .getRequestParameterMap();
115: long oid = -1;
116: String action = "";
117: if (requestParams.get("oid") != null
118: && requestParams.get("action") != null) {
119: oid = Long.valueOf(requestParams.get("oid").toString());
120: action = requestParams.get("action").toString();
121: // get the bean
122: StructureTreeControllerBean s = (StructureTreeControllerBean) FxJsfUtils
123: .getManagedBean("structureTreeControllerBean");
124: // action for the tree..
125: s.addAction(action, oid, null);
126: }
127: if (oid != -1 && !action.equals("")) {
128: this .id = oid;
129: this .action = action;
130: // value always set to null...
131: this.value = null;
132: }
133: }
134:
135: }
|