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


Java AbstractField类代码示例

本文整理汇总了Java中com.vaadin.ui.AbstractField的典型用法代码示例。如果您正苦于以下问题:Java AbstractField类的具体用法?Java AbstractField怎么用?Java AbstractField使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractField类属于com.vaadin.ui包,在下文中一共展示了AbstractField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateFields

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
/** Colore les champs en rouge si erreur
 * @param validate
 */
@SuppressWarnings("unchecked")
private void validateFields(Boolean validate){
	listLayoutTraductions.forEach(e -> {		
		AbstractField<String> tf;			
		if (e.getComponent(0) instanceof TextField || e.getComponent(0) instanceof RichTextArea){
			tf = (AbstractField<String>) e.getComponent(0);				
		}else if (e.getComponent(0) instanceof HorizontalLayout){				
			tf = (AbstractField<String>) e.getComponent(1);
		}else{
			tf = (AbstractField<String>) e.getComponent(1);
		}
		/* Ajout du style*/
		if (validate){
			tf.removeStyleName(StyleConstants.FIELD_ERROR_COMPLETE);
		}else{
			tf.addStyleName(StyleConstants.FIELD_ERROR_COMPLETE);
		}
	});
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:23,代码来源:I18nField.java

示例2: findFieldAndFocus

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
private boolean findFieldAndFocus(Component compositionRoot) {
    if (compositionRoot instanceof AbstractComponentContainer) {
        AbstractComponentContainer cc = (AbstractComponentContainer) compositionRoot;

        for (Component component : cc) {
            if (component instanceof AbstractTextField) {
                AbstractTextField abstractTextField = (AbstractTextField) component;
                abstractTextField.selectAll();
                return true;
            }
            if (component instanceof AbstractField) {
                AbstractField<?> abstractField = (AbstractField<?>) component;
                abstractField.focus();
                return true;
            }
            if (component instanceof AbstractComponentContainer) {
                if (findFieldAndFocus(component)) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:25,代码来源:AbstractForm.java

示例3: addComponentListeners

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
protected void addComponentListeners() {
    // avoid duplicate registration
    removeListeners();

    for (final AbstractField<?> field : allComponents) {
        if (field instanceof TextChangeNotifier) {
            ((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
        }

        if (field instanceof Table) {
            ((Table) field).addItemSetChangeListener(new ChangeListener(field));
        }
        field.addValueChangeListener(new ChangeListener(field));

    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:17,代码来源:CommonDialogWindow.java

示例4: getAllComponents

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
private static List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) {
    final List<AbstractField<?>> components = new ArrayList<>();

    final Iterator<Component> iterate = abstractLayout.iterator();
    while (iterate.hasNext()) {
        final Component c = iterate.next();
        if (c instanceof AbstractLayout) {
            components.addAll(getAllComponents((AbstractLayout) c));
        }

        if (c instanceof AbstractField) {
            components.add((AbstractField<?>) c);
        }

        if (c instanceof FlexibleOptionGroupItemComponent) {
            components.add(((FlexibleOptionGroupItemComponent) c).getOwner());
        }

        if (c instanceof TabSheet) {
            final TabSheet tabSheet = (TabSheet) c;
            components.addAll(getAllComponentsFromTabSheet(tabSheet));
        }
    }
    return components;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:26,代码来源:CommonDialogWindow.java

示例5: setPersisted

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Override
public void setPersisted(ET v, boolean persisted) {
    int row = itemsIdentityIndexOf(v) + 1;
    if (isAllowRemovingItems()) {
        Button c = (Button) layout.getComponent(layout.getColumns() - 1, row);
        if (persisted) {
            c.setDescription(getDeleteElementDescription());
        } else {
            for (int i = 0; i < getVisibleProperties().size(); i++) {
                try {
                    AbstractField f = (AbstractField) layout.
                            getComponent(i,
                                    row);
                    // FIXME
                    //f.setValidationVisible(false);
                } catch (Exception e) {

                }
            }
            c.setDescription(getDisabledDeleteElementDescription());
        }
        c.setEnabled(persisted);
    }
}
 
开发者ID:viritin,项目名称:viritin,代码行数:25,代码来源:ElementCollectionField.java

示例6: testAddStateChangeWrapper

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Test
public void testAddStateChangeWrapper() {
	assertNull(viewModelComposer.addStateChangeWrapper(AbstractField.class,
			new StateChangeWrapper() {
				@Override
				public StateChangeListener getStateChangeListener(
						final Object notified) {
					return new StateChangeListener() {
						@SuppressWarnings("unchecked")
						@Override
						public void stateChange(Object value) {
							((AbstractField<Object>) notified)
									.setValue(value);
						}
					};
				}
			}));
}
 
开发者ID:davherrmann,项目名称:annoMVVM,代码行数:19,代码来源:ViewModelComposerTest.java

示例7: testRequiredIndicatorVisible

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Test
public void testRequiredIndicatorVisible() {
	AbstractField<String> field = mock(TextField.class);
	EasyBinding<?,?,?> binding = binder.bind(field, "testIntMin1", new StringToIntegerConverter(""));
	assertNotNull(binding);
	verify(field, times(1)).setRequiredIndicatorVisible(true);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例8: testRequiredIndicatorNotVisible

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Test
public void testRequiredIndicatorNotVisible() {
	AbstractField<String> field = mock(TextField.class);
	EasyBinding<?,?,?> binding = binder.bind(field, "testIntMin0", new StringToIntegerConverter(""));
	assertNotNull(binding);
	verify(field, never()).setRequiredIndicatorVisible(true);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例9: testRequiredIndicatorNotVisibleNoAnnotation

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Test
public void testRequiredIndicatorNotVisibleNoAnnotation() {
	AbstractField<String> field = mock(TextField.class);
	EasyBinding<?,?,?> binding = binder.bind(field, "testInt", new StringToIntegerConverter(""));
	assertNotNull(binding);
	verify(field, never()).setRequiredIndicatorVisible(true);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:8,代码来源:ReflectionBinderTest.java

示例10: testRequiredIndicatorVisibleCustomIndicator

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@Test
public void testRequiredIndicatorVisibleCustomIndicator() {
	AbstractField<String> field = mock(TextField.class);
	binder.setRequiredConfigurator(e -> true);
	assertNotNull(binder.getRequiredConfigurator());
	EasyBinding<?,?,?> binding = binder.bind(field, "testIntMin0", new StringToIntegerConverter(""));
	assertNotNull(binding);
	verify(field, times(1)).setRequiredIndicatorVisible(true);
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:10,代码来源:ReflectionBinderTest.java

示例11: testBuildAndBind

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testBuildAndBind() {
	AutoBinder<MyEntity> binder = new AutoBinder<>(MyEntity.class);
	binder.buildAndBind("car", "car.frontLeft", "car.frontLeft.tire", "spare", "spare.tire");

	MyEntity entity = new MyEntity();
	binder.setBean(entity);

	assertTrue(binder.getFieldForProperty("street").isPresent());
	assertTrue(binder.getFieldForProperty("number").isPresent());
	assertTrue(binder.getFieldForProperty("number2").isPresent());
	assertTrue(binder.getFieldForProperty("car.frontLeft.tire.type").isPresent());
	assertTrue(binder.getFieldForProperty("spare.tire.type").isPresent());
	assertTrue(binder.getFieldForProperty("unknown").isPresent());
	

	AbstractField<String> numberField = (AbstractField<String>) binder.getFieldForProperty("number").get();
	AbstractField<String> numberField2 = (AbstractField<String>) binder.getFieldForProperty("number2").get();

	((HasValue<String>) binder.getFieldForProperty("street").get()).setValue("mystreet");
	assertEquals("mystreet", entity.getStreet());

	numberField.setValue("100");
	assertEquals(new Integer(100), entity.getNumber());

	assertNull(numberField.getComponentError());
	numberField.setValue("0");
	assertNotNull(numberField.getComponentError());
	numberField.setValue("");

	assertEquals(null, entity.getNumber());
	assertNull(numberField.getComponentError());

	numberField2.setValue("");
	assertNotNull(numberField2.getComponentError());
}
 
开发者ID:ljessendk,项目名称:easybinder,代码行数:38,代码来源:AutoBinderTest.java

示例12: getLangueLayout

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
/** Renvoie un layout contenant un choix de langue et une traduction
 * @param traductionOther
 * @return le layout
 */
private HorizontalLayout getLangueLayout(I18nTraduction traductionOther){
	/*Le layout renvoyé*/
	HorizontalLayout hlLangueOther = new HorizontalLayout();
	listLayoutTraductions.add(hlLangueOther);
	hlLangueOther.setSpacing(true);
	hlLangueOther.setWidth(100, Unit.PERCENTAGE);
	
	/*La combobox avec les icones de drapeaux*/
	ComboBoxLangue cbLangue = new ComboBoxLangue(listeLangueEnService,false);
	cbLangue.selectLangue((traductionOther==null?null:traductionOther.getLangue()));
	cbLangue.setWidth(75, Unit.PIXELS);
	hlLangueOther.addComponent(cbLangue);
	
	/*Le textField... ou */
	AbstractField<String> tfValOther = getNewValueComponent();		
	tfValOther.setWidth(100, Unit.PERCENTAGE);
	if (traductionOther!=null){
		tfValOther.setValue(traductionOther.getValTrad());
	}		
	hlLangueOther.addComponent(tfValOther);
	hlLangueOther.setExpandRatio(tfValOther,1);
	
	/*Le bouton de suppression de la langue*/
	OneClickButton removeLangue = new OneClickButton(FontAwesome.MINUS_SQUARE_O);
	removeLangue.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
	removeLangue.addStyleName(ValoTheme.BUTTON_BORDERLESS);
	removeLangue.addClickListener(e->{layoutLangue.removeComponent(hlLangueOther);listLayoutTraductions.remove(hlLangueOther);checkVisibleAddLangue();centerWindow();});
	hlLangueOther.addComponent(removeLangue);
	return hlLangueOther;
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:35,代码来源:I18nField.java

示例13: substract

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void substract(Component c, int value) {
       if (c instanceof AbstractField) {
           ((AbstractField<Integer>) c).setValue(((AbstractField<Integer>) c).getValue() - value);
       } else if (c instanceof Label) {
           ((Label) c).setValue(String.valueOf(Integer.parseInt(((Label) c).getValue()) - value));
       }
   }
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:9,代码来源:ShopItem.java

示例14: add

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void add(Component c, int value) {
       if (c instanceof AbstractField) {
           ((AbstractField<Integer>) c).setValue(((AbstractField<Integer>) c).getValue() + value);
       } else if (c instanceof Label) {
           ((Label) c).setValue(String.valueOf(Integer.parseInt(((Label) c).getValue()) + value));
       }
   }
 
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:9,代码来源:ShopItem.java

示例15: removeListeners

import com.vaadin.ui.AbstractField; //导入依赖的package包/类
private void removeListeners() {
    for (final AbstractField<?> field : allComponents) {
        removeTextListener(field);
        removeValueChangeListener(field);
        removeItemSetChangeistener(field);
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:8,代码来源:CommonDialogWindow.java


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