本文整理汇总了Java中org.kuali.rice.krad.uif.control.CheckboxControl类的典型用法代码示例。如果您正苦于以下问题:Java CheckboxControl类的具体用法?Java CheckboxControl怎么用?Java CheckboxControl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckboxControl类属于org.kuali.rice.krad.uif.control包,在下文中一共展示了CheckboxControl类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adjustBindingPath
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Adjusts the binding path for the given component to match the generic data map (or boolean data map).
*
* @param bindingComponent data binding component to adjust path for
*/
protected void adjustBindingPath(DataBinding bindingComponent) {
boolean isBooleanDataType = false;
if (bindingComponent instanceof InputField) {
InputField inputField = (InputField) bindingComponent;
if ((inputField.getDataType() != null) && inputField.getDataType().equals(DataType.BOOLEAN)) {
isBooleanDataType = true;
} else if ((inputField.getControl() != null) && (inputField.getControl() instanceof CheckboxControl)) {
isBooleanDataType = true;
}
}
bindingComponent.getBindingInfo().setDefaults(this, bindingComponent.getPropertyName());
if (isBooleanDataType) {
bindingComponent.getBindingInfo().setBindByNamePrefix(BOOLEAN_DATA_BINDING_PATH);
} else {
bindingComponent.getBindingInfo().setBindByNamePrefix(DATA_BINDING_PATH);
}
bindingComponent.getBindingInfo().setBindToMap(true);
}
示例2: addChildExpressions
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Add expressions to the expression map for nested components of specific types
*
* @param components the child components
* @param expressionMap the map to add expressions to
* @return the map with child component expressions added
*/
protected Map<String, String> addChildExpressions(Collection<? extends LifecycleElement> components,
Map<String, String> expressionMap) {
for (LifecycleElement comp : components) {
if (comp != null && (comp instanceof Action
|| comp instanceof Image
|| comp instanceof Message
|| comp instanceof Link
|| comp instanceof Inquiry
|| comp instanceof Group
|| comp instanceof Tooltip
|| comp instanceof InputField
|| comp instanceof CheckboxControl
|| comp instanceof TextControl
|| comp instanceof SelectControl)) {
expressionMap = buildExpressionMap((Component) comp, expressionMap);
}
}
return expressionMap;
}
示例3: addChildExpressions
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Add expressions to the expression map for nested components of specific types
*
* @param components the child components
* @param expressionMap the map to add expressions to
* @return the map with child component expressions added
*/
protected Map<String, String> addChildExpressions(List<? extends Component> components,
Map<String, String> expressionMap) {
for (Component comp : components) {
if (comp != null && (comp instanceof Action
|| comp instanceof Image
|| comp instanceof Message
|| comp instanceof Link
|| comp instanceof Inquiry
|| comp instanceof Group
|| comp instanceof Tooltip
|| comp instanceof InputField
|| comp instanceof CheckboxControl
|| comp instanceof TextControl
|| comp instanceof SelectControl)) {
expressionMap = buildExpressionMap(comp, expressionMap);
}
}
return expressionMap;
}
示例4: getDataFieldColumnOptions
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Construct the column options for a data field
*
* @param collectionGroup the collectionGroup in which the data field is defined
* @param field the field to construction options for
* @return options as valid for datatable
*/
protected String getDataFieldColumnOptions(int target, CollectionGroup collectionGroup, DataField field) {
String sortType = null;
if (!collectionGroup.isReadOnly()
&& (field instanceof InputField)
&& ((InputField) field).getControl() != null) {
Control control = ((InputField) field).getControl();
if (control instanceof SelectControl) {
sortType = UifConstants.TableToolsValues.DOM_SELECT;
} else if (control instanceof CheckboxControl || control instanceof CheckboxGroupControl) {
sortType = UifConstants.TableToolsValues.DOM_CHECK;
} else if (control instanceof RadioGroupControl) {
sortType = UifConstants.TableToolsValues.DOM_RADIO;
} else {
sortType = UifConstants.TableToolsValues.DOM_TEXT;
}
} else {
sortType = UifConstants.TableToolsValues.DOM_TEXT;
}
Class dataTypeClass = ObjectPropertyUtils.getPropertyType(collectionGroup.getCollectionObjectClass(),
field.getPropertyName());
return constructTableColumnOptions(target, true, dataTypeClass, sortType);
}
示例5: testCopyUsingCloningWithDataTableSucceeds
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
@Ignore // Ignored for now, this is a proof of concept for using reflection to test copying
@Test
/**
* test {@link ComponentUtils#copyUsingCloning} using a DataField object
*/
public void testCopyUsingCloningWithDataTableSucceeds() {
CheckboxControl dataTableOriginal = new CheckboxControl();
initializeClass(dataTableOriginal);
CheckboxControl dataTableCopy = CopyUtils.copy(dataTableOriginal);
assertTrue(propertiesMatch(dataTableOriginal, dataTableCopy));
}
示例6: performApplyModel
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Replace checkbox control with radio group control
*
* @see Component#performApplyModel(org.kuali.rice.krad.uif.view.View, Object,
* org.kuali.rice.krad.uif.component.Component)
*/
@Override
public void performApplyModel(View view, Object model, Component parent) {
super.performApplyModel(view, model, parent);
if (getControl() != null && getControl() instanceof CheckboxControl) {
setControl(getRadioGroupControl());
}
}
示例7: getComponentPrototypes
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Add radioGroupControl if the control is a checkbox control
*
* @see org.kuali.rice.krad.uif.component.Component#getPropertyReplacers()
*/
@Override
public List<Component> getComponentPrototypes() {
List<Component> components = super.getComponentPrototypes();
if (getControl() != null && getControl() instanceof CheckboxControl) {
components.add(radioGroupControl);
}
return components;
}
示例8: convertControlToLookupControl
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* If control definition is defined on the given attribute definition, converts to an appropriate control for
* searching (if necessary) and returns a copy for setting on the field
*
* @param attributeDefinition attribute definition instance to retrieve control from
* @return Control instance or null if not found
*/
protected static Control convertControlToLookupControl(AttributeDefinition attributeDefinition) {
if (attributeDefinition.getControlField() == null) {
return null;
}
Control newControl = null;
// convert checkbox to radio with yes/no/both options
if (CheckboxControl.class.isAssignableFrom(attributeDefinition.getControlField().getClass())) {
newControl = ComponentFactory.getRadioGroupControlHorizontal();
List<KeyValue> options = new ArrayList<KeyValue>();
options.add(new ConcreteKeyValue("Y", "Yes"));
options.add(new ConcreteKeyValue("N", "No"));
options.add(new ConcreteKeyValue("", "Both"));
((RadioGroupControl) newControl).setOptions(options);
}
// text areas get converted to simple text inputs
else if (TextAreaControl.class.isAssignableFrom(attributeDefinition.getControlField().getClass())) {
newControl = ComponentFactory.getTextControl();
} else {
newControl = ComponentUtils.copy(attributeDefinition.getControlField(), "");
}
return newControl;
}
示例9: handleInputFieldInRow
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Special handling of the InputField in the row, replaces necessary content with row specific content
*
* @param item the item being processed
* @param obj the row's object model
* @param row the row in html
* @param index the current row index
* @param originalId the original id of the component item
* @return the updated row
*/
protected String handleInputFieldInRow(Component item, Object obj, String row, int index, String originalId) {
if (!(item instanceof InputField) || ((InputField) item).getControl() == null) {
return row;
}
Control control = ((InputField) item).getControl();
//updates the name path to the current path for any instance this item's propertyName with
//a collection binding prefix
row = row.replace("name=\"" + ((InputField) item).getBindingInfo().getBindingPath() + "\"",
"name=\"" + this.getBindingInfo().getBindingPath() + "[" + index + "]." + ((InputField) item)
.getPropertyName() + "\"");
Object value = ObjectPropertyUtils.getPropertyValue(obj, ((InputField) item).getPropertyName());
String stringValue = "";
if (value == null) {
stringValue = "";
} else if (value.getClass().isAssignableFrom(boolean.class)) {
stringValue = "" + value;
} else if (!(value instanceof Collection)) {
stringValue = ObjectPropertyUtils.getPropertyValueAsText(obj, ((InputField) item).getPropertyName());
}
String controlId = originalId + "_line" + index + UifConstants.IdSuffixes.CONTROL;
if (control instanceof CheckboxControl && stringValue.equalsIgnoreCase("true")) {
//CheckboxControl handling - only replace if true with a checked attribute appended
row = row.replaceAll("(id(\\s)*?=(\\s)*?\"" + controlId + "\")", "$1 checked=\"checked\" ");
} else if (control instanceof TextControl) {
//TextControl handling - replace with
row = row.replaceAll("(id(\\s)*?=(\\s)*?\"" + controlId + "\"(.|\\s)*?value=\")(.|\\s)*?\"",
"$1" + stringValue + "\"");
} else if (control instanceof SelectControl && !((SelectControl) control).isMultiple()) {
//SelectControl handling (single item only)
Pattern pattern = Pattern.compile("<select(\\s)*?id(\\s)*?=(\\s)*?\"" + controlId + "\"(.|\\s)*?</select>");
Matcher matcher = pattern.matcher(row);
String replacement = "";
if (matcher.find()) {
//remove selected from select options
String selected = "selected=\"selected\"";
replacement = matcher.group().replace(selected, "");
//put selected on only the selected option
String selectedValue = "value=\"" + stringValue + "\"";
replacement = replacement.replace(selectedValue, selectedValue + " " + selected);
}
//replace the old select tag with the old one
if (StringUtils.isNotBlank(replacement)) {
row = matcher.replaceAll(replacement);
}
}
currentColumnValue = stringValue;
return row;
}
示例10: getDataFieldColumnOptions
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Construct the column options for a data field
*
* @param target column index
* @param collectionGroup the collectionGroup in which the data field is defined
* @param field the field to construction options for
* @return options as valid for datatable
*/
protected String getDataFieldColumnOptions(int target, CollectionGroup collectionGroup, DataField field) {
String sortDataType = null;
if (!Boolean.TRUE.equals(collectionGroup.getReadOnly())
&& (field instanceof InputField)
&& ((InputField) field).getControl() != null) {
Control control = ((InputField) field).getControl();
if (control instanceof SelectControl) {
sortDataType = UifConstants.TableToolsValues.DOM_SELECT;
} else if (control instanceof CheckboxControl || control instanceof CheckboxGroupControl) {
sortDataType = UifConstants.TableToolsValues.DOM_CHECK;
} else if (control instanceof RadioGroupControl) {
sortDataType = UifConstants.TableToolsValues.DOM_RADIO;
} else {
sortDataType = UifConstants.TableToolsValues.DOM_TEXT;
}
} else {
sortDataType = UifConstants.TableToolsValues.DOM_TEXT;
}
Class<?> dataTypeClass = ObjectPropertyUtils.getPropertyType(collectionGroup.getCollectionObjectClass(),
field.getPropertyName());
// check to see if field has custom sort type
if (field.getSortAs() != null && field.getSortAs().length() > 0) {
if (field.getSortAs().equals(UifConstants.TableToolsValues.CURRENCY)) {
dataTypeClass = KualiDecimal.class;
} else if (field.getSortAs().equals(UifConstants.TableToolsValues.DATE)) {
dataTypeClass = java.sql.Date.class;
} else if (field.getSortAs().equals(UifConstants.TableToolsValues.NUMERIC)) {
dataTypeClass = Number.class;
} else if (field.getSortAs().equals(UifConstants.TableToolsValues.STRING)) {
dataTypeClass = String.class;
}
}
boolean isSortable = true;
if (field.isApplyMask()) {
isSortable = false;
}
return constructTableColumnOptions(target, isSortable, collectionGroup.isUseServerPaging(), dataTypeClass,
sortDataType);
}
示例11: handleInputFieldInRow
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Special handling of the InputField in the row, replaces necessary content with row specific content
*
* @param item the item being processed
* @param obj the row's object model
* @param row the row in html
* @param index the current row index
* @param originalId the original id of the component item
* @return the updated row
*/
protected String handleInputFieldInRow(Component item, Object obj, String row, int index, String originalId) {
if (!(item instanceof InputField) || ((InputField) item).getControl() == null) {
return row;
}
Control control = ((InputField) item).getControl();
//updates the name path to the current path for any instance this item's propertyName with
//a collection binding prefix
row = row.replace("name=\"" + ((InputField) item).getBindingInfo().getBindingPath() + "\"",
"name=\"" + this.getBindingInfo().getBindingPath() + "[" + index + "]." + ((InputField) item)
.getPropertyName() + "\"");
Object value = ObjectPropertyUtils.getPropertyValue(obj, ((InputField) item).getPropertyName());
String stringValue = "";
if (value == null) {
stringValue = "";
} else if (value.getClass().isAssignableFrom(boolean.class)) {
stringValue = "" + value;
} else if (!(value instanceof Collection)) {
stringValue = value.toString();
}
String controlId = originalId + "_line" + index + UifConstants.IdSuffixes.CONTROL;
if (control instanceof CheckboxControl && stringValue.equalsIgnoreCase("true")) {
//CheckboxControl handling - only replace if true with a checked attribute appended
row = row.replaceAll("(id(\\s)*?=(\\s)*?\"" + controlId + "\")", "$1 checked=\"checked\" ");
} else if (control instanceof TextControl) {
//TextControl handling - replace with
row = row.replaceAll("(id(\\s)*?=(\\s)*?\"" + controlId + "\"(.|\\s)*?value=\")(.|\\s)*?\"",
"$1" + stringValue + "\"");
} else if (control instanceof SelectControl && !((SelectControl) control).isMultiple()) {
//SelectControl handling (single item only)
Pattern pattern = Pattern.compile("<select(\\s)*?id(\\s)*?=(\\s)*?\"" + controlId + "\"(.|\\s)*?</select>");
Matcher matcher = pattern.matcher(row);
String replacement = "";
if (matcher.find()) {
//remove selected from select options
String selected = "selected=\"selected\"";
replacement = matcher.group().replace(selected, "");
//put selected on only the selected option
String selectedValue = "value=\"" + stringValue + "\"";
replacement = replacement.replace(selectedValue, selectedValue + " " + selected);
}
//replace the old select tag with the old one
if (StringUtils.isNotBlank(replacement)) {
row = matcher.replaceAll(replacement);
}
}
return row;
}
示例12: getCheckboxControl
import org.kuali.rice.krad.uif.control.CheckboxControl; //导入依赖的package包/类
/**
* Retrieves a new checkbox control instance from Spring (initialized by the bean definition
* with the given id)
*
* @return CheckboxControl
*/
public static CheckboxControl getCheckboxControl() {
return (CheckboxControl) getNewComponentInstance(CHECKBOX_CONTROL);
}