本文整理汇总了Java中com.ibm.xsp.designer.context.XSPContext类的典型用法代码示例。如果您正苦于以下问题:Java XSPContext类的具体用法?Java XSPContext怎么用?Java XSPContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSPContext类属于com.ibm.xsp.designer.context包,在下文中一共展示了XSPContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: toolbarClick
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
/**
* Will be triggered by an outline onItemClick event. Can be used for toolbars, dropdown menus, etc.
*/
public void toolbarClick() {
XSPContext context=XSPContext.getXSPContext(FacesContext.getCurrentInstance());
String selection=context.getSubmittedValue();
if("selectAll".equals(selection)) {
selectAll();
} else if("deselectAll".equals(selection)) {
deselectAll();
} else if("removeSelected".equals(selection)) {
removeSelected();
} else if("toggleLcv".equals(selection)) {
toggleLcv();
} else if("sortByLcv".equals(selection)) {
sortByLcv();
} else if("sortByName".equals(selection)) {
sortByName();
}
}
开发者ID:sbasegmez,项目名称:Blogged,代码行数:23,代码来源:ParticipantList.java
示例2: getMyGroupsAndRoles
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<String> getMyGroupsAndRoles() {
List<String> lstRC = new ArrayList<String>();
try {
XSPContext xsp = ExtLibUtil.getXspContext();
DirectoryUser dirUser = xsp.getUser();
Name nonUser = ExtLibUtil.getCurrentSession().createName(ExtLibUtil.getCurrentSession().getEffectiveUserName());
lstRC.add(nonUser.getCanonical());
lstRC.add(nonUser.getAbbreviated());
lstRC.add(nonUser.getCommon());
lstRC.addAll(dirUser.getGroups());
lstRC.addAll(dirUser.getRoles());
} catch (Exception e) {
e.printStackTrace();
}
return lstRC;
}
开发者ID:OpenNTF,项目名称:XPagesToolkit,代码行数:20,代码来源:RoleAndGroupProvider.java
示例3: initViewDefinition
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@Override
protected void initViewDefinition(FacesContext context, AbstractDataView _dataView, ViewDefinition viewDef) {
UIForumView dataView = (UIForumView)_dataView;
super.initViewDefinition(context, dataView, viewDef);
// Define if the items must be rendered in a table,
// Use a table for IE as CSS float is largely buggy - Hope IE9 fixes this...
viewDef.viewforumRenderAsTable = XSPContext.getXSPContext(context).getUserAgent().isIE(0,8);
// It is only one or the other, never both...
viewDef.summaryOrDetailVisible = true;
// Just to be sure...
viewDef.collapsibleRows = false;
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:16,代码来源:ForumViewRenderer.java
示例4: isRowRefresh
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public boolean isRowRefresh(FacesContext context) {
if (ENABLE_PARTIAL_REFRESH_ROW) {
// This mode is only supported if a partial tree is rendered
if (((FacesContextEx) context).isAjaxWholeTreeRendered()) {
return false;
}
// There is an issue with IE refreshing a single row
if (/* ExtLibCompUtil.isXPages852() && */XSPContext
.getXSPContext(context).getUserAgent().isIE(0, 8)) {
return false;
}
return true;
}
return false;
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:16,代码来源:AbstractDataView.java
示例5: isLoggedIn
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
protected boolean isLoggedIn() {
XSPContext ctx = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
if(ctx!=null) {
com.ibm.designer.runtime.directory.DirectoryUser user = ctx.getUser();
return !user.isAnonymous();
}
return false;
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:9,代码来源:LoginTreeNode.java
示例6: renderService
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@Override
public void renderService() throws ServiceException {
// SPR# LHEY8YSE4F - calendar data does not refresh on IE due to browser caching problem
// We override the renderService just to set the Expires header to -1 for IE only ...
// and only for this specific service! If others report same issue then promote fix accordingly.
super.renderService();
if (XSPContext.getXSPContext(FacesContext.getCurrentInstance()).getUserAgent().isIE()) {
getHttpResponse().setHeader("Expires", "-1"); // $NON-NLS-1$ $NON-NLS-2$
}
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:11,代码来源:DominoCalendarJsonLegacyService.java
示例7: getXspProperty
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
/**
* Returns a XSP property value
*/
public static String getXspProperty(String name) {
XSPContext context = getXspContext();
if(context!=null)
return context.getProperty(name);
else
return null;
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:11,代码来源:ExtLibUtil.java
示例8: getStringProperty
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public static String getStringProperty(XSPContext ctx, String propName, String defaultValue) {
String v = ctx.getProperty(propName);
if(v==null) {
return defaultValue;
}
return v;
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:ExtLibUtil.java
示例9: getIntProperty
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public static int getIntProperty(XSPContext ctx, String propName, int defaultValue) {
String v = ctx.getProperty(propName);
if(v==null) {
return defaultValue;
}
return Integer.valueOf(v);
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:ExtLibUtil.java
示例10: getBooleanProperty
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public static boolean getBooleanProperty(XSPContext ctx, String propName, boolean defaultValue) {
String v = ctx.getProperty(propName);
if(v==null) {
return defaultValue;
}
return Boolean.valueOf(v);
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:ExtLibUtil.java
示例11: getUrl
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public static XSPUrl getUrl() {
try {
return XSPContext.getXSPContext(getContext()).getUrl();
} catch (Exception e) {
return null;
}
}
开发者ID:majkilde,项目名称:LogFileReader,代码行数:8,代码来源:XSPUtils.java
示例12: getTranslationBundle
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
private ResourceBundle getTranslationBundle() throws IOException {
if(bundle_ == null) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ApplicationEx app = (ApplicationEx)facesContext.getApplication();
bundle_ = app.getResourceBundle("translation", XSPContext.getXSPContext(facesContext).getLocale());
}
return bundle_;
}
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:9,代码来源:Translation.java
示例13: interpolate
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@Override
public String interpolate(final String message, final MessageInterpolator.Context context) {
Locale locale;
if(FrameworkUtils.isFaces()) {
locale = XSPContext.getXSPContext(FacesContext.getCurrentInstance()).getLocale();
} else {
locale = Locale.getDefault();
}
return interpolate(message, context, locale);
}
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:11,代码来源:AbstractModelObject.java
示例14: getTranslationBundle
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@Override
public ResourceBundle getTranslationBundle() {
FacesContext facesContext = FacesContext.getCurrentInstance();
ApplicationEx app = (ApplicationEx)facesContext.getApplication();
try {
return app.getResourceBundle("model_translation", XSPContext.getXSPContext(facesContext).getLocale());
} catch(IOException ioe) {
return null;
}
}
开发者ID:jesse-gallagher,项目名称:XPages-Scaffolding,代码行数:11,代码来源:ModelClassComponentMapAdapter.java
示例15: getStorageDatabase
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
private Database getStorageDatabase() {
XSPContext context = ExtLibUtil.getXspContext();
String databaseName = context.getProperty("frostillicus.dominostatemanager.database");
Session session = (Session)JSFUtil.getSession();
return session.getDatabase(databaseName);
}
开发者ID:jesse-gallagher,项目名称:Miscellany,代码行数:7,代码来源:DominoStateManager.java
示例16: Message
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
public Message(Throwable error, String context) {
StringBuilder sbHTML = new StringBuilder();
StringBuilder sbDetails = new StringBuilder();
if (error instanceof NotesException) { //add error id
errorId = ((NotesException) error).id;
summary = ((NotesException) error).text;
sbHTML.append( summary + " (" + errorId + ")");
} else {
summary = error.toString();
sbHTML.append( error.toString() );
}
sbDetails.append( summary );
StackTraceElement[] stes = error.getStackTrace();
errorLine = stes[0].getLineNumber();
errorMethod = stes[0].getMethodName();
errorClassName = stes[0].getClassName();
if (error.getClass().getName().equals( "javax.faces.FacesException") ) {
sbHTML.append("<table cellpadding=\"0\" cellspacing=\"0\" class=\"errorDetails\"><tbody><tr><td colspan=\"2\"><b><u>Error details</u></b></td></tr>");
sbDetails.append("\n\nError details\n\n");
javax.faces.FacesException fE = (javax.faces.FacesException) error;
if ( fE.getCause().getClass().getName().equals( "com.ibm.xsp.exception.EvaluationExceptionEx") ) {
com.ibm.xsp.exception.EvaluationExceptionEx evEx = (com.ibm.xsp.exception.EvaluationExceptionEx) fE.getCause();
if ( evEx.getCause().getClass().getName().equals("com.ibm.jscript.InterpretException") ) {
com.ibm.jscript.InterpretException iEx = (com.ibm.jscript.InterpretException) evEx.getCause();
sbHTML.append("<tr><td><b>Message:</b></td><td style=\"color: black;\">" + iEx.getMessage() + "</td></tr>");
sbHTML.append("<tr><td><b>JavaScript code:</b></td><td style=\"color: black;\">" + iEx.getExpressionText().replace("\n", "<br />") + "</td></tr>");
sbDetails.append("Message: " + iEx.getMessage() + "\n\n" );
sbDetails.append("JavaScript code:\n\n" + iEx.getExpressionText() + "\n\n");
}
sbHTML.append("<tr><td><b>Caused by component:</b></td><td style=\"color: black;\">" + evEx.getErrorComponentId() + "</td></tr>");
sbHTML.append("<tr><td><b>Property:</b></td><td style=\"color: black;\">" + evEx.getErrorPropertyId() + "</td></tr>" );
sbDetails.append("Caused by component: " + evEx.getErrorComponentId() + "\n");
sbDetails.append("Property: " + evEx.getErrorPropertyId() + "\n" );
}
XSPContext xspContext = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
String [] historyUrls = xspContext.getHistoryUrls();
fromPage = historyUrls[historyUrls.length-1];
if (fromPage.indexOf("?")>-1) {
fromPage = fromPage.substring(0, fromPage.indexOf("?"));
}
if (fromPage.indexOf("/")==0) {
fromPage = fromPage.substring(1);
}
sbHTML.append("<tr><td><b>In page:</b></td><td><a href=\"" + FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() + "/" + fromPage + "\">" + fromPage + "</a></td></tr>");
sbHTML.append("</tbody></table>");
sbDetails.append("In page: " + fromPage);
}
this.details = sbDetails.toString();
this.text = sbHTML.toString();
this.type = TYPE_ERROR;
this.context = context;
this.date = new Date();
//store stacktrace elements in a Vector
stackTrace = new Vector<String>();
for (StackTraceElement element : error.getStackTrace()) {
stackTrace.add( element.toString() );
}
}
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:80,代码来源:Message.java
示例17: DebugToolbar
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DebugToolbar() {
try {
activeTab = ""; //default tab: none
toolbarVisible = false;
collapsed = false;
messages = new Vector<Message>();
filterLogTypes = new Vector<String>();
showLists = true;
toolbarColor = "#38375B"; //default background color
configLoaded = false;
requestContextPath = FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
consolePath = requestContextPath + "/debugToolbarConsole.xsp";
dominoDataDir = com.ibm.xsp.model.domino.DominoUtils.getEnvironmentString("Directory"); //path to the domino/data directory
dominoProgramDir = com.ibm.xsp.model.domino.DominoUtils.getEnvironmentString("NotesProgram"); //path to the domino program directory
inspectorShowHiddenComponents = false;
inspectorComponentIdsOptions = new ArrayList<String>();
inspectorExpression = new ArrayList<String>();
logEnabled = false;
dbCurrent = getCurrentDatabase();
currentDbFilePath = dbCurrent.getFilePath();
currentDbTitle = dbCurrent.getTitle();
serverName = dbCurrent.getServer();
dbCurrent.recycle();
XSPContext context = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
userName = getSession().getUserName();
effectiveUserName = getSession().getEffectiveUserName();
userRoles = new Vector<String>(context.getUser().getRoles());
notesVersion = getSession().getNotesVersion();
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:48,代码来源:DebugToolbar.java
示例18: getCustomVars
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ArrayList<Entry<String, String>> getCustomVars() {
ArrayList customVars = new ArrayList<Entry<String,String>>();
try {
XSPContext context = XSPContext.getXSPContext(FacesContext.getCurrentInstance());
DirectoryUser currentUser = context.getUser();
Name n = getSession().createName(effectiveUserName);
Vector<String> groups = new Vector(currentUser.getGroups());
groups.remove(effectiveUserName);
groups.remove(n.getCommon());
extLibVersion = getExtLibVersion();
ExternalContext extCon = FacesContext.getCurrentInstance().getExternalContext();
HttpServletRequest httpServletRequest = (HttpServletRequest) extCon.getRequest();
customVars.add( new AbstractMap.SimpleEntry("title", "User"));
customVars.add( new AbstractMap.SimpleEntry("username", effectiveUserName));
customVars.add( new AbstractMap.SimpleEntry("access level", getReadableAccessLevel(getCurrentDatabase().getCurrentAccessLevel())));
customVars.add( new AbstractMap.SimpleEntry("roles", (userRoles.size()>0 ? userRoles.toString() : "(no roles enabled)") ));
customVars.add( new AbstractMap.SimpleEntry("groups", (groups.size()>0 ? groups.toString() : "(user not listed in any group)")));
customVars.add( new AbstractMap.SimpleEntry("title", "Browser"));
customVars.add( new AbstractMap.SimpleEntry("name", context.getUserAgent().getBrowser() + " " + context.getUserAgent().getBrowserVersion()));
customVars.add( new AbstractMap.SimpleEntry("user agent", context.getUserAgent().getUserAgent()));
customVars.add( new AbstractMap.SimpleEntry("language", context.getLocale().getDisplayName() + " (" + context.getLocaleString() + ")"));
customVars.add( new AbstractMap.SimpleEntry("timezone", context.getTimeZoneString()));
customVars.add( new AbstractMap.SimpleEntry("title", "Server") );
customVars.add( new AbstractMap.SimpleEntry("name", getCurrentDatabase().getServer() ) );
customVars.add( new AbstractMap.SimpleEntry("version", notesVersion ) );
customVars.add( new AbstractMap.SimpleEntry("platform", getSession().getPlatform() ) );
customVars.add( new AbstractMap.SimpleEntry("extension library version", extLibVersion ) );
customVars.add( new AbstractMap.SimpleEntry("title", "Database") );
customVars.add( new AbstractMap.SimpleEntry("name", currentDbTitle ) );
customVars.add( new AbstractMap.SimpleEntry("path", currentDbFilePath ) );
customVars.add( new AbstractMap.SimpleEntry("size", DebugToolbar.getReadableSize( (long) getCurrentDatabase().getSize())));
customVars.add( new AbstractMap.SimpleEntry("created", getCurrentDatabase().getCreated().toString()) );
customVars.add( new AbstractMap.SimpleEntry("last modified", getCurrentDatabase().getLastModified().toString()));
customVars.add( new AbstractMap.SimpleEntry("full text indexed?", (getCurrentDatabase().isFTIndexed() ? "yes (last update: " + getCurrentDatabase().getLastFTIndexed().toString() + ")" : "no")));
customVars.add( new AbstractMap.SimpleEntry("title", "Request"));
customVars.add( new AbstractMap.SimpleEntry("query string", context.getUrl().getQueryString()));
customVars.add( new AbstractMap.SimpleEntry("remote address", httpServletRequest.getRemoteAddr()));
customVars.add( new AbstractMap.SimpleEntry("cookies", getCookieDump(extCon.getRequestCookieMap()) ));
} catch (Exception e) {
error(e, "getCustomVars");
}
return customVars;
}
开发者ID:sbasegmez,项目名称:ic14demos,代码行数:66,代码来源:DebugToolbar.java
示例19: getXspContext
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
/**
* Return the current XspContext.
*/
public static XSPContext getXspContext() {
return XSPContext.getXSPContext(FacesContext.getCurrentInstance());
}
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:7,代码来源:ExtLibUtil.java
示例20: saveSerializedView
import com.ibm.xsp.designer.context.XSPContext; //导入依赖的package包/类
@Override
public SerializedView saveSerializedView(FacesContext facesContext) {
print("--------------------------");
print("running saveSerializedView");
try {
UIViewRootEx view = (UIViewRootEx)facesContext.getViewRoot();
String key = view.getUniqueViewId();
Database database = ExtLibUtil.getCurrentDatabase();
key = database.getReplicaID() + key;
print("storage key is " + key);
// Connect to our Couchbase server
CouchbaseClient client = getClient();
// Fetch or create a holder object and store the view
BasicStateManagerImpl.ViewHolder holder = (BasicStateManagerImpl.ViewHolder)client.get(key);
if(holder == null) {
Class<BasicStateManagerImpl.ViewHolder> holderClass = BasicStateManagerImpl.ViewHolder.class;
Constructor<?> cons = holderClass.getDeclaredConstructors()[1];
cons.setAccessible(true);
holder = (BasicStateManagerImpl.ViewHolder)cons.newInstance(1);
}
holder.add(facesContext, view);
// Do our Externalization here to avoid trouble with the CouchbaseClient ClassLoader not finding the holder class later
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos;
if(gzip_) {
oos = new ObjectOutputStream(new GZIPOutputStream(bos));
} else {
oos = new ObjectOutputStream(bos);
}
holder.writeExternal(oos);
oos.flush();
bos.flush();
byte[] bytes = bos.toByteArray();
// Set an expiration value
XSPContext context = ExtLibUtil.getXspContext();
String timeout = context.getProperty("xsp.session.timeout");
int expiration;
if(StringUtil.isEmpty(timeout)) {
expiration = 30 * 60;
} else {
expiration = Integer.parseInt(timeout) * 60;
}
client.set(key, expiration, bytes);
print("added view to holder");
} catch(Exception e) { throw new RuntimeException(e); }
print("--------------------------");
return null;
}
开发者ID:jesse-gallagher,项目名称:Couchbase-Data-for-XPages,代码行数:61,代码来源:CouchbaseStateManager.java
注:本文中的com.ibm.xsp.designer.context.XSPContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论