本文整理匯總了Java中com.haulmont.cuba.gui.components.CheckBox類的典型用法代碼示例。如果您正苦於以下問題:Java CheckBox類的具體用法?Java CheckBox怎麽用?Java CheckBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CheckBox類屬於com.haulmont.cuba.gui.components包,在下文中一共展示了CheckBox類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testUnsubscribeComponentListener
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Test
public void testUnsubscribeComponentListener() {
CheckBox checkBox = (CheckBox) factory.createComponent(CheckBox.NAME);
Datasource<User> userDs = getTestUserDatasource();
User user = userDs.getItem();
user.setActive(true);
checkBox.setDatasource(userDs, "active");
// unbind
checkBox.setDatasource(null, null);
Component.ValueChangeListener valueChangeListener = e -> {
throw new RuntimeException("Value was changed externally");
};
checkBox.addValueChangeListener(valueChangeListener);
user.setActive(false);
assertEquals(true, checkBox.getValue());
}
示例2: testUnsubscribeDsListener
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Test
public void testUnsubscribeDsListener() {
CheckBox checkBox = (CheckBox) factory.createComponent(CheckBox.NAME);
Datasource<User> userDs = getTestUserDatasource();
User user = userDs.getItem();
user.setActive(true);
checkBox.setDatasource(userDs, "active");
// unbind
checkBox.setDatasource(null, null);
Datasource.ItemPropertyChangeListener<User> propertyChangeListener = e -> {
throw new RuntimeException("Value was changed externally");
};
userDs.addItemPropertyChangeListener(propertyChangeListener);
checkBox.setValue(false);
assertEquals(true, user.getActive());
}
示例3: testUnsubscribeSubscribeDsListener
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeDsListener() {
CheckBox checkBox = (CheckBox) factory.createComponent(CheckBox.NAME);
Datasource<User> userDs = getTestUserDatasource();
User user = userDs.getItem();
user.setActive(true);
checkBox.setDatasource(userDs, "active");
// unbind
checkBox.setDatasource(null, null);
// setup
boolean[] valueWasChanged = {false};
Datasource.ItemPropertyChangeListener<User> listener = e -> valueWasChanged[0] = true;
userDs.addItemPropertyChangeListener(listener);
checkBox.setDatasource(userDs, "active");
checkBox.setValue(false);
assertEquals(true, valueWasChanged[0]);
assertEquals(false, user.getActive());
}
示例4: EntityNameFilter
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
public EntityNameFilter(Metadata metadata, CheckBox assignedOnlyCheckBox, CheckBox systemLevelCheckBox,
TextField entityFilter) {
this.metadata = metadata;
this.assignedOnlyCheckBox = assignedOnlyCheckBox;
this.systemLevelCheckBox = systemLevelCheckBox;
this.entityFilter = entityFilter;
}
示例5: testUnsubscribeSubscribeComponentListener
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Test
public void testUnsubscribeSubscribeComponentListener() {
CheckBox checkBox = (CheckBox) factory.createComponent(CheckBox.NAME);
Datasource<User> userDs = getTestUserDatasource();
User user = userDs.getItem();
user.setActive(true);
checkBox.setDatasource(userDs, "active");
// unbind
checkBox.setDatasource(null, null);
// datasource before listener
checkBox.setDatasource(userDs, "active");
assertEquals(true, checkBox.getValue());
boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
checkBox.addValueChangeListener(listener);
user.setActive(false);
assertEquals(true, valueWasChanged[0]);
assertEquals(false, checkBox.getValue());
// reset state
checkBox.removeValueChangeListener(listener);
checkBox.setDatasource(null, null);
valueWasChanged[0] = false;
checkBox.setValue(true);
// listener before datasource
checkBox.addValueChangeListener(listener);
checkBox.setDatasource(userDs, "active");
assertEquals(true, valueWasChanged[0]);
assertEquals(false, checkBox.getValue());
}
示例6: testValueChangeListener
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Test
public void testValueChangeListener() {
CheckBox checkBox = (CheckBox) factory.createComponent(CheckBox.NAME);
Datasource<User> userDs = getTestUserDatasource();
User user = userDs.getItem();
user.setActive(true);
// listener before datasource
Boolean[] valueWasChanged = {false};
Component.ValueChangeListener listener = e -> valueWasChanged[0] = true;
checkBox.addValueChangeListener(listener);
checkBox.setDatasource(userDs, "active");
assertEquals(true, valueWasChanged[0]);
// reset state
checkBox.setDatasource(null, null);
checkBox.removeValueChangeListener(listener);
valueWasChanged[0] = false;
// datasource before listener
checkBox.setDatasource(userDs, "active");
checkBox.addValueChangeListener(listener);
user.setActive(false);
assertEquals(true, valueWasChanged[0]);
}
示例7: createField
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Override
public com.vaadin.ui.Field<?> createField(com.vaadin.data.Container container,
Object itemId, Object propertyId, Component uiContext) {
String fieldPropertyId = String.valueOf(propertyId);
Column columnConf = webTable.columns.get(propertyId);
Item item = container.getItem(itemId);
Entity entity = ((ItemWrapper) item).getItem();
Datasource fieldDatasource = webTable.getItemDatasource(entity);
com.haulmont.cuba.gui.components.Component columnComponent =
createField(fieldDatasource, fieldPropertyId, columnConf.getXmlDescriptor());
if (columnComponent instanceof Field) {
Field cubaField = (Field) columnComponent;
if (webTable.requiredColumns != null && webTable.requiredColumns.containsKey(columnConf)) {
cubaField.setRequired(true);
cubaField.setRequiredMessage(webTable.requiredColumns.get(columnConf));
}
}
if (!(columnComponent instanceof CheckBox)) {
columnComponent.setWidthFull();
}
if (columnComponent instanceof BelongToFrame) {
BelongToFrame belongToFrame = (BelongToFrame) columnComponent;
if (belongToFrame.getFrame() == null) {
belongToFrame.setFrame(webTable.getFrame());
}
}
applyPermissions(columnComponent);
columnComponent.setParent(webTable);
Component componentImpl = getComponentImplementation(columnComponent);
if (componentImpl instanceof com.vaadin.ui.Field) {
return (com.vaadin.ui.Field<?>) componentImpl;
}
return new EditableColumnFieldWrapper(componentImpl, columnComponent);
}
示例8: createComponent
import com.haulmont.cuba.gui.components.CheckBox; //導入依賴的package包/類
@Override
public void createComponent() {
resultComponent = (CheckBox) factory.createComponent(CheckBox.NAME);
loadId(resultComponent, element);
}