本文整理匯總了Java中org.kuali.rice.krad.uif.util.ComponentFactory.getNewComponentInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java ComponentFactory.getNewComponentInstance方法的具體用法?Java ComponentFactory.getNewComponentInstance怎麽用?Java ComponentFactory.getNewComponentInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kuali.rice.krad.uif.util.ComponentFactory
的用法示例。
在下文中一共展示了ComponentFactory.getNewComponentInstance方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: autoAddActiveCriteria
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Adds the 'active' property criteria to the criteria fields if the BO is inactivatable
*/
private void autoAddActiveCriteria() {
boolean hasActiveCriteria = false;
for (Component field : getCriteriaFields()) {
if (((InputField)field).getPropertyName().equals("active")) {
hasActiveCriteria = true;
}
}
if (!hasActiveCriteria) {
AttributeDefinition attributeDefinition = KRADServiceLocatorWeb.getDataDictionaryService().getAttributeDefinition(
dataObjectClassName.getName(), "active");
LookupInputField activeField = new LookupInputField();
if (attributeDefinition == null) {
activeField = (LookupInputField)ComponentFactory.getNewComponentInstance("Uif-LookupActiveInputField");
}else{
activeField = (LookupInputField)ComponentFactory.getNewComponentInstance("Uif-LookupCriteriaInputField");
activeField.setPropertyName("active");
activeField.copyFromAttributeDefinition(this, attributeDefinition);
}
getCriteriaFields().add(activeField);
}
}
示例2: addActiveCriteriaIfNecessary
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Adds the 'active' property criteria to the criteria fields if the BO is inactivatable and their is
* not already a lookup field for the active property.
*/
protected void addActiveCriteriaIfNecessary() {
boolean isInactivatableClass = Inactivatable.class.isAssignableFrom(dataObjectClass);
if (!autoAddActiveCriteria || !isInactivatableClass) {
return;
}
boolean hasActiveCriteria = false;
for (Component field : getCriteriaFields()) {
if (((InputField) field).getPropertyName().equals(UifPropertyPaths.ACTIVE)) {
hasActiveCriteria = true;
}
}
if (hasActiveCriteria) {
return;
}
AttributeDefinition attributeDefinition =
KRADServiceLocatorWeb.getDataDictionaryService().getAttributeDefinition(dataObjectClass.getName(),
UifPropertyPaths.ACTIVE);
LookupInputField activeLookupField;
if (attributeDefinition == null) {
activeLookupField = (LookupInputField) ComponentFactory.getNewComponentInstance(
ComponentFactory.LOOKUP_ACTIVE_INPUT_FIELD);
} else {
activeLookupField = (LookupInputField) ComponentFactory.getNewComponentInstance(
ComponentFactory.LOOKUP_INPUT_FIELD);
activeLookupField.setPropertyName(UifPropertyPaths.ACTIVE);
activeLookupField.copyFromAttributeDefinition(attributeDefinition);
}
getCriteriaFields().add(activeLookupField);
}
示例3: setupEditLineDialog
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Helper method to create and setup the edit line dialog for the indexed line.
*
* @param editLineDialog the dialog to setup for editing the line
* @param group the collection group to create line dialogs for
* @param lineIndex the current line index
* @param lineSuffix the line suffix to use on dialog component id's
* @param currentLine the data object bound to the current line
*/
protected void setupEditLineDialog(DialogGroup editLineDialog, CollectionGroup group, int lineIndex,
String lineSuffix, Object currentLine) {
// use the edit line dialog's save action prototype to initialilze the edit line dialog's save action
Action editLineInDialogSaveAction = ComponentUtils.copy(group.getEditInDialogSaveActionPrototype());
editLineInDialogSaveAction.setId(editLineDialog.getId() + "_" +
ComponentFactory.EDIT_LINE_IN_DIALOG_SAVE_ACTION + Integer.toString(lineIndex));
// setup the cancel action for the edit line dialog
Action cancelEditLineInDialogAction = (Action) ComponentFactory.
getNewComponentInstance(ComponentFactory.DIALOG_DISMISS_ACTION);
cancelEditLineInDialogAction.setId(editLineDialog.getId() + "_" +
ComponentFactory.DIALOG_DISMISS_ACTION + Integer.toString(lineIndex));
cancelEditLineInDialogAction.setRefreshId(group.getId());
cancelEditLineInDialogAction.setMethodToCall(UifConstants.MethodToCallNames.CLOSE_EDIT_LINE_DIALOG);
cancelEditLineInDialogAction.setDialogDismissOption("REQUEST");
// add the created save action to the dialog's footer items
List<Component> actionComponents = new ArrayList<Component>();
if (editLineDialog.getFooter().getItems() != null) {
actionComponents.addAll(editLineDialog.getFooter().getItems());
}
actionComponents.add(editLineInDialogSaveAction);
actionComponents.add(cancelEditLineInDialogAction);
editLineDialog.getFooter().setItems(actionComponents);
// initialize the dialog actions
List<Action> actions = ViewLifecycleUtils.getElementsOfTypeDeep(actionComponents, Action.class);
group.getCollectionGroupBuilder().initializeActions(actions, group, lineIndex);
editLineDialog.getFooter().setItems(actionComponents);
// set the header actions (for example the close button/icon) to refresh the underlying edit line
// collection and resetting the edit line dialog
if (editLineDialog.getHeader().getUpperGroup().getItems() != null) {
List<Action> headerActions = ViewLifecycleUtils.getElementsOfTypeDeep(editLineDialog.getHeader().
getUpperGroup().getItems(), Action.class);
initializeActions(headerActions, group, lineIndex);
for (Action headerAction : headerActions) {
headerAction.setRefreshId(group.getId());
headerAction.setMethodToCall(UifConstants.MethodToCallNames.CLOSE_EDIT_LINE_DIALOG);
headerAction.setDialogDismissOption("REQUEST");
headerAction.setActionScript(null);
}
}
// update the context of the dialog for the current line
ContextUtils.updateContextForLine(editLineDialog, group, currentLine, lineIndex, lineSuffix);
}
示例4: performApplyModel
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
public void performApplyModel(Object model, LifecycleElement parent) {
super.performApplyModel(model, parent);
ViewModel viewModel = (ViewModel) model;
View view = ViewLifecycle.getView();
// if server paging is enabled get the display start from post data so we build the correct page
if (this.isUseServerPaging()) {
Object displayStart = ViewLifecycle.getViewPostMetadata().getComponentPostData(this.getId(),
UifConstants.PostMetadata.COLL_DISPLAY_START);
if (displayStart != null) {
this.setDisplayStart(((Integer) displayStart).intValue());
}
Object displayLength = ViewLifecycle.getViewPostMetadata().getComponentPostData(this.getId(),
UifConstants.PostMetadata.COLL_DISPLAY_LENGTH);
if (displayLength != null) {
this.setDisplayLength(((Integer) displayLength).intValue());
}
}
// if we are processing a paging request for this component, invoke the layout managers to carry out the paging
if (viewModel.isCollectionPagingRequest() && StringUtils.equals(viewModel.getUpdateComponentId(), getId())) {
((CollectionLayoutManager) getLayoutManager()).processPagingRequest(model, this);
}
if (StringUtils.isNotBlank(this.getId()) && viewModel.getViewPostMetadata() != null
&& viewModel.getViewPostMetadata().getAddedCollectionObjects().get(this.getId()) != null) {
List<Object> newLines = viewModel.getViewPostMetadata().getAddedCollectionObjects().get(this.getId());
// if newLines is empty this means its an addLine case (no additional processing) so init collection line
if (newLines.isEmpty()) {
initializeNewCollectionLine(view, model, this, true);
}
for (Object newLine : newLines) {
ViewLifecycle.getHelper().applyDefaultValuesForCollectionLine(this, newLine);
}
}
// adds the script to the add line buttons to keep collection on the same page
if (this.renderAddBlankLineButton) {
if (this.addBlankLineAction == null) {
this.addBlankLineAction = (Action) ComponentFactory.getNewComponentInstance(
ComponentFactory.ADD_BLANK_LINE_ACTION);
}
if (addLinePlacement.equals(UifConstants.Position.BOTTOM.name())) {
this.addBlankLineAction.setOnClickScript("writeCurrentPageToSession(this, 'last');");
} else {
this.addBlankLineAction.setOnClickScript("writeCurrentPageToSession(this, 'first');");
}
} else if (this.addWithDialog) {
setupAddLineDialog();
}
pushCollectionGroupToReference();
// set up action validation scripts to avoid bind errors
List<Component> allComponents = new ArrayList<Component>(getItems());
allComponents.addAll(getAddLineItems());
List<Component> allActionComponents = new ArrayList<Component>(getLineActions());
allActionComponents.addAll(getAddLineActions());
setupLineActionValidationScripts(allComponents, allActionComponents);
// if rendering the collection group, build out the lines
if (isRender()) {
getCollectionGroupBuilder().build(view, model, this);
}
}