📄 networkplaceform.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.vfs.forms;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.Globals;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import com.sslexplorer.boot.PropertyList;
import com.sslexplorer.core.BundleActionMessage;
import com.sslexplorer.input.MultiSelectSelectionModel;
import com.sslexplorer.policyframework.Resource;
import com.sslexplorer.policyframework.forms.AbstractFavoriteResourceForm;
import com.sslexplorer.security.User;
import com.sslexplorer.vfs.NetworkPlace;
import com.sslexplorer.vfs.webdav.DAVBundleActionMessageException;
import com.sslexplorer.vfs.webdav.DAVRepository;
public class NetworkPlaceForm extends AbstractFavoriteResourceForm {
static Log log = LogFactory.getLog(NetworkPlaceForm.class);
private String selectedTab = "details";
private String uri;
private String scheme;
private boolean networkPlaceReadOnly;
private boolean showHidden;
private boolean allowResursive;
private boolean noDelete;
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errs = super.validate(mapping, request);
if (isCommiting()) {
try {
if (uri.length() == 0) {
errs.add(Globals.ERROR_KEY, new ActionMessage("createNetworkPlace.error.noUri", uri));
} else {
/**
* BPS - We now reformat the path when its used as we need
* to take into account replacement variables that will
* likely by user specific.
*/
this.scheme = DAVRepository.getInstance().validateUserEnteredPath(uri);
}
} catch (DAVBundleActionMessageException ex) {
errs.add(Globals.ERROR_KEY, ex.getBundleActionMessage());
}
if (this.getResourceName().contains("\\")) {
errs.add(Globals.ERROR_KEY, new BundleActionMessage("vfs", "defaultNetworkPlaceWizard.defaultNetworkPlaceDetails.error.invalid.char", "\\"));
}
}
return errs;
}
public int getTabCount() {
return 3;
}
public String getTabName(int idx) {
switch (idx) {
case 0:
return "details";
case 1:
return "other";
default:
return "policies";
}
}
public String getTabTitle(int idx) {
// Get from resources
return null;
}
public void initialise(User user, Resource resource, boolean editing, MultiSelectSelectionModel policyModel,
PropertyList selectedPolicies, User owner) throws Exception {
super.initialise(user, resource, editing, policyModel, selectedPolicies, owner);
NetworkPlace networkPlace = (NetworkPlace) resource;
this.scheme = networkPlace.getScheme();
this.uri = networkPlace.getUri();
this.networkPlaceReadOnly = networkPlace.isReadOnly();
this.showHidden = networkPlace.isShowHidden();
this.allowResursive = networkPlace.isAllowResursive();
this.noDelete = networkPlace.isNoDelete();
}
public String getSelectedTab() {
return selectedTab;
}
public void setSelectedTab(String selectedTab) {
this.selectedTab = selectedTab;
}
public void applyToResource() throws Exception {
NetworkPlace np = (NetworkPlace) getResource();
np.setUri(getUri());
np.setScheme(scheme);
np.setReadOnly(getReadOnly());
np.setAllowResursive(isAllowResursive());
np.setNoDelete(isNoDelete());
np.setShowHidden(isShowHidden());
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public boolean isAllowResursive() {
return allowResursive;
}
public void setAllowResursive(boolean allowResursive) {
this.allowResursive = allowResursive;
}
public boolean isNoDelete() {
return noDelete;
}
public void setNoDelete(boolean noDelete) {
this.noDelete = noDelete;
}
public boolean isNetworkPlaceReadOnly() {
return networkPlaceReadOnly;
}
public void setNetworkPlaceReadOnly(boolean readOnly) {
this.networkPlaceReadOnly = readOnly;
}
public boolean isShowHidden() {
return showHidden;
}
public void setShowHidden(boolean showHidden) {
this.showHidden = showHidden;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
this.showHidden = false;
this.networkPlaceReadOnly = false;
this.allowResursive = false;
this.noDelete = false;
}
/* (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 + -