• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LookupField类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: init

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Override
public void init(Map<String, Object> params) {
    // Datasource initialization. It is usually done automatically if the screen is
    // inherited from AbstractEditor and is used as an entity editor.
    Customer customer = metadata.create(Customer.class);
    customer.setName("John");
    customer.setLastName("Doe");
    customerDs.setItem(customer);

    customerFields.addCustomField("active", (datasource, propertyId) -> {
        LookupField lookupField = componentsFactory.createComponent(LookupField.class);
        lookupField.setDatasource(datasource, propertyId);

        Map<String, Object> options = new LinkedHashMap<>();
        options.put("Yes", Boolean.TRUE);
        options.put("No", Boolean.FALSE);
        lookupField.setOptionsMap(options);

        lookupField.setWidth("100%");
        return lookupField;
    });
}
 
开发者ID:cuba-platform,项目名称:sampler,代码行数:23,代码来源:GenerateFieldGroupFrame.java


示例2: setUpMaxResultsLookupField

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
public LookupField setUpMaxResultsLookupField(LookupField maxResultsLookupField) {
    ThemeConstants theme = themeConstantsManager.getConstants();

    maxResultsLookupField.setWidth(theme.get("cuba.gui.Filter.maxResults.lookup.width"));
    filterHelper.setLookupTextInputAllowed(maxResultsLookupField, false);
    filterHelper.setLookupNullSelectionAllowed(maxResultsLookupField, false);

    List<Integer> maxResultOptions = new ArrayList<>();
    String maxResultOptionsStr = clientConfig.getGenericFilterMaxResultsOptions();
    Iterable<String> split = Splitter.on(",").trimResults().split(maxResultOptionsStr);
    for (String option : split) {
        if ("NULL".equals(option)) {
            filterHelper.setLookupNullSelectionAllowed(maxResultsLookupField, true);
        } else {
            try {
                Integer value = Integer.valueOf(option);
                maxResultOptions.add(value);
            } catch (NumberFormatException ignored) {
            }
        }
    }
    maxResultsLookupField.setOptionsList(maxResultOptions);

    return maxResultsLookupField;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:MaxResultsFieldHelper.java


示例3: testUnsubscribeComponentListener

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testUnsubscribeComponentListener() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);

    Datasource<User> userDs = getTestUserDatasource();
    Group group = groupsDs.getItems().iterator().next();
    User user = userDs.getItem();
    user.setGroup(group);
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setDatasource(null, null);

    Component.ValueChangeListener listener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    lookupField.addValueChangeListener(listener);

    user.setGroup(metadata.create(Group.class));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:24,代码来源:LookupFieldDsTest.java


示例4: testUnsubscribeDsListener

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testUnsubscribeDsListener() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);

    Datasource<User> userDs = getTestUserDatasource();
    Group group = groupsDs.getItems().iterator().next();
    userDs.getItem().setGroup(group);
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setDatasource(null, null);

    Datasource.ItemPropertyChangeListener<User> propertyChangeListener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    userDs.addItemPropertyChangeListener(propertyChangeListener);

    lookupField.setValue(metadata.create(Group.class));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:23,代码来源:LookupFieldDsTest.java


示例5: testOptionsDsUnsubscribe

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testOptionsDsUnsubscribe() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    userDs.getItem().setGroup(groups.get(0));
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setOptionsDatasource(null);

    Datasource.ItemChangeListener<Group> itemChangeListener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    groupsDs.addItemChangeListener(itemChangeListener);
    lookupField.setValue(groups.get(1));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:22,代码来源:LookupFieldDsTest.java


示例6: testValueChangeListener

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testValueChangeListener() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    User user = userDs.getItem();
    user.setGroup(groups.get(0));

    boolean[] valueWasChanged = {false};
    Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
    lookupField.addValueChangeListener(listener);

    lookupField.setDatasource(userDs, "group");
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:20,代码来源:LookupFieldDsTest.java


示例7: testUnsubscribeSubscribeDsListener

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testUnsubscribeSubscribeDsListener() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);

    Datasource<User> userDs = getTestUserDatasource();
    Group group = groupsDs.getItems().iterator().next();
    userDs.getItem().setGroup(group);
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setDatasource(null, null);

    // setup
    boolean[] valueWasChanged = {false};
    Datasource.ItemPropertyChangeListener<User> listener = e -> valueWasChanged[0] = true;
    userDs.addItemPropertyChangeListener(listener);

    lookupField.setDatasource(userDs, "group");
    lookupField.setValue(null);
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:LookupFieldDsTest.java


示例8: init

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Override
public void init(Map<String, Object> params) {
    customerTable.addGeneratedColumn("language", entity -> {
        LookupField lookupField = componentsFactory.createComponent(LookupField.class);
        List<String> locales = new ArrayList<>(globalConfig.getAvailableLocales().keySet());
        lookupField.setOptionsList(locales);
        lookupField.setWidth("100%");
        return lookupField;
    });

    customerTable.setColumnCaption("fullName", "Full Name");
    customerTable.setColumnCaption("language", "Language");
}
 
开发者ID:cuba-platform,项目名称:sampler,代码行数:14,代码来源:GenerateTableFrame.java


示例9: loadOptionsEnum

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected void loadOptionsEnum(LookupField resultComponent, Element element) {
    String optionsEnumClass = element.attributeValue("optionsEnum");
    if (StringUtils.isNotEmpty(optionsEnumClass)) {
        Scripting scripting = AppBeans.get(Scripting.class);
        resultComponent.setOptionsEnum(
                (Class<? extends EnumClass>) scripting.loadClass(optionsEnumClass));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:10,代码来源:LookupFieldLoader.java


示例10: loadDatasource

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Override
protected void loadDatasource(DatasourceComponent component, Element element) {
    super.loadDatasource(component, element);

    String datasource = element.attributeValue("optionsDatasource");
    if (!StringUtils.isEmpty(datasource)) {
        Datasource ds = context.getDsContext().get(datasource);
        ((LookupField) component).setOptionsDatasource((CollectionDatasource) ds);
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:LookupFieldLoader.java


示例11: testSetValueWithoutOptions

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testSetValueWithoutOptions() {
    LookupField lookupField = (LookupField) factory.createComponent(LookupField.NAME);

    // noinspection unchecked
    Datasource<User> userDs = getTestUserDatasource();

    User user = userDs.getItem();
    user.setName("Test name");

    lookupField.setDatasource(userDs, "name");
    assertEquals("Test name", lookupField.getValue());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:14,代码来源:LookupFieldDsTest.java


示例12: testUnsubscribeSubscribeComponentListener

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testUnsubscribeSubscribeComponentListener() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);

    Datasource<User> userDs = getTestUserDatasource();
    Group group = groupsDs.getItems().iterator().next();
    User user = userDs.getItem();
    user.setGroup(group);
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setDatasource(null, null);

    // setup
    boolean[] valueWasChanged = {false};
    Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;

    // datasource before listener
    lookupField.setDatasource(userDs, "group");
    lookupField.addValueChangeListener(listener);

    user.setGroup(metadata.create(Group.class));
    assertEquals(true, valueWasChanged[0]);

    // reset state

    valueWasChanged[0] = false;
    lookupField.setDatasource(null, null);
    lookupField.removeValueChangeListener(listener);
    lookupField.setValue(null);

    // listener before datasource

    lookupField.addValueChangeListener(listener);
    lookupField.setDatasource(userDs, "group");
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:41,代码来源:LookupFieldDsTest.java


示例13: testUnsubscribeSubscribeOptions

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Test
public void testUnsubscribeSubscribeOptions() {
    LookupField lookupField = factory.createComponent(LookupField.class);

    CollectionDatasource<Group, UUID> groupsDs = getTestCollectionDatasource();
    lookupField.setOptionsDatasource(groupsDs);
    List<Group> groups = new ArrayList<>(groupsDs.getItems());

    Datasource<User> userDs = getTestUserDatasource();
    userDs.getItem().setGroup(groups.get(0));
    lookupField.setDatasource(userDs, "group");

    // unbind
    lookupField.setOptionsDatasource(null);

    Datasource.ItemChangeListener<Group> listener = e -> {
        throw new RuntimeException("Value was changed externally");
    };
    groupsDs.addItemChangeListener(listener);
    lookupField.setValue(groups.get(1));

    // setup
    groupsDs.removeItemChangeListener(listener);
    boolean[] valueWasChanged = {false};
    listener = e -> valueWasChanged[0] = true;
    groupsDs.addItemChangeListener(listener);
    lookupField.setOptionsDatasource(groupsDs);

    lookupField.setValue(groups.get(2));
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:32,代码来源:LookupFieldDsTest.java


示例14: allowNullSelection

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Deprecated
public static void allowNullSelection(LookupField lookupField) {
    ComboBox vCombobox = (ComboBox) WebComponentsHelper.unwrap(lookupField);
    vCombobox.setNullSelectionAllowed(true);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:WebComponentsUtils.java


示例15: disallowNullSelection

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Deprecated
public static void disallowNullSelection(LookupField lookupField) {
    ComboBox vCombobox = (ComboBox) WebComponentsHelper.unwrap(lookupField);
    vCombobox.setNullSelectionAllowed(false);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:WebComponentsUtils.java


示例16: createComponent

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
@Override
public void createComponent() {
    resultComponent = (LookupField) factory.createComponent(LookupField.NAME);
    loadId(resultComponent, element);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:LookupFieldLoader.java


示例17: loadNullOptionVisible

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
protected void loadNullOptionVisible(LookupField resultComponent, Element element) {
    String nullOptionVisible = element.attributeValue("nullOptionVisible");
    if (StringUtils.isNotEmpty(nullOptionVisible)) {
        resultComponent.setNullOptionVisible(Boolean.parseBoolean(nullOptionVisible));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:LookupFieldLoader.java


示例18: loadFilterMode

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
protected void loadFilterMode(LookupField component, Element element) {
    String filterMode = element.attributeValue("filterMode");
    if (!StringUtils.isEmpty(filterMode)) {
        component.setFilterMode(LookupField.FilterMode.valueOf(filterMode));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:LookupFieldLoader.java


示例19: loadFilterMode

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
protected void loadFilterMode(TokenList component, Element element) {
    final String filterMode = element.attributeValue("filterMode");
    if (!StringUtils.isEmpty(filterMode)) {
        component.setFilterMode(LookupField.FilterMode.valueOf(filterMode));
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:TokenListLoader.java


示例20: createMaxResultsLookupField

import com.haulmont.cuba.gui.components.LookupField; //导入依赖的package包/类
public LookupField createMaxResultsLookupField() {
    LookupField maxResultsLookupField = componentsFactory.createComponent(LookupField.class);
    setUpMaxResultsLookupField(maxResultsLookupField);

    return maxResultsLookupField;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:MaxResultsFieldHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NodeResourceMapProto类代码示例发布时间:2022-05-22
下一篇:
Java IPv6Serializer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap