Java源码示例:com.smartgwt.client.widgets.form.fields.SpacerItem
示例1
/**
* Instantiates a welcome layout.
*/
public WelcomeLayout() {
super(i18n.welcomeText());
this.scClassName = "VLayout";
SpacerItem spacerItem = new SpacerItem();
spacerItem.setHeight(20);
this.welcomeText = new StaticTextItem("welcomeText");
this.welcomeText.setShowTitle(false);
this.welcomeText.setValue("");
this.roleText = new StaticTextItem("roleText");
this.roleText.setShowTitle(false);
this.roleText.setValue("");
this.form.setFields(this.headerItem, spacerItem, spacerItem, this.welcomeText, spacerItem, this.roleText);
// add to mainLayout
addMember(this.form);
}
示例2
private SpacerItem createSpacerItem(String width, FormItemIfFunction showIf) {
SpacerItem item = new SpacerItem();
if (width != null) {
item.setWidth(width);
}
if (showIf != null) {
item.setShowIfCondition(showIf);
}
return item;
}
示例3
private HLayout createSingle(String ruleName){
this.singleCount++;
DynamicForm block1 = new DynamicForm();
block1.setWidth("50%");
block1.setNumCols(1);
DynamicForm block2 = new DynamicForm();
block2.setWidth("50%");
block2.setNumCols(1);
SelectItem rule1Item = new SelectItem();
rule1Item.setShowTitle(false);
rule1Item.setValueMap(this.rulesHashMap);
rule1Item.setWidth(this.selectItemWidth);
if (ruleName != null) {
rule1Item.setValue(ruleName);
}
SpacerItem spacerItem = new SpacerItem();
spacerItem.setShowTitle(false);
spacerItem.setHeight(20);
block2.setFields(rule1Item);
HLayout layout = new HLayout();
layout.setWidth(200);
layout.setHeight(25);
layout.addMember(block1);
layout.addMember(block2);
// save tree
this.tempTree = this.rootTree;
Tree right = new Tree(rule1Item, null, null);
this.rootTree = new Tree(this.singleOperator, this.tempTree, right);
return layout;
}
示例4
private void refresh() {
vm.clearValues();
vm.clearErrors(false);
if (formsContainer.getMembers() != null)
formsContainer.removeMembers(formsContainer.getMembers());
DynamicForm form2 = new DynamicForm();
form2.setWidth100();
form2.setTitleOrientation(TitleOrientation.TOP);
form2.setValuesManager(vm);
form2.setNumCols(1);
final TextAreaItem automation = ItemFactory.newTextAreaItemForAutomation("automation", "automation",
trigger.getAutomation(), changedHandler, false);
automation.setStartRow(false);
automation.setWidth("*");
automation.setDisabled(trigger.getRoutine()!=null);
form2.setItems(automation);
DynamicForm form1 = new DynamicForm();
form1.setNumCols(2);
form1.setTitleOrientation(TitleOrientation.TOP);
form1.setValuesManager(vm);
form1.setHeight100();
SelectItem events = ItemFactory.newEventsSelector("events", I18N.message("triggeron"), changedHandler, true, true,
true);
events.setRowSpan(3);
events.setValues(trigger.getEventsArray());
SpacerItem spacer = new SpacerItem();
spacer.setHeight(100);
SelectItem routine = ItemFactory.newAutomationRoutineSelector("routine",
trigger.getRoutine() != null ? trigger.getRoutine().getId() : null, changedHandler, true);
routine.setEndRow(true);
routine.addChangedHandler(changedHandler);
ChangedHandler cngHandler = new ChangedHandler() {
@Override
public void onChanged(ChangedEvent event) {
if (event == null) {
automation.setDisabled(false);
} else {
automation.setDisabled(event.getValue() != null && !event.getValue().toString().isEmpty());
}
}
};
routine.addChangedHandler(cngHandler);
form1.setItems(events, folderSelector, routine, spacer);
formsContainer.setMembers(form1, form2);
}
示例5
private void addSingle(String op, String ruleName){
// get all members from mainLayout and clear the layout
Canvas[] members = this.ruleBlockLayout.getMembers();
this.ruleBlockLayout.removeMembers(this.ruleBlockLayout.getMembers());
LinkedHashMap<String, String> operatorHashMap = getLogicalOperators();
VLayout v2 = new VLayout();
v2.setWidth("70%");
v2.addMember(members[0]);
v2.addMember(createSingle(ruleName));
DynamicForm block1 = new DynamicForm();
block1.setWidth("30%");
block1.setNumCols(1);
this.singleOperator = new SelectItem();
this.singleOperator.setShowTitle(false);
this.singleOperator.setWidth(this.operatorWidth);
this.singleOperator.setValueMap(operatorHashMap);
this.singleOperator.setTextAlign(Alignment.CENTER);
if (op != null) {
this.singleOperator.setValue(op);
} else {
this.singleOperator.setValue(LogicalOperator.AND.toString());
}
SpacerItem spacerItem = new SpacerItem();
spacerItem.setShowTitle(false);
spacerItem.setHeight(20);
block1.setFields(spacerItem, spacerItem, this.singleOperator);
HLayout layout = new HLayout();
layout.setWidth(200);
layout.setHeight(25);
layout.setEdgeMarginSize(1);
layout.setEdgeSize(2);
layout.setShowEdges(true);
layout.addMember(block1);
layout.addMember(v2);
this.ruleBlockLayout.addMember(layout);
}