use of com.extjs.gxt.ui.client.store.Record in project activityinfo by bedatadriven.
the class DbEditor method unsavedChanges.
private BatchCommand unsavedChanges() {
BatchCommand batch = new BatchCommand();
for (Record record : treeStore.getModifiedRecords()) {
EntityDTO entity = (EntityDTO) record.getModel();
Map<String, Object> changes = new HashMap<>();
for (String property : record.getChanges().keySet()) {
changes.put(property, entity.get(property));
}
batch.add(new UpdateEntity(entity.getEntityName(), entity.getId(), changes));
}
return batch;
}
use of com.extjs.gxt.ui.client.store.Record in project activityinfo by bedatadriven.
the class DbEditor method onNodeDropped.
private void onNodeDropped(List<TreeStoreModel> data) {
if (data.isEmpty()) {
return;
}
// update sortOrder and folder membership
ModelData source = data.get(0).getModel();
ModelData parent = treeStore.getParent(source);
LOGGER.info("source = " + source);
List<ModelData> children = parent == null ? treeStore.getRootItems() : treeStore.getChildren(parent);
for (int i = 0; i != children.size(); ++i) {
Record record = treeStore.getRecord(children.get(i));
record.set("sortOrder", i);
}
if (source instanceof ActivityDTO) {
Record record = treeStore.getRecord(source);
if (parent instanceof FolderDTO) {
record.set("folderId", ((FolderDTO) parent).getId());
} else {
record.set("folderId", null);
}
}
}
use of com.extjs.gxt.ui.client.store.Record in project activityinfo by bedatadriven.
the class OnlyValidFieldBinding method updateModel.
@Override
public void updateModel() {
if (field.isValid()) {
if (field instanceof RadioGroup) {
// special handing for radio group
RadioGroup radioGroup = (RadioGroup) field;
// hack : boolean represented with radio buttons : order is important - true is first button, false is second button
if ("classicView".equals(property)) {
Field nestedField = radioGroup.getValue();
int selectedIndex = radioGroup.getAll().indexOf(nestedField);
boolean val = selectedIndex == 0;
if (store != null) {
Record r = store.getRecord(model);
if (r != null) {
r.setValid(property, field.isValid());
r.set(property, val);
}
} else {
model.set(property, val);
}
return;
}
}
super.updateModel();
}
}
Aggregations