本文整理匯總了Java中org.kuali.rice.krad.uif.util.ComponentFactory.getInputField方法的典型用法代碼示例。如果您正苦於以下問題:Java ComponentFactory.getInputField方法的具體用法?Java ComponentFactory.getInputField怎麽用?Java ComponentFactory.getInputField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kuali.rice.krad.uif.util.ComponentFactory
的用法示例。
在下文中一共展示了ComponentFactory.getInputField方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performCustomInitialization
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
@Override
public void performCustomInitialization(LifecycleElement component) {
super.performCustomInitialization(component);
List<Component> fields = new ArrayList<Component>();
if(component instanceof PageGroup && component.getId().equals("UifGeneratedFields-Page1")){
for(int i=0; i < 400; i++){
InputField field = ComponentFactory.getInputField();
Control control = ComponentFactory.getTextControl();
field.setControl(control);
field.setPropertyName("field1");
field.setLabel("Field");
field.setRequired(true);
fields.add(field);
}
((PageGroup) component).setItems(fields);
}
}
示例2: performCustomInitialization
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
@Override
protected void performCustomInitialization(View view, Component component) {
super.performCustomInitialization(view, component);
List<Component> fields = new ArrayList<Component>();
if(component instanceof PageGroup && component.getId().equals("UifGeneratedFields-Page1")){
for(int i=0; i < 400; i++){
InputField field = ComponentFactory.getInputField();
view.assignComponentIds(field);
Control control = ComponentFactory.getTextControl();
view.assignComponentIds(control);
field.setControl(control);
field.setPropertyName("field1");
field.setLabel("Field");
field.setRequired(true);
fields.add(field);
}
((PageGroup) component).setItems(fields);
}
}
示例3: testComplexMessageGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test a complex message which combines all the above tested functionality
*/
@Test
public void testComplexMessageGeneration() {
List<Component> components;
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("[p][css=class]Message [link=http://www.kuali.org]link[/link][/css] [0]"
+ " [action=methodToCall,false data={key: 'value'}]action text[/action]"
+ " [color=green]text [id=Uif-Link href='http://www.google.com' linkText=Linky]"
+ " [b]more text[/b][/color]\\[0\\][/p]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals(
"<p><span class='class'>Message <a href='http://www.kuali.org' target='_blank'>link</a></span> ",
((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" <a href=\"javascript:void(null)\" "
+ "onclick=\"submitForm('methodToCall',{key: 'value'},false,true,null); return false;\">"
+ "action text</a> <span style='color: green;'>text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof Link);
Assert.assertEquals("http://www.google.com", ((Link) components.get(3)).getHref());
Assert.assertEquals("Linky", ((Link) components.get(3)).getLinkText());
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" <b>more text</b></span>"
+ KRADConstants.MessageParsing.LEFT_BRACKET
+ "0"
+ KRADConstants.MessageParsing.RIGHT_BRACKET
+ "</p>", ((Message) components.get(4)).getMessageText());
}
示例4: testRichMultiValueOptions
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test rich message options available on MultiValueControls
*/
@Test
public void testRichMultiValueOptions() {
List<KeyValue> options = new ArrayList<KeyValue>();
options.add(new ConcreteKeyValue("1", "[color=green]Option [b]1[/b][/color]"));
options.add(new ConcreteKeyValue("2", "Option 2 [link='http://www.kuali.org']link[/link]"));
options.add(new ConcreteKeyValue("3", "Other: [id=Uif-InputField propertyName=field1]"));
options.add(new ConcreteKeyValue("4", "Other 2: [0]"));
RadioGroupControl radioGroupControl = ComponentFactory.getRadioGroupControl();
List<Component> inline = new ArrayList<Component>();
InputField field2 = ComponentFactory.getInputField();
field2.setPropertyName("field2");
inline.add(field2);
radioGroupControl.setInlineComponents(inline);
radioGroupControl.setOptions(options);
performSimulatedLifecycle(radioGroupControl);
for (LifecycleElement component : ViewLifecycleUtils.getElementsForLifecycle(radioGroupControl).values()) {
if (component instanceof Component) {
performSimulatedLifecycle((Component) component);
}
}
List<KeyMessage> richOptions = radioGroupControl.getRichOptions();
Assert.assertEquals("<span style='color: green;'>Option <b>1</b></span>", ((Message) (richOptions.get(0)
.getMessage().getMessageComponentStructure().get(0))).getMessageText());
Assert.assertEquals("Option 2 <a href='http://www.kuali.org' target='_blank'>link</a>",
((Message) (richOptions.get(1).getMessage().getMessageComponentStructure().get(0))).getMessageText());
Assert.assertEquals("Other: ", ((Message) (richOptions.get(2).getMessage().getMessageComponentStructure().get(
0))).getMessageText());
Assert.assertEquals("field1", ((InputField) (richOptions.get(2).getMessage().getMessageComponentStructure().get(
1))).getPropertyName());
Assert.assertEquals("Other 2: ", ((Message) (richOptions.get(3).getMessage().getMessageComponentStructure().get(
0))).getMessageText());
Assert.assertEquals("field2", ((InputField) (richOptions.get(3).getMessage().getMessageComponentStructure().get(
1))).getPropertyName());
}
示例5: testComplexMessageGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test a complex message which combines all the above tested functionality
*/
@Test
public void testComplexMessageGeneration() {
List<Component> components;
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("[p][css=class]Message [link=http://www.kuali.org]link[/link][/css] [0]"
+ " [action=methodToCall,false data={key: 'value'}]action text[/action]"
+ " [color=green]text [id=Uif-Link href='http://www.google.com' linkText=Linky]"
+ " [b]more text[/b][/color]\\[0\\][/p]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals(
"<p><span class='class'>Message <a href='http://www.kuali.org' target='_blank'>link</a></span> ",
((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" <a href=\"javascript:void(null)\" "
+ "onclick=\"submitForm('methodToCall',{key: 'value'},false,true,null); return false;\">"
+ "action text</a> <span style='color: green;'>text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof Link);
Assert.assertEquals("http://www.google.com", ((Link) components.get(3)).getHref());
Assert.assertEquals("Linky", ((Link) components.get(3)).getLinkText());
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" <b>more text</b></span>"
+ KRADConstants.MessageParsing.LEFT_BRACKET
+ "0"
+ KRADConstants.MessageParsing.RIGHT_BRACKET
+ "</p>", ((Message) components.get(4)).getMessageText());
}
示例6: testRichMultiValueOptions
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test rich message options available on MultiValueControls
*/
@Test
public void testRichMultiValueOptions() {
List<KeyValue> options = new ArrayList<KeyValue>();
options.add(new ConcreteKeyValue("1", "[color=green]Option [b]1[/b][/color]"));
options.add(new ConcreteKeyValue("2", "Option 2 [link='http://www.kuali.org']link[/link]"));
options.add(new ConcreteKeyValue("3", "Other: [id=Uif-InputField propertyName=field1]"));
options.add(new ConcreteKeyValue("4", "Other 2: [0]"));
RadioGroupControl radioGroupControl = ComponentFactory.getRadioGroupControl();
List<Component> inline = new ArrayList<Component>();
InputField field2 = ComponentFactory.getInputField();
field2.setPropertyName("field2");
inline.add(field2);
radioGroupControl.setInlineComponents(inline);
radioGroupControl.setOptions(options);
performSimulatedLifecycle(radioGroupControl);
for (Component component : radioGroupControl.getComponentsForLifecycle()) {
performSimulatedLifecycle(component);
}
List<KeyMessage> richOptions = radioGroupControl.getRichOptions();
Assert.assertEquals("<span style='color: green;'>Option <b>1</b></span>", ((Message) (richOptions.get(0)
.getMessage().getMessageComponentStructure().get(0))).getMessageText());
Assert.assertEquals("Option 2 <a href='http://www.kuali.org' target='_blank'>link</a>",
((Message) (richOptions.get(1).getMessage().getMessageComponentStructure().get(0))).getMessageText());
Assert.assertEquals("Other: ", ((Message) (richOptions.get(2).getMessage().getMessageComponentStructure().get(
0))).getMessageText());
Assert.assertEquals("field1", ((InputField) (richOptions.get(2).getMessage().getMessageComponentStructure().get(
1))).getPropertyName());
Assert.assertEquals("Other 2: ", ((Message) (richOptions.get(3).getMessage().getMessageComponentStructure().get(
0))).getMessageText());
Assert.assertEquals("field2", ((InputField) (richOptions.get(3).getMessage().getMessageComponentStructure().get(
1))).getPropertyName());
}
示例7: testInlineComponentGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test the ability to put components defined on the message inline by index number.
*/
@Test
public void testInlineComponentGeneration() {
List<Component> components;
//One inline component
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("Message text [0] Message text", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(3, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text", ((Message) components.get(2)).getMessageText());
//Two inline components with html content
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
InputField inputField2 = ComponentFactory.getInputField();
inputField2.setPropertyName("field2");
inline = new ArrayList<Component>();
inline.add(inputField1);
inline.add(inputField2);
generateAndSetMessage("[p class='cssClass']Message text [0] Message [b]text [1] other[/b] text[/p]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("<p class='cssClass'>Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message <b>text ", ((Message) components.get(2)).getMessageText());
Assert.assertFalse(((Message) components.get(2)).isRenderWrapperTag());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" other</b> text</p>", ((Message) components.get(4)).getMessageText());
//inline components with changed properties
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
inputField2 = ComponentFactory.getInputField();
inputField2.setPropertyName("field2");
inline = new ArrayList<Component>();
inline.add(inputField1);
inline.add(inputField2);
generateAndSetMessage(
"[p class='cssClass']Message text [0 propertyName='field20'] Message [b]text [1 cssClasses='c1 c2' required=true] other[/b] text[/p]",
inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("<p class='cssClass'>Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field20", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message <b>text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(((InputField) components.get(3)).getRequired());
Assert.assertTrue(((InputField) components.get(3)).getCssClasses().contains("c1 c2"));
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" other</b> text</p>", ((Message) components.get(4)).getMessageText());
}
示例8: testIdComponentGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test the ability to put components inline by id
*/
@Test
public void testIdComponentGeneration() {
List<Component> components;
//One inline component and id component
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("Message text [0] Message text [id=Uif-Link]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(4, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof Link);
//One inline component and id components
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage(
"Message text [0] Message text [id=Uif-InputField propertyName=field2][id=Uif-InputField propertyName=field3]",
inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(components.get(4) instanceof InputField);
Assert.assertEquals("field3", ((InputField) components.get(4)).getPropertyName());
}
示例9: testInlineComponentGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test the ability to put components defined on the message inline by index number.
*/
@Test
public void testInlineComponentGeneration() {
List<Component> components;
//One inline component
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("Message text [0] Message text", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(3, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text", ((Message) components.get(2)).getMessageText());
//Two inline components with html content
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
InputField inputField2 = ComponentFactory.getInputField();
inputField2.setPropertyName("field2");
inline = new ArrayList<Component>();
inline.add(inputField1);
inline.add(inputField2);
generateAndSetMessage("[p class='cssClass']Message text [0] Message [b]text [1] other[/b] text[/p]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("<p class='cssClass'>Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message <b>text ", ((Message) components.get(2)).getMessageText());
Assert.assertFalse(((Message) components.get(2)).isGenerateSpan());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" other</b> text</p>", ((Message) components.get(4)).getMessageText());
//inline components with changed properties
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
inputField2 = ComponentFactory.getInputField();
inputField2.setPropertyName("field2");
inline = new ArrayList<Component>();
inline.add(inputField1);
inline.add(inputField2);
generateAndSetMessage(
"[p class='cssClass']Message text [0 propertyName='field20'] Message [b]text [1 cssClasses='c1 c2' required=true] other[/b] text[/p]",
inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("<p class='cssClass'>Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field20", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message <b>text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(((InputField) components.get(3)).getRequired());
Assert.assertTrue(((InputField) components.get(3)).getCssClasses().contains("c1 c2"));
Assert.assertTrue(components.get(4) instanceof Message);
Assert.assertEquals(" other</b> text</p>", ((Message) components.get(4)).getMessageText());
}
示例10: testIdComponentGeneration
import org.kuali.rice.krad.uif.util.ComponentFactory; //導入方法依賴的package包/類
/**
* Test the ability to put components inline by id
*/
@Test
public void testIdComponentGeneration() {
List<Component> components;
//One inline component and id component
InputField inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
List<Component> inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage("Message text [0] Message text [id=Uif-Link]", inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(4, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof Link);
//One inline component and id components
inputField1 = ComponentFactory.getInputField();
inputField1.setPropertyName("field1");
inline = new ArrayList<Component>();
inline.add(inputField1);
generateAndSetMessage(
"Message text [0] Message text [id=Uif-InputField propertyName=field2][id=Uif-InputField propertyName=field3]",
inline);
components = message.getMessageComponentStructure();
Assert.assertNotNull(components);
Assert.assertEquals(5, components.size());
Assert.assertTrue(components.get(0) instanceof Message);
Assert.assertEquals("Message text ", ((Message) components.get(0)).getMessageText());
Assert.assertTrue(components.get(1) instanceof InputField);
Assert.assertEquals("field1", ((InputField) components.get(1)).getPropertyName());
Assert.assertTrue(components.get(2) instanceof Message);
Assert.assertEquals(" Message text ", ((Message) components.get(2)).getMessageText());
Assert.assertTrue(components.get(3) instanceof InputField);
Assert.assertEquals("field2", ((InputField) components.get(3)).getPropertyName());
Assert.assertTrue(components.get(4) instanceof InputField);
Assert.assertEquals("field3", ((InputField) components.get(4)).getPropertyName());
}