本文整理汇总了Java中com.smartgwt.client.util.BooleanCallback类的典型用法代码示例。如果您正苦于以下问题:Java BooleanCallback类的具体用法?Java BooleanCallback怎么用?Java BooleanCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BooleanCallback类属于com.smartgwt.client.util包,在下文中一共展示了BooleanCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLogoutButton
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
public ToolStripButton getLogoutButton(String login, final Controller controller) {
ToolStripButton logoutButton = getSimpleToolStripButton(Images.instance.logout_30(), "Logout" + login);
logoutButton.setIconOrientation("right");
logoutButton.setTooltip("Logout");
logoutButton.setBorder(GREY_BUTTON_BORDER);
logoutButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
SC.confirm("Logout", "Are you sure you want to exit?", new BooleanCallback() {
public void execute(Boolean value) {
if (value) {
controller.logout();
}
}
});
}
});
return logoutButton;
}
示例2: saveImpl
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void saveImpl(final BooleanCallback callback) {
Record update = new Record(valuesManager.getValues());
update = ClientUtils.normalizeData(update);
updatingDevice = true;
DeviceDataSource.getInstance().updateData(update, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
updatingDevice = false;
boolean status = RestConfig.isStatusOk(response);
if (status) {
StatusView.getInstance().show(i18n.SaveAction_Done_Msg());
Record[] data = response.getData();
if (data != null && data.length == 1) {
Record deviceRecord = data[0];
setDescription(deviceRecord);
}
}
callback.execute(status);
}
});
}
示例3: saveImpl
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void saveImpl(final BooleanCallback callback, String newXml) {
ModsCustomDataSource.getInstance().saveXmlDescription(digitalObject, newXml, timestamp, new DescriptionSaveHandler() {
@Override
protected void onSave(DescriptionMetadata dm) {
super.onSave(dm);
refresh(false);
callback.execute(Boolean.TRUE);
}
@Override
protected void onError() {
super.onError();
callback.execute(Boolean.FALSE);
}
@Override
protected void onValidationError() {
// Do not ignore XML validation!
SC.warn(i18n.SaveAction_Title(), getValidationMessage());
callback.execute(Boolean.FALSE);
}
});
}
示例4: saveCatalogData
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void saveCatalogData(final BooleanCallback callback) {
String mods = catalogBrowser.getMods();
ModsCustomDataSource.getInstance().saveXmlDescription(digitalObjects[0], mods, new DescriptionSaveHandler() {
@Override
protected void onSave(DescriptionMetadata dm) {
super.onSave(dm);
callback.execute(Boolean.TRUE);
}
@Override
protected void onError() {
super.onError();
callback.execute(Boolean.FALSE);
}
});
}
示例5: ingest
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void ingest(String batchId, String parentId, final BooleanCallback call) {
ImportBatchDataSource dsBatch = ImportBatchDataSource.getInstance();
DSRequest dsRequest = new DSRequest();
dsRequest.setPromptStyle(PromptStyle.DIALOG);
dsRequest.setPrompt(i18n.ImportWizard_UpdateItemsStep_Ingesting_Title());
Record update = new Record();
update.setAttribute(ImportBatchDataSource.FIELD_ID, batchId);
update.setAttribute(ImportBatchDataSource.FIELD_PARENT, parentId);
update.setAttribute(ImportBatchDataSource.FIELD_STATE, ImportBatchDataSource.State.INGESTING.name());
dsBatch.updateData(update, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (RestConfig.isStatusOk(response)) {
Record[] records = response.getData();
if (records != null && records.length > 0) {
importContext.setBatch(new BatchRecord(records[0]));
call.execute(true);
return;
}
}
call.execute(false);
}
}, dsRequest);
}
示例6: addChild
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
public void addChild(String parentPid, String[] pid, final BooleanCallback call) {
if (pid == null || pid.length < 1) {
throw new IllegalArgumentException("Missing PID!");
}
if (parentPid == null || parentPid.isEmpty()) {
throw new IllegalArgumentException("Missing parent PID!");
}
DSRequest dsRequest = new DSRequest();
Record update = new Record();
update.setAttribute(RelationDataSource.FIELD_PARENT, parentPid);
update.setAttribute(RelationDataSource.FIELD_PID, pid);
addData(update, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (!RestConfig.isStatusOk(response)) {
call.execute(false);
return;
}
call.execute(true);
}
}, dsRequest);
}
示例7: removeChild
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
public void removeChild(String parentPid, String[] pid, final BooleanCallback call) {
if (pid == null || pid.length < 1) {
throw new IllegalArgumentException("Missing PID!");
}
if (parentPid == null || parentPid.isEmpty()) {
throw new IllegalArgumentException("Missing parent PID!");
}
Record update = new Record();
update.setAttribute(RelationDataSource.FIELD_PARENT, parentPid);
update.setAttribute(RelationDataSource.FIELD_PID, pid);
DSRequest dsRequest = new DSRequest();
dsRequest.setData(update); // prevents removeData to drop other than primary key attributes
removeData(update, new DSCallback() {
@Override
public void execute(DSResponse response, Object rawData, DSRequest request) {
if (!RestConfig.isStatusOk(response)) {
call.execute(false);
return;
}
call.execute(true);
}
}, dsRequest);
}
示例8: initOnStart
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
public void initOnStart(final BooleanCallback callback) {
if (cache == null) {
cache = new ResultSet(this);
cache.addDataArrivedHandler(new DataArrivedHandler() {
@Override
public void onDataArrived(DataArrivedEvent event) {
if (cache.allRowsCached()) {
callback.execute(Boolean.TRUE);
}
}
});
cache.get(0);
} else {
cache.invalidateCache();
cache.get(0);
}
}
示例9: saveTask
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
/**
* Saves savable object.
*
<pre><code>
ask strategy states
T ASK validate, (IfValidAsk, IfYesSave | IfNoDone) | (IfInvalidAsk, IfReallyYesSave | IfNoDone)
T IGNORE ask, (IfYesSave | IfNoDone)
T RUN validate, (IfValidAsk, IfYesSave | IfNoDone) | IfInvalidDone
F ASK validate, IfValidSave | (IfInvalidAsk, IfYesSave | IfNoDone)
F IGNORE save
F RUN validate, IfValidSave | IfInvalidDone
</code></pre>
*
* @param savable object implementing save
* @param saveCallback listener to get save result
* @param ask ask user before the save
* @param strategy validation strategy
*/
public static void saveTask(Savable savable, BooleanCallback saveCallback,
boolean ask, SaveValidation strategy, ClientMessages i18n) {
BooleanCallback saveIfYes = new SaveIfYes(savable, saveCallback);
BooleanCallback runIfValid = getRunIfValid(savable, saveCallback, ask,
saveIfYes, strategy, i18n);
if (strategy == SaveValidation.IGNORE) {
if (ask) {
askSave(saveIfYes, i18n);
} else {
savable.save(saveCallback);
}
} else {
savable.validate(runIfValid);
}
}
示例10: getRunIfValid
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private static BooleanCallback getRunIfValid(
final Savable savable, final BooleanCallback saveCallback,
final boolean ask, final BooleanCallback saveIfYes,
final SaveValidation strategy, final ClientMessages i18n) {
final BooleanCallback runOnValid = new BooleanCallback() {
@Override
public void execute(Boolean valid) {
if (valid != null && valid) {
if (ask) {
askSave(saveIfYes, i18n);
} else {
savable.save(saveCallback);
}
} else if (strategy == SaveValidation.ASK) {
askIgnoreValidation(saveIfYes, i18n);
} else {
saveCallback.execute(Boolean.FALSE);
}
}
};
return runOnValid;
}
示例11: validateMods
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void validateMods() {
progress.setProgress(index, length);
final Record record = digitalObjects[index];
DigitalObject dobj = DigitalObject.create(record);
validator.setShowFetchPrompt(false);
validator.edit(dobj, new BooleanCallback() {
@Override
public void execute(Boolean value) {
if (value != null && value) {
consumeValidation(record, validator.isValidDigitalObject());
} else {
// unknown validity
}
++index;
// Scheduler is not necessary as fetch operations
// run asynchronously
ValidateTask.this.execute();
}
});
}
示例12: askForRegisterOptions
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void askForRegisterOptions(String[] pids) {
if (pids == null || pids.length == 0) {
return ;
}
final Record register = new Record();
register.setAttribute(DigitalObjectResourceApi.DIGITALOBJECT_PID, pids);
SC.ask(i18n.UrnNbnAction_Window_Title(), i18n.UrnNbnAction_Window_Msg(),
new BooleanCallback() {
@Override
public void execute(Boolean value) {
if (value == Boolean.TRUE) {
register(register);
}
}
});
}
示例13: resetImportFolder
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void resetImportFolder(final BatchRecord batch) {
ImportBatchDataSource.State state = batch.getState();
final BooleanCallback callback = new BooleanCallback() {
@Override
public void execute(Boolean value) {
if (value != null && value) {
handler.itemReset();
}
}
};
if (state == ImportBatchDataSource.State.INGESTING_FAILED) {
callback.execute(true);
} else {
askForBatchReload(callback, batch);
}
}
示例14: save
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
private void save() {
if (originChildren == null) {
return ;
}
Record[] rs = childrenListGrid.getOriginalResultSet().toArray();
String[] childPids = ClientUtils.toFieldValues(rs, RelationDataSource.FIELD_PID);
relationDataSource.reorderChildren(digitalObject, childPids, new BooleanCallback() {
@Override
public void execute(Boolean value) {
if (value != null && value) {
originChildren = null;
updateReorderUi(false);
StatusView.getInstance().show(i18n.SaveAction_Done_Msg());
}
}
});
}
示例15: save
import com.smartgwt.client.util.BooleanCallback; //导入依赖的package包/类
public void save() {
if (originChildren == null) {
return ;
}
Record[] rs = getRecords();
if (RelationDataSource.equals(originChildren, rs)) {
updateWidgetsOnSave(sourceWidget);
return ;
}
String[] childPids = ClientUtils.toFieldValues(rs, RelationDataSource.FIELD_PID);
RelationDataSource relationDataSource = RelationDataSource.getInstance();
DigitalObject root = DigitalObject.create(batchRecord);
relationDataSource.reorderChildren(root, childPids, new BooleanCallback() {
@Override
public void execute(Boolean value) {
if (value != null && value) {
updateWidgetsOnSave(sourceWidget);
StatusView.getInstance().show(i18n.SaveAction_Done_Msg());
} else {
updateWidgetsOnSave(null);
}
}
});
}