001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/portal/trunk/portal-util/util/src/java/org/sakaiproject/portal/util/PortalSiteHelper.java $
003: * $Id: PortalSiteHelper.java 21708 2007-02-18 21:59:28Z ian@caret.cam.ac.uk $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2007 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.chat2.tool;
021:
022: import org.sakaiproject.chat2.model.ChatChannel;
023:
024: public class DecoratedChatChannel {
025:
026: private ChatChannel chatChannel;
027: private ChatTool chatTool;
028: private int filterParamPast;
029: private int filterParamLast;
030: private boolean directEdit = false;
031: private boolean newChannel = false;
032:
033: public DecoratedChatChannel(ChatTool chatTool,
034: ChatChannel chatChannel) {
035: this .chatTool = chatTool;
036: this .chatChannel = chatChannel;
037: }
038:
039: public DecoratedChatChannel(ChatTool chatTool,
040: ChatChannel chatChannel, boolean newChannel) {
041: this .chatTool = chatTool;
042: this .chatChannel = chatChannel;
043: this .newChannel = newChannel;
044: }
045:
046: public String processActionEnterRoom() {
047: return chatTool.processActionEnterRoom(this );
048: }
049:
050: /**
051: * This method will edit the room from the page listing all the rooms
052: * @return
053: */
054: public String processActionEditRoom() {
055: directEdit = false;
056: return chatTool.processActionEditRoom(this );
057: }
058:
059: /**
060: * This method will edit the room directly from the main chat page
061: * @return
062: */
063: public String processActionEditRoomDirect() {
064: //Setting this to false to the UI doesn't change too much
065: //directEdit = true;
066: directEdit = false;
067: return chatTool.processActionEditRoom(this );
068: }
069:
070: public String processActionDeleteRoom() {
071: return chatTool.processActionDeleteRoomConfirm(this );
072: }
073:
074: public String processActionSetAsDefaultRoom() {
075: return chatTool.processActionSetAsDefaultRoom(this );
076: }
077:
078: public ChatChannel getChatChannel() {
079: return chatChannel;
080: }
081:
082: public ChatTool getChatTool() {
083: return chatTool;
084: }
085:
086: public boolean getCanDelete() {
087: return chatTool.getCanRemoveChannel(chatChannel);
088: }
089:
090: public boolean getCanEdit() {
091: return chatTool.getCanEditChannel(chatChannel);
092: }
093:
094: public boolean getCanRead() {
095: return chatTool.getCanRead(chatChannel);
096: }
097:
098: /**
099: * Returns the bundle message with key "enter_the_chat_room", inserting the chat channel's title
100: * @return
101: */
102: public String getEnterChatText() {
103: return chatTool.getMessageFromBundle("enter_the_chat_room",
104: new Object[] { chatChannel.getTitle() });
105: }
106:
107: public String getSetAsDefaultText() {
108: return chatTool.getMessageFromBundle("set_as_default",
109: new Object[] { chatChannel.getTitle() });
110: }
111:
112: public int getFilterParamLast() {
113: return filterParamLast;
114: }
115:
116: public void setFilterParamLast(int filterParamLast) {
117: this .filterParamLast = filterParamLast;
118: }
119:
120: public int getFilterParamPast() {
121: return filterParamPast;
122: }
123:
124: public void setFilterParamPast(int filterParamPast) {
125: this .filterParamPast = filterParamPast;
126: }
127:
128: public boolean isDirectEdit() {
129: return directEdit;
130: }
131:
132: public void setDirectEdit(boolean directEdit) {
133: this .directEdit = directEdit;
134: }
135:
136: public boolean isNewChannel() {
137: return newChannel;
138: }
139:
140: public void setNewChannel(boolean newChannel) {
141: this.newChannel = newChannel;
142: }
143:
144: }
|