📄 extensionstoreform.java
字号:
/*
* SSL-Explorer
*
* Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package com.sslexplorer.extensions.forms;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.struts.action.ActionMapping;
import com.sslexplorer.core.forms.CoreForm;
import com.sslexplorer.extensions.ExtensionBundle;
import com.sslexplorer.extensions.ExtensionBundleCategoryItem;
import com.sslexplorer.extensions.store.ExtensionStore;
import com.sslexplorer.extensions.store.ExtensionStoreDescriptor;
import com.sslexplorer.tabs.TabModel;
public class ExtensionStoreForm extends CoreForm implements TabModel {
ExtensionStoreDescriptor descriptor;
private String selectedTab = ExtensionStore.INSTALLED_CATEGORY;
private List tabbedCategories = null;
public ExtensionStoreForm() {
}
public void reset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request) {
}
public void initialise(ExtensionStoreDescriptor descriptor, List allAvailableExtensionBundles) {
this.descriptor = descriptor;
this.tabbedCategories = new ArrayList();
Iterator allAvailableExtensionBundlesIterator = allAvailableExtensionBundles.iterator();
while (allAvailableExtensionBundlesIterator.hasNext()) {
ExtensionBundle element = (ExtensionBundle) allAvailableExtensionBundlesIterator.next();
ExtensionBundleCategoryItem extensionStoreFormCategory = getExtensionStoreFormCategory(element.getCategory());
if (extensionStoreFormCategory == null){
tabbedCategories.add(new ExtensionBundleCategoryItem(element.getCategory(), element));
}
else{
extensionStoreFormCategory.addExtensionBundle(element);
}
}
if(tabbedCategories.size() > 0)
this.setSelectedTab(((ExtensionBundleCategoryItem) this.tabbedCategories.get(0)).getCategory());
}
private ExtensionBundleCategoryItem getExtensionStoreFormCategory(String category){
for (Iterator iter = tabbedCategories.iterator(); iter.hasNext();) {
ExtensionBundleCategoryItem element = (ExtensionBundleCategoryItem) iter.next();
if (element.getCategory().equals(category)){
return element;
}
}
return null;
}
public int getTabCount() {
return this.tabbedCategories.size();
}
public String getTabName(int idx) {
return ((ExtensionBundleCategoryItem) this.tabbedCategories.get(idx)).getCategory();
}
public String getTabTitle(int i) {
return ((ExtensionBundleCategoryItem) this.tabbedCategories.get(i)).getCategory();
}
public String getSelectedTab() {
return this.selectedTab;
}
public void setSelectedTab(String selectedTab) {
this.selectedTab = selectedTab;
}
public List getTabbedCategories() {
return tabbedCategories;
}
public void setTabbedCategories(List tabbedCategories) {
this.tabbedCategories = tabbedCategories;
}
public ExtensionStoreDescriptor getDescriptor() {
return descriptor;
}
public void setDescriptor(ExtensionStoreDescriptor descriptor) {
this.descriptor = descriptor;
}
/* (non-Javadoc)
* @see com.sslexplorer.tabs.TabModel#getTabBundle(int)
*/
public String getTabBundle(int idx) {
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -