本文整理汇总了Java中com.vaadin.ui.Field.setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java Field.setReadOnly方法的具体用法?Java Field.setReadOnly怎么用?Java Field.setReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.Field
的用法示例。
在下文中一共展示了Field.setReadOnly方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildAndBindField
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
* Method called to generate and bind the Field component corresponding to a
* scalar property
* @param label
* @param propId
* @param prop
* @return the generated Field object
*/
protected Field<?> buildAndBindField(String label, String propId, Property<?> prop)
{
Field<?> field = fieldGroup.buildAndBind(label, propId);
Class<?> propType = prop.getType();
if (propId.equals(PROP_ID))
field.setReadOnly(true);
else if (propId.endsWith("." + PROP_ID))
field.setVisible(false);
else if (propId.endsWith("." + PROP_NAME))
field.setVisible(false);
else if (propId.endsWith(PROP_ENABLED))
field.setVisible(false);
else if (propId.endsWith(PROP_MODULECLASS))
field.setReadOnly(true);
if (propType.equals(String.class))
field.setWidth(500, Unit.PIXELS);
else if (propType.equals(int.class) || propType.equals(Integer.class) ||
propType.equals(float.class) || propType.equals(Float.class) ||
propType.equals(double.class) || propType.equals(Double.class))
field.setWidth(200, Unit.PIXELS);
else if (Enum.class.isAssignableFrom(propType))
((ListSelect)field).setRows(3);
if (field instanceof TextField) {
((TextField)field).setNullSettingAllowed(true);
((TextField)field).setNullRepresentation("");
}
return field;
}
示例2: configureField
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
* Configure the field defaults, depending on the FieldBinder settings.
*
* <code>
* field.setBuffered(isBuffered());
* field.setEnabled(isEnabled());
* if (field.getPropertyDataSource().isReadOnly()) {
* field.setReadOnly(true)
* } else { field.setReadOnly(isReadOnly()); }
* </code>
*/
protected void configureField(Field<?> field) {
field.setBuffered(isBuffered());
field.setEnabled(isEnabled());
if (field.getPropertyDataSource() != null
&& field.getPropertyDataSource().isReadOnly()) {
field.setReadOnly(true);
} else {
field.setReadOnly(isReadOnly());
}
}
示例3: setReadOnly
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
* Sets the read only state to the given value for all fields with writable
* data source. Fields with read only data source will always be set to read
* only.
*
* @param fieldsReadOnly
* true to set the fields with writable data source to read only,
* false to set them to read write
*/
public void setReadOnly(boolean fieldsReadOnly) {
getFieldGroup().setReadOnly(fieldsReadOnly);
for (Field<?> field : getFields()) {
if (field.getPropertyDataSource() != null
&& field.getPropertyDataSource().isReadOnly()) {
field.setReadOnly(true);
} else {
field.setReadOnly(fieldsReadOnly);
}
}
}
示例4: createField
import com.vaadin.ui.Field; //导入方法依赖的package包/类
public Field<?> createField(final Container dataContainer, final Object itemId, final Object propertyId,
com.vaadin.ui.Component uiContext) {
final Route route = (Route) itemId;
Field<?> field = null;
if (propertyId.equals("matchExpression")) {
final TextField textField = new ImmediateUpdateTextField(null) {
@Override
protected void save(String text) {
route.setMatchExpression(text);
EditContentRouterPanel.this.save();
}
};
textField.setWidth(100, Unit.PERCENTAGE);
textField.setValue(route.getMatchExpression());
field = textField;
} else if (propertyId.equals("targetStepId")) {
final ComboBox combo = new ComboBox();
combo.setWidth(100, Unit.PERCENTAGE);
flow = context.getConfigurationService().findFlow(flow.getId());
List<FlowStepLink> stepLinks = flow.findFlowStepLinksWithSource(flowStep.getId());
for (FlowStepLink flowStepLink : stepLinks) {
FlowStep comboStep = flow.findFlowStepWithId(flowStepLink.getTargetStepId());
combo.addItem(comboStep.getId());
combo.setItemCaption(comboStep.getId(), comboStep.getName());
if (flowStepLink.getTargetStepId().equals(route.getTargetStepId()) || combo.getValue() == null) {
combo.setValue(comboStep.getId());
}
}
combo.setImmediate(true);
combo.setNewItemsAllowed(false);
combo.setNullSelectionAllowed(false);
combo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
String stepId = (String) event.getProperty().getValue();
if (stepId != null) {
route.setTargetStepId(stepId);
EditContentRouterPanel.this.save();
}
}
});
field = combo;
}
if (field != null) {
field.setReadOnly(readOnly);
}
return field;
}
示例5: resetField
import com.vaadin.ui.Field; //导入方法依赖的package包/类
/**
* Clear field status:
*
* <code>
* field.setBuffered(false);
* field.setEnabled(true);
* field.setReadOnly(false);
* field.setValue(null);
* </code>
*/
protected void resetField(Field<?> field) {
field.setBuffered(false);
field.setEnabled(true);
field.setReadOnly(false);
field.setValue(null);
}