001 /*
002 Licensed to the Apache Software Foundation (ASF) under one
003 or more contributor license agreements. See the NOTICE file
004 distributed with this work for additional information
005 regarding copyright ownership. The ASF licenses this file
006 to you under the Apache License, Version 2.0 (the
007 "License"); you may not use this file except in compliance
008 with the License. You may obtain a copy of the License at
009
010 http://www.apache.org/licenses/LICENSE-2.0
011
012 Unless required by applicable law or agreed to in writing,
013 software distributed under the License is distributed on an
014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 KIND, either express or implied. See the License for the
016 specific language governing permissions and limitations
017 under the License.
018 */
019 package org.apache.wiki.tags;
020
021 import java.util.ArrayList;
022 import java.util.Collection;
023
024 import org.apache.log4j.Logger;
025
026 import org.apache.wiki.WikiContext;
027 import org.apache.wiki.WikiEngine;
028 import org.apache.wiki.ui.Editor;
029 import org.apache.wiki.ui.EditorManager;
030
031 /**
032 * Iterates through editors.
033 *
034 * @since 2.4.12
035 */
036
037 public class EditorIteratorTag
038 extends IteratorTag
039 {
040 private static final long serialVersionUID = 0L;
041
042 static Logger log = Logger.getLogger( EditorIteratorTag.class );
043
044 public final int doStartTag()
045 {
046 m_wikiContext = WikiContext.findContext(pageContext);
047
048 WikiEngine engine = m_wikiContext.getEngine();
049 EditorManager mgr = engine.getEditorManager();
050
051 String[] editorList = mgr.getEditorList();
052
053 Collection<Editor> editors = new ArrayList<Editor>();
054
055 for ( int i = 0; i < editorList.length; i++ )
056 {
057 editors.add(new Editor(m_wikiContext, editorList[i]));
058 }
059 setList( editors );
060
061 return super.doStartTag();
062 }
063 }