📄 applicationshortcutwizardapplicationform.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.wizards.forms;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.sslexplorer.extensions.ExtensionBundle;
import com.sslexplorer.extensions.ExtensionDescriptor;
import com.sslexplorer.extensions.store.ExtensionStore;
import com.sslexplorer.extensions.types.PluginType;
import com.sslexplorer.wizard.AbstractWizardSequence;
import com.sslexplorer.wizard.forms.DefaultWizardForm;
/**
* Extension of a {@link com.sslexplorer.wizard.forms.DefaultWizardForm} that
* allows an administrator to select the application to create the shortcut for.
*
* @author Brett Smith <a href="mailto: brett@3sp.com"><brett@3sp.com></a>
* @version $Revision: 1.5 $
*/
public class ApplicationShortcutWizardApplicationForm extends DefaultWizardForm {
final static Log log = LogFactory.getLog(ApplicationShortcutWizardApplicationForm.class);
/**
* Sequence attribute storing the ID of the selected application
*/
public final static String ATTR_SELECTED_APPLICATION = "selectedApplication";
// Privater instance variables
private List availableApplications;
private String selectedApplication;
/**
* Constructor
*/
public ApplicationShortcutWizardApplicationForm() {
super(true, false, "/WEB-INF/jsp/content/extensions/applicationShortcutWizard/application.jspf", "resourceName", true,
false, "applicationShortcutApplication", "extensions", "applicationShortcutWizard.applicationShortcutApplication", 1);
}
/**
* Get Id of the selected application extension
*
* @return selected application extension
*/
public String getSelectedApplication() {
return selectedApplication;
}
/**
* Set Id of the selected application extension
*
* @param selectedApplication selected application
*/
public void setSelectedApplication(String selectedApplication) {
this.selectedApplication = selectedApplication;
}
/**
* Get a list of {@link ExtensionDescriptor} objects for
* all available application extensions
*
* @return list of available application extensions
*/
public List getAvailableApplications() {
return availableApplications;
}
/**
* Get a list of {@link ExtensionDescriptor} objects for
* all available application extensions
*
* @param availableApplications list of available application extensions
*/
public void setParameterItems(List availableApplications) {
this.availableApplications = availableApplications;
}
/* (non-Javadoc)
* @see com.sslexplorer.wizard.forms.AbstractWizardForm#init(com.sslexplorer.wizard.AbstractWizardSequence, javax.servlet.http.HttpServletRequest)
*/
public void init(AbstractWizardSequence wizardSequence, HttpServletRequest request) throws Exception {
super.init(wizardSequence, request);
availableApplications = new ArrayList();
selectedApplication = (String)wizardSequence.getAttribute(ATTR_SELECTED_APPLICATION, null);
for (Iterator i = ExtensionStore.getInstance().getAllAvailableExtensionBundles().iterator(); i.hasNext();) {
ExtensionBundle b = (ExtensionBundle)i.next();
for(Iterator j = b.iterator(); j.hasNext(); ) {
ExtensionDescriptor d = (ExtensionDescriptor)j.next();
// Only show extensions if the type is not hidden and the extension itself is not hidden
if(!d.isHidden() && !d.getExtensionType().isHidden()) {
availableApplications.add(d);
}
}
}
if(selectedApplication == null && availableApplications.size() > 0) {
selectedApplication = ((ExtensionDescriptor)availableApplications.get(0)).getId();
}
}
/* (non-Javadoc)
* @see com.sslexplorer.wizard.forms.AbstractWizardForm#apply(com.sslexplorer.wizard.AbstractWizardSequence)
*/
public void apply(AbstractWizardSequence sequence) throws Exception {
super.apply(sequence);
String oldVal = (String)sequence.putAttribute(ATTR_SELECTED_APPLICATION, selectedApplication);
if(!selectedApplication.equals(oldVal)) {
sequence.removeAttribute(ApplicationShortcutWizardAdditionalDetailsForm.ATTR_PARAMETERS);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -