本文整理汇总了Java中com.ibm.xsp.extlib.util.ExtLibUtil.getViewScope方法的典型用法代码示例。如果您正苦于以下问题:Java ExtLibUtil.getViewScope方法的具体用法?Java ExtLibUtil.getViewScope怎么用?Java ExtLibUtil.getViewScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.xsp.extlib.util.ExtLibUtil
的用法示例。
在下文中一共展示了ExtLibUtil.getViewScope方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
public String save() throws Exception {
DominoDocument doc = this.getDoc();
Map<String, Object> viewScope = ExtLibUtil.getViewScope();
viewScope.put("$REF", doc.getValue("$REF"));
boolean isNewNote = doc.isNewNote();
if(doc.save()) {
Database database = doc.getParentDatabase();
if(database.isFTIndexed()) {
database.updateFTIndex(false);
}
JSFUtil.addMessage("confirmation", doc.getValue("Form") + " " + (isNewNote ? "created" : "updated") + " successfully.");
return "xsp-success";
} else {
JSFUtil.addMessage("error", "Save failed");
return "xsp-failure";
}
}
示例2: addSelected
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
public void addSelected() {
Map<String, Object> viewScope=ExtLibUtil.getViewScope();
Object names=viewScope.get("selectedNames");
if(names instanceof String) {
add((String) names);
} else {
// It should be a list of Strings, we hope.
for(Object o:(List<?>) names) {
add((String)o);
}
}
viewScope.remove("selectedNames");
}
示例3: getValue
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
public Object getValue(final Object keyObject) {
if (!(keyObject instanceof String)) {
throw new IllegalArgumentException();
}
String key = (String) keyObject;
try {
Object result = null;
if ("new".equals(key)) {
result = create();
} else if (ModelUtils.isUnid(key)) {
Database database = getDatabase();
Document doc = database.getDocumentByUNID(key);
result = createFromDocument(doc);
} else {
Map<String, Object> cacheScope = ExtLibUtil.getViewScope();
String cacheKey = getClass().getName() + key;
if (!cacheScope.containsKey(cacheKey)) {
if (key.contains("^^")) {
String[] bits = key.split("\\^\\^");
cacheScope.put(cacheKey, getNamedCollection(bits[0], bits.length == 1 ? "" : bits[1]));
} else {
cacheScope.put(cacheKey, getNamedCollection(key, null));
}
}
result = cacheScope.get(cacheKey);
}
return result;
} catch (Exception ne) {
// I'll want to know about this
throw new RuntimeException(ne);
}
}
示例4: beforePageLoad
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void beforePageLoad() throws Exception {
// super.afterPageLoad();
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String, String> param = (Map<String, String>)ExtLibUtil.resolveVariable(facesContext, "param");
ViewState state = (ViewState)ExtLibUtil.resolveVariable(facesContext, "state");
byte[] bytes = (byte[])state.document().getItemValue("State" + param.get("index"), byte[].class);
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
//ObjectInputStream ois = new ObjectInputStream(bis);
Class<? extends ObjectInputStream> inputClass = (Class<? extends ObjectInputStream>)Class.forName("com.ibm.xsp.application.AbstractSerializingStateManager$FastObjectInputStream");
Constructor<?> inputConstructor = inputClass.getConstructor(FacesContext.class, InputStream.class);
ObjectInputStream ois = (ObjectInputStream)inputConstructor.newInstance(facesContext, bis);
// Read the components in
Object treeStructure = ois.readObject();
//Object componentStructure = ois.readObject();
Method readObjectEx = inputClass.getMethod("readObjectEx");
Object componentStructure = readObjectEx.invoke(ois);
// IComponentNode localIComponentNode = (IComponentNode)treeStructure;
// UIViewRootEx view = (UIViewRootEx)localIComponentNode.restore(facesContext);
// Object viewState = componentStructure;
// view.processRestoreState(facesContext, viewState);
// System.out.println("view is " + view);
Map<String, Object> viewScope = ExtLibUtil.getViewScope();
viewScope.put("contextTreeStructure", treeStructure);
viewScope.put("contextComponentStructure", componentStructure);
}
示例5: getFilesCached
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public List<File> getFilesCached(String pid) {
Map<String, Object> scope=ExtLibUtil.getViewScope();
List<File> files=(List<File>)scope.get("files"+pid);
if(files==null) {
files=getFiles(pid);
scope.put("files"+pid, files);
}
return files;
}
示例6: postOpenDocument
import com.ibm.xsp.extlib.util.ExtLibUtil; //导入方法依赖的package包/类
public void postOpenDocument() throws Exception {
DominoDocument doc = this.getDoc();
Map<String, Object> viewScope = ExtLibUtil.getViewScope();
viewScope.put("$REF", doc.getValue("$REF"));
}