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


Java OptionsGroup类代码示例

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


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

示例1: loadOrientation

import com.haulmont.cuba.gui.components.OptionsGroup; //导入依赖的package包/类
protected void loadOrientation(OptionsGroup component, Element element) {
    String orientation = element.attributeValue("orientation");

    if (orientation == null) {
        return;
    }

    if ("horizontal".equalsIgnoreCase(orientation)) {
        component.setOrientation(OptionsGroup.Orientation.HORIZONTAL);
    } else if ("vertical".equalsIgnoreCase(orientation)) {
        component.setOrientation(OptionsGroup.Orientation.VERTICAL);
    } else {
        throw new GuiDevelopmentException("Invalid orientation value for option group: " +
                orientation, context.getFullFrameId(), "OptionsGroup ID", component.getId());
    }
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:17,代码来源:OptionsGroupLoader.java

示例2: testUnsubscribeComponentListener

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    optionsGroup.setDatasource(roleDs, "type");
    optionsGroup.setValue(RoleType.STANDARD);

    optionsGroup.setDatasource(null, null);

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

    roleDs.getItem().setType(RoleType.DENYING);
    assertEquals(RoleType.STANDARD, optionsGroup.getValue());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:OptionsGroupDsTest.java

示例3: testUnsubscribeDsListener

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    optionsGroup.setDatasource(roleDs, "type");
    optionsGroup.setValue(RoleType.STANDARD);

    optionsGroup.setDatasource(null, null);

    Datasource.ItemPropertyChangeListener<Role> listener = e -> {
        throw new RuntimeException("");
    };
    roleDs.addItemPropertyChangeListener(listener);

    optionsGroup.setValue(RoleType.DENYING);
    assertEquals(RoleType.STANDARD, roleDs.getItem().getType());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:OptionsGroupDsTest.java

示例4: testUnsubscribeSubscribeDsListener

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    roleDs.getItem().setType(RoleType.DENYING);
    optionsGroup.setDatasource(roleDs, "type");

    optionsGroup.setDatasource(null, null);

    boolean[] valueWasChanged = {false};
    Datasource.ItemPropertyChangeListener<Role> listener = e -> valueWasChanged[0] = true;
    roleDs.addItemPropertyChangeListener(listener);
    optionsGroup.setDatasource(roleDs, "type");

    optionsGroup.setValue(RoleType.STANDARD);
    assertTrue(valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:OptionsGroupDsTest.java

示例5: testUnsubscribeSubscribeComponentListener

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    roleDs.getItem().setType(RoleType.DENYING);
    optionsGroup.setDatasource(roleDs, "type");

    optionsGroup.setDatasource(null, null);

    // datasource before listener
    optionsGroup.setDatasource(roleDs, "type");

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

    roleDs.getItem().setType(RoleType.READONLY);
    assertEquals(true, valueWasChanged[0]);

    // reset state
    valueWasChanged[0] = false;
    optionsGroup.removeValueChangeListener(listener);
    optionsGroup.setDatasource(null, null);
    optionsGroup.setValue(null);

    // listener before datasource
    optionsGroup.addValueChangeListener(listener);
    optionsGroup.setDatasource(roleDs, "type");
    assertEquals(true, valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:32,代码来源:OptionsGroupDsTest.java

示例6: testValueChangeListener

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

    // listener before datasource

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    roleDs.getItem().setType(RoleType.READONLY);

    optionsGroup.setDatasource(roleDs, "type");
    assertTrue(valueWasChanged[0]);

    // reset state
    valueWasChanged[0] = false;
    optionsGroup.removeValueChangeListener(listener);
    optionsGroup.setDatasource(null, null);

    // datasource before listener
    optionsGroup.setDatasource(roleDs, "type");
    optionsGroup.addValueChangeListener(listener);
    roleDs.getItem().setType(RoleType.DENYING);
    assertTrue(valueWasChanged[0]);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:28,代码来源:OptionsGroupDsTest.java

示例7: testSetValue

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

    Datasource<Role> roleDs = getTestRoleDatasource();
    optionsGroup.setDatasource(roleDs, "type");

    optionsGroup.setValue(RoleType.DENYING);
    assertNotNull(optionsGroup.getValue());
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:OptionsGroupDsTest.java

示例8: createComponent

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


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