本文整理汇总了Java中com.ibm.commons.util.io.json.JsonJavaObject.putString方法的典型用法代码示例。如果您正苦于以下问题:Java JsonJavaObject.putString方法的具体用法?Java JsonJavaObject.putString怎么用?Java JsonJavaObject.putString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.commons.util.io.json.JsonJavaObject
的用法示例。
在下文中一共展示了JsonJavaObject.putString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: axCreateTab
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes") //$NON-NLS-1$
protected int axCreateTab(FacesContext context, StringBuilder b, Map params) throws IOException {
int errorCode = 200; // OK
// Create the new tab in the JSF tree
UIDojoTabPane pane = createTab();
if(pane!=null) {
JsonJavaObject json = new JsonJavaObject();
String id = pane.getClientId(context);
if(id!=null) {
json.putString("id", id); // $NON-NLS-1$
}
try {
// append {id="view:...:tabPane1"} to b
JsonGenerator.toJson(JsonJavaFactory.instance, b, json, true);
} catch(Exception ex) {}
ExtLibUtil.saveViewState(context);
}
return errorCode;
}
示例2: toJsonObject
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
/**
* Converts the IMA settings to a JSON object.
*
* @param settings
* @return
*/
private JsonJavaObject toJsonObject(ImaSettings settings) {
JsonJavaObject obj = new JsonJavaObject();
JsonJavaObject freebusy = new JsonJavaObject();
if ( settings.getFbUrl() != null ) {
freebusy.putString(JsonConstants.HREF_PROP, settings.getFbUrl());
}
if ( freebusy.size() > 0 ) {
obj.putObject(JSON_FREEBUSY, freebusy);
}
JsonJavaObject pw = new JsonJavaObject();
if ( settings.getPwChangeUrl() != null ) {
pw.putString(JsonConstants.HREF_PROP, settings.getPwChangeUrl());
}
if ( pw.size() > 0 ) {
obj.putObject(JSON_PW_CHANGE, pw);
}
return obj;
}
示例3: getDojoAttributeMap
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
public static void getDojoAttributeMap(FacesDojoComponent dojoComponent, JsonJavaObject json) {
List<DojoAttribute> la = dojoComponent.getDojoAttributes();
if(la!=null && !la.isEmpty()) {
for( DojoAttribute a: la ) {
String name = a.getName();
String value = a.getValue();
if(StringUtil.isNotEmpty(name) && StringUtil.isNotEmpty(value)) {
json.putString(name, value);
}
}
}
}
示例4: createNumberConstraintsAsJson
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
public String createNumberConstraintsAsJson() {
try {
JsonJavaObject jo = new JsonJavaObject();
double min = getMin();
if(!Double.isNaN(min)) {
jo.put("min", min); // $NON-NLS-1$
}
double max = getMax();
if(!Double.isNaN(max)) {
jo.put("max", max); // $NON-NLS-1$
}
// TODO convert Java locale code to Dojo locale code - see ViewRootRendererEx2.convertJavaLocaleToDojoLocale(String, boolean)
Locale loc = getLocale();
if( null != loc ){
jo.putString("locale", loc); // $NON-NLS-1$
}
String pat = getPattern();
if( null != pat ){
jo.putString("pattern", pat); // $NON-NLS-1$
}
int places = getPlaces();
if(places>=0) {
jo.putInt("places", places); // $NON-NLS-1$
}
boolean severe = isStrict();
if( false != severe ){
jo.putBoolean("strict", severe); // $NON-NLS-1$
}
String ty = getType();
if( null != ty ){
jo.putString("type", ty); // $NON-NLS-1$
}
return jo.isEmpty() ? null : JsonGenerator.toJson(JsonJavaFactory.instance,jo,true);
} catch(Exception e) {
throw new FacesExceptionEx(e);
}
}
示例5: initDojoAttributes
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
protected void initDojoAttributes(FacesContext context, AbstractPicker picker, UIComponent _for, IPickerData data, String dojoType, JsonJavaObject json) throws IOException {
// Associated control
boolean allowMultiple = false;
if(_for!=null) {
json.putString("control",_for.getClientId(context)); // $NON-NLS-1$
if(_for instanceof UIInputEx) {
UIInputEx iex = (UIInputEx)_for;
// Check for a multiple separator
String ch = iex.getMultipleSeparator();
if(StringUtil.isNotEmpty(ch)) {
boolean trim = iex.isMultipleTrim();
json.putString("msep",ch); // $NON-NLS-1$
//Defect 198787 - a11y fix to set aria-multiselectable property
json.putBoolean("allowMultiple",true); // $NON-NLS-1$
json.putBoolean("trim",trim); // $NON-NLS-1$
allowMultiple = true;
}
}
}
// Dialog title
String title = picker.getDialogTitle();
if(StringUtil.isEmpty(title)) {
if( allowMultiple ){
title = getDialogTitleMultipleSelect();
}else{
title = getDialogTitleSingleSelect();
}
}
json.putString("dlgTitle",title); // $NON-NLS-1$
// Dialog sizes
String lw = picker.getListWidth();
if(StringUtil.isNotEmpty(lw)) {
json.putString("listWidth",lw); // $NON-NLS-1$
}
String lh = picker.getListHeight();
if(StringUtil.isNotEmpty(lh)) {
json.putString("listHeight",lh); // $NON-NLS-1$
}
// The rest service URL
String url = picker.getUrl(context, null);
json.putString("url",url); // $NON-NLS-1$
// Generate the source list, if applicable
boolean hasMultipleSource = data.hasCapability(IPickerData.CAPABILITY_MULTIPLESOURCES);
if(hasMultipleSource) {
String[] labels = data.getSourceLabels();
if(labels!=null && labels.length>=2) {
json.putObject("sources",labels); // $NON-NLS-1$
}
}
}
示例6: generateJavaScript
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
/**
*
* @param context
* @param dt
* @param rowCount
* @param state
* @param linkId
* @param computedDisabledFormat the result of a call to {@link #computeDisabledFormat(FacesContext, String, String)};
* @return
* @throws EvaluationException
* @throws MethodNotFoundException
*/
public static String generateJavaScript(FacesContext context, FacesDataIterator dt, int rowCount, boolean state, String linkId,
String computedDisabledFormat) throws EvaluationException, MethodNotFoundException {
StringBuilder b = new StringBuilder(256);
UIComponent c = (UIComponent)dt;
// Add the dojo module
ExtLibResources.addEncodeResource(context, ExtLibResources.extlibDataIterator);
// And generate the piece of script
String id = (c instanceof FacesDataIteratorAjax) ? ((FacesDataIteratorAjax)c).getAjaxContainerClientId(context) : c.getClientId(context);
String url = AjaxUtil.getAjaxUrl(context, c, UIDataEx.AJAX_GETROWS, c.getClientId(context));
url = context.getExternalContext().encodeActionURL(url);
int first = dt.getFirst()+dt.getRows();
int count = rowCount;
if(count<=0) {
// For SPR#MKEE8MHELJ, default to 30 rows
// instead of to dt.getRows(), to prevent duplicating
// the number of rows displayed on every click.
count = UIDataEx.DEFAULT_ROWS_PER_PAGE;
}
// partial workaround for SPR#LHEY8LNDZS, problem in the xpage runtime.
// The UIDataEx and UIDataIterator classes can't handle it when
// the number of rows to be added is < the rows property - they
// return too few rows. The client-side XSP.appendRows method
// thinks that, since too few rows are present, all the rows
// in the data set have been displayed, so it removes
// the "Show more" link, even though not all rows have been shown.
count = Math.min(count, dt.getRows());
try {
b.append("XSP.appendRows("); //$NON-NLS-1$
JsonJavaObject jo = new JsonJavaObject();
jo.putString("id", id); //$NON-NLS-1$
jo.putString("url", url); //$NON-NLS-1$
jo.putInt("first", first); //$NON-NLS-1$
jo.putInt("count", count); //$NON-NLS-1$
jo.putBoolean("state", state); //$NON-NLS-1$
if( null != linkId ){
jo.putString("linkId", linkId); //$NON-NLS-1$
if( !DISABLED_FORMAT_TEXT.equals(computedDisabledFormat) ){
jo.putString("linkDisabledFormat", computedDisabledFormat); //$NON-NLS-1$
}
}
JsonGenerator.toJson(JsonJavaFactory.instance,b,jo,true);
b.append(");"); //$NON-NLS-1$
} catch(Exception e) {
throw new FacesExceptionEx(e);
}
return b.toString();
}
示例7: createCurrencyConstraintsAsJson
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
public String createCurrencyConstraintsAsJson() {
try {
JsonJavaObject jo = new JsonJavaObject();
double min = getMin();
if(!Double.isNaN(min)) {
jo.put("min", min); // $NON-NLS-1$
}
double max = getMax();
if(!Double.isNaN(max)) {
jo.put("max", max); // $NON-NLS-1$
}
String curr = getCurrency();
if( null != curr ){
jo.putString("currency", curr); // $NON-NLS-1$
}
String fra = getFractional();
if( null != fra ){
// SPR#JKAE9LEB6L was writing "false" instead of false (incorrectly quoted).
// Acceptable values are either "enable", "disable", "auto", "true", or "false"
// and the currency constraints allows "optional" or "[true, false]"
// and historically we allow any other string value to also be added.
if( "true".equals(fra) || "enable".equals(fra) ){ //$NON-NLS-1$ //$NON-NLS-2$
jo.putBoolean("fractional", true); // $NON-NLS-1$
}else if( "false".equals(fra) || "disable".equals(fra) ){//$NON-NLS-1$ //$NON-NLS-2$
jo.putBoolean("fractional", false); // $NON-NLS-1$
}else if( "auto".equals(fra) ){ //$NON-NLS-1$
// don't render any output
}else if("optional".equals(fra) || "[true, false]".equals(fra) //$NON-NLS-1$ //$NON-NLS-2$
|| "[true,false]".equals(fra) ){ //$NON-NLS-1$
// constraints: { fractional:[true, false] }
JsonJavaArray arr = new JsonJavaArray();
arr.putBoolean(0, true);
arr.putBoolean(1, false);
jo.putArray("fractional", arr); //$NON-NLS-1$
}
else{
// else treat it like a string.
jo.putString("fractional", fra); // $NON-NLS-1$
}
}
// TODO convert Java locale code to Dojo locale code - see ViewRootRendererEx2.convertJavaLocaleToDojoLocale(String, boolean)
Locale loc = getLocale();
if( null != loc ){
jo.putString("locale", loc); // $NON-NLS-1$
}
String pat = getPattern();
if( null != pat ){
jo.putString("pattern", pat); // $NON-NLS-1$
}
int places = getPlaces();
if(places>=0) {
jo.putInt("places", places); // $NON-NLS-1$
}
boolean severe = isStrict();
if( false != severe ){
jo.putBoolean("strict", severe); // $NON-NLS-1$
}
String sym = getSymbol();
if( null != sym ){
jo.putString("symbol", sym); // $NON-NLS-1$
}
String ty = getType();
if( null != ty ){
jo.putString("type", ty); // $NON-NLS-1$
}
return jo.isEmpty() ? null : JsonGenerator.toJson(JsonJavaFactory.instance,jo,true);
} catch(Exception e) {
throw new FacesExceptionEx(e);
}
}
示例8: createDateConstraintsAsJson
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
public String createDateConstraintsAsJson() {
try {
JsonJavaObject jo = new JsonJavaObject();
String clickInc = getClickableIncrement();
if( null != clickInc ){
jo.putString("clickableIncrement", clickInc); // $NON-NLS-1$
}
String dp = getDatePattern();
if( null != dp ){
jo.putString("datePattern", dp); // $NON-NLS-1$
}
String len = getFormatLength();
if( null != len ){
jo.putString("formatLength", len); // $NON-NLS-1$
}
// TODO convert Java locale code to Dojo locale code - see ViewRootRendererEx2.convertJavaLocaleToDojoLocale(String, boolean)
Locale loc = getLocale();
if( null != loc ){
jo.putString("locale", loc); // $NON-NLS-1$
}
String sel = getSelector();
if( null != sel ){
jo.putString("selector", sel); // $NON-NLS-1$
}
boolean severe = isStrict();
if( false != severe ){
jo.putBoolean("strict", severe); // $NON-NLS-1$
}
String visInc = getVisibleIncrement();
if( null != visInc ){
jo.putString("visibleIncrement", visInc); // $NON-NLS-1$
}
String visRange = getVisibleRange();
if( null != visRange ){
jo.putString("visibleRange", visRange); // $NON-NLS-1$
}
return jo.isEmpty() ? null : JsonGenerator.toJson(JsonJavaFactory.instance,jo,true);
} catch(Exception e) {
throw new FacesExceptionEx(e);
}
}
示例9: createTimeConstraintsAsJson
import com.ibm.commons.util.io.json.JsonJavaObject; //导入方法依赖的package包/类
public String createTimeConstraintsAsJson() {
try {
JsonJavaObject jo = new JsonJavaObject();
String a = getAm();
if( null != a ){
jo.putString("am", a); // $NON-NLS-1$
}
String p = getPm();
if( null != p ){
jo.putString("pm", p); // $NON-NLS-1$
}
String clickInc = getClickableIncrement();
if( null != clickInc ){
jo.putString("clickableIncrement", clickInc); // $NON-NLS-1$
}
String tp = getTimePattern();
if( null != tp ){
jo.putString("timePattern", tp); // $NON-NLS-1$
}
String len = getFormatLength();
if( null != len ){
jo.putString("formatLength", len); // $NON-NLS-1$
}
// TODO convert Java locale code to Dojo locale code - see ViewRootRendererEx2.convertJavaLocaleToDojoLocale(String, boolean)
Locale loc = getLocale();
if( null != loc ){
jo.putString("locale", loc); // $NON-NLS-1$
}
String sel = getSelector();
if( null != sel ){
jo.putString("selector", sel); // $NON-NLS-1$
}
boolean severe = isStrict();
if( false != severe ){
jo.putBoolean("strict", severe); // $NON-NLS-1$
}
String visInc = getVisibleIncrement();
if( null != visInc ){
jo.putString("visibleIncrement", visInc); // $NON-NLS-1$
}
String visRange = getVisibleRange();
if( null != visRange ){
jo.putString("visibleRange", visRange); // $NON-NLS-1$
}
return jo.isEmpty() ? null : JsonGenerator.toJson(JsonJavaFactory.instance,jo,true);
} catch(Exception e) {
throw new FacesExceptionEx(e);
}
}