001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018:
019: package org.apache.roller.ui.authoring.struts.formbeans;
020:
021: import org.apache.struts.upload.FormFile;
022: import org.apache.roller.RollerException;
023: import org.apache.roller.pojos.FolderData;
024: import org.apache.roller.ui.authoring.struts.forms.FolderForm;
025:
026: /**
027: * Extends the FolderForm so that additional properties may be added.
028: * These properties are not persistent and are only needed for the UI.
029: *
030: * @struts.form name="folderFormEx"
031: */
032: public class FolderFormEx extends FolderForm {
033: private boolean mMoveContents = false;
034: private String mMoveToFolderId = null;
035: private String[] mSelectedBookmarks = null;
036: private String[] mSelectedFolders = null;
037: private transient FormFile mBookmarksFile = null;
038:
039: public FolderFormEx() {
040: super ();
041: }
042:
043: public FolderFormEx(FolderData folderData, java.util.Locale locale)
044: throws RollerException {
045: super (folderData, locale);
046: }
047:
048: public String getShortenedDesc() {
049: if (getDescription().length() > 20) {
050: return getDescription().substring(0, 19) + "...";
051: }
052: return getDescription();
053: }
054:
055: public void setShortenedDesc(String desc) {
056: // readonly
057: }
058:
059: //------------------------------------------------- Property bookmarksFile
060:
061: /** Bookmark file to be imported */
062: public void setBookmarksFile(FormFile file) {
063: mBookmarksFile = file;
064: }
065:
066: /** Bookmark file to be imported */
067: public FormFile getBookmarksFile() {
068: return mBookmarksFile;
069: }
070:
071: //-------------------------------------------------- Property moveContents
072:
073: /** If true then contents should be moved when this folder is removed */
074: public boolean getMoveContents() {
075: return mMoveContents;
076: }
077:
078: /** If true then contents should be moved when this folder is removed */
079: public void setMoveContents(boolean flag) {
080: mMoveContents = flag;
081: }
082:
083: //------------------------------------------------ Property moveToFolderId
084:
085: /** Folder where contents should be moved if this folder is removed */
086: public String getMoveToFolderId() {
087: return mMoveToFolderId;
088: }
089:
090: /** Folder where contents should be moved if this folder is removed */
091: public void setMoveToFolderId(String id) {
092: mMoveToFolderId = id;
093: }
094:
095: //--------------------------------------------- Property selectedBookmarks
096:
097: /** Get selected bookmarks */
098: public String[] getSelectedBookmarks() {
099: return mSelectedBookmarks;
100: }
101:
102: /** Set selected bookmarks */
103: public void setSelectedBookmarks(String[] b) {
104: mSelectedBookmarks = b;
105: }
106:
107: //--------------------------------------------- Property selectedBookmarks
108:
109: /** Get selected folders */
110: public String[] getSelectedFolders() {
111: return mSelectedFolders;
112: }
113:
114: /** Set selected bookmarks */
115: public void setSelectedFolders(String[] f) {
116: mSelectedFolders = f;
117: }
118: }
|