当前位置: 首页>>代码示例>>Java>>正文


Java Field.setReadOnly方法代码示例

本文整理汇总了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;
}
 
开发者ID:sensiasoft,项目名称:sensorhub,代码行数:41,代码来源:GenericConfigForm.java

示例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());
    }
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:23,代码来源:AbstractFieldBinder.java

示例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);
        }
    }
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:21,代码来源:AbstractFieldBinder.java

示例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;
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:50,代码来源:EditContentRouterPanel.java

示例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);
}
 
开发者ID:tyl,项目名称:field-binder,代码行数:17,代码来源:AbstractFieldBinder.java


注:本文中的com.vaadin.ui.Field.setReadOnly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。