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


Java LabeledEnum类代码示例

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


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

示例1: registerDefaultBinders

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
protected void registerDefaultBinders()
{
    registerBinderForPropertyType(String.class, new TextComponentBinder());
    registerBinderForPropertyType(boolean.class, new CheckBoxBinder());
    registerBinderForPropertyType(Boolean.class, new CheckBoxBinder());
    registerBinderForPropertyType(LabeledEnum.class, new LabeledEnumComboBoxBinder());
    registerBinderForControlType(JTextComponent.class, new TextComponentBinder());
    registerBinderForControlType(JFormattedTextField.class, new FormattedTextFieldBinder(null));
    registerBinderForControlType(JTextArea.class, new TextAreaBinder());
    registerBinderForControlType(JToggleButton.class, new ToggleButtonBinder());
    registerBinderForControlType(JCheckBox.class, new CheckBoxBinder());
    registerBinderForControlType(JComboBox.class, new ComboBoxBinder());
    registerBinderForControlType(JList.class, new ListBinder());
    registerBinderForControlType(JLabel.class, new LabelBinder());
    registerBinderForControlType(JScrollPane.class, new ScrollPaneBinder(this, JTextArea.class));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:17,代码来源:SwingBinderSelectionStrategy.java

示例2: doBindControl

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
protected void doBindControl(ListModel bindingModel) {
    setRenderer(new LabeledEnumListRenderer(getMessageSource()));
    setEditor(new LabeledEnumComboBoxEditor(getMessageSource(), getEditor()));
    CompoundComparator comparator = new CompoundComparator();
    comparator.addComparator(LabeledEnum.LABEL_ORDER);
    comparator.addComparator(new ComparableComparator());
    setComparator(comparator);
    super.doBindControl(bindingModel);
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:10,代码来源:LabeledEnumComboBoxBinding.java

示例3: setItem

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
/**
 * @see javax.swing.ComboBoxEditor#setItem(java.lang.Object)
 */
public void setItem(Object anObject) {
	current = anObject;
	if (anObject != null) {
		if (messages != null && anObject instanceof MessageSourceResolvable) {
			inner.setItem(messages.getMessage((MessageSourceResolvable)anObject, Locale.getDefault()));
		}
		else {
			inner.setItem(((LabeledEnum)anObject).getLabel());
		}
	}
	else {
		inner.setItem(null);
	}
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:18,代码来源:LabeledEnumComboBoxEditor.java

示例4: getListCellRendererComponent

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
	if (value == null) {
		return this;
	}
	if (messages != null && value instanceof MessageSourceResolvable) {
		setText(messages.getMessage((MessageSourceResolvable)value, Locale.getDefault()));
	}
	else {
		setText(((LabeledEnum)value).getLabel());
	}
	return this;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:15,代码来源:LabeledEnumListRenderer.java

示例5: configureForEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public void configureForEnum(JComboBox comboBox, Class enumType) {
	Collection enumValues = getEnumResolver().getLabeledEnumSet(enumType);
	if (logger.isDebugEnabled()) {
		logger.debug("Populating combo box model with enums of type '" + enumType.getName() + "'; enums are ["
				+ enumValues + "]");
	}
	CompoundComparator comparator = new CompoundComparator();
	comparator.addComparator(LabeledEnum.LABEL_ORDER);
	comparator.addComparator(new ComparableComparator());
	comboBox.setModel(new ComboBoxListModel(new ArrayList(enumValues), comparator));
	comboBox.setRenderer(new LabeledEnumListRenderer(messageSource));
	comboBox.setEditor(new LabeledEnumComboBoxEditor(messageSource, comboBox.getEditor()));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:14,代码来源:DefaultComponentFactory.java

示例6: getTableCellRendererComponent

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    if (value != null) {
        if (messages != null && value instanceof MessageSourceResolvable) {
            value = messages.getMessage((MessageSourceResolvable) value, Locale.getDefault());
        } else {
            value = ((LabeledEnum) value).getLabel();
        }
    }
    return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:12,代码来源:LabeledEnumTableCellRenderer.java

示例7: setLabeledEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public void setLabeledEnum( String key, LabeledEnum value ) {
    Assert.notNull( key, "Key cannot be null" );

    LabeledEnum old = getLabeledEnum( key );
    internalSet( key, enumToString( value ) );
    afterSet( key, old, value );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:8,代码来源:AbstractSettings.java

示例8: getLabeledEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public LabeledEnum getLabeledEnum( String key ) {
    Assert.notNull( key, "Key cannot be null" );

    String value = internalGet( key );
    if( !StringUtils.hasText( value ) ) {
        return getDefaultLabeledEnum( key );
    }
    return stringToEnum( value );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:10,代码来源:AbstractSettings.java

示例9: testEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public final void testEnum() {
    String key = "enum-value";
    LabeledEnum defaultValue = null;
    LabeledEnum newValue = TestEnum.ENUM2;

    // default value
    assertEquals( defaultValue, settings.getLabeledEnum( key ) );
    assertEquals( defaultValue, settings.getDefaultLabeledEnum( key ) );
    assertTrue( settings.isDefault( key ) );
    assertFalse( settings.contains( key ) );

    // change the value
    settings.setLabeledEnum( key, newValue );

    assertEquals( newValue, settings.getLabeledEnum( key ) );
    assertFalse( settings.isDefault( key ) );
    assertTrue( settings.contains( key ) );

    // check property change event
    assertPropertyChangeEventFired( key, defaultValue, newValue );
    propertyChangeListener.reset();

    // change the value to the same value, no property change event should
    // be fired
    settings.setLabeledEnum( key, newValue );
    assertEquals( 0, propertyChangeListener.getCount() );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:28,代码来源:SettingsAbstractTests.java

示例10: isEnumeration

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
protected boolean isEnumeration(FormModel formModel, String formPropertyPath) {
    return LabeledEnum.class.isAssignableFrom(getPropertyType(formModel, formPropertyPath));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:AbstractBinderSelectionStrategy.java

示例11: stringToEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
private LabeledEnum stringToEnum( String s ) {
    if( s == null || s.trim().equals( "" ) ) {
        return null;
    }
    return (LabeledEnum) ClassUtils.getFieldValue( s );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:7,代码来源:AbstractSettings.java

示例12: enumToString

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
private String enumToString( LabeledEnum e ) {
    return e == null ? "" : ClassUtils.getClassFieldNameWithValue( e.getClass(), e );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:AbstractSettings.java

示例13: setDefaultLabeledEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public void setDefaultLabeledEnum( String key, LabeledEnum value ) {
    Assert.notNull( key, "Key cannot be null" );

    defaults.put( key, enumToString( value ) );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:6,代码来源:AbstractSettings.java

示例14: getDefaultLabeledEnum

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
public LabeledEnum getDefaultLabeledEnum( String key ) {
    Assert.notNull( key, "Key cannot be null" );
    return stringToEnum( (String) defaults.get( key ) );
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:5,代码来源:AbstractSettings.java

示例15: isSimpleScalar

import org.springframework.core.enums.LabeledEnum; //导入依赖的package包/类
/**
 * Does the provided bean class represent a simple scalar property? A simple
 * scalar property is considered a value property; that is, it is not
 * another bean. Examples include primitives, primitive wrappers, Enums, and
 * Strings.
 */
public static boolean isSimpleScalar(Class clazz) {
	return clazz.isPrimitive() || simpleClasses.contains(clazz) || LabeledEnum.class.isAssignableFrom(clazz);
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:10,代码来源:ClassUtils.java


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