use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.
the class ApplicationsViewModel method update.
@Command
@NotifyChange("applications")
public void update() {
logger.debug("Updating Applications ViewModel...");
// Erase all current applications
applications.clear();
setSelectedApp("");
// Import new resources
String appsLocation = ((UserCredential) Sessions.getCurrent().getAttribute("userCredential")).getCOMPSs_BASE_LOG();
File COMPSs_LOG_DIR = new File(appsLocation);
if (COMPSs_LOG_DIR.exists()) {
for (File f : COMPSs_LOG_DIR.listFiles()) {
logger.debug("Adding application " + f.getName());
Application app = new Application(f.getName(), appsLocation + File.separator + f.getName());
applications.add(app);
}
}
if (Properties.isSortApplications()) {
Collections.sort(applications, new ApplicationComparator());
}
logger.debug("Applications ViewModel updated");
}
use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.
the class CompleteGraphViewModel method update.
@Command
@NotifyChange("completeGraph")
public void update(Application monitoredApp) {
logger.debug("Updating Complete Graph...");
String completeMonitorLocation = monitoredApp.getPath() + Constants.MONITOR_COMPLETE_DOT_FILE;
File completeMonitorFile = new File(completeMonitorLocation);
if (completeMonitorFile.exists()) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String modifiedTime = sdf.format(completeMonitorFile.lastModified());
if (!modifiedTime.equals(completeGraphLastUpdateTime)) {
// Update needed
try {
String completeGraphSVG = File.separator + "svg" + File.separator + monitoredApp.getName() + "_" + Constants.COMPLETE_GRAPH_FILE_NAME;
completeGraph = loadGraph(completeMonitorLocation, completeGraphSVG);
completeGraphLastUpdateTime = modifiedTime;
} catch (EmptyCompleteGraphException ecge) {
logger.debug("Empty complete graph");
completeGraph = Constants.EMPTY_GRAPH_PATH;
completeGraphLastUpdateTime = modifiedTime;
} catch (Exception e) {
completeGraph = Constants.GRAPH_NOT_FOUND_PATH;
completeGraphLastUpdateTime = "";
logger.error("Graph generation error", e);
}
} else {
logger.debug("Complete Graph is already loaded");
}
} else {
completeGraph = Constants.GRAPH_NOT_FOUND_PATH;
completeGraphLastUpdateTime = "";
logger.debug("Complete Graph file not found");
}
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class CodeListsVM method deleteCodeListItem.
@Command
@NotifyChange({ "itemsPerLevel" })
public void deleteCodeListItem(@BindingParam("item") final CodeListItem item) {
if (isSurveyPublished() && isEnumeratingCodeList()) {
MessageUtil.showWarning("survey.code_list.cannot_delete_enumerating_code_list_items");
} else {
String messageKey;
if (codeListManager.hasChildItems(item)) {
messageKey = "survey.code_list.confirm.delete_non_empty_item";
} else {
messageKey = "survey.code_list.confirm.delete_item";
}
MessageUtil.ConfirmParams params = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {
@Override
public void onOk() {
performDeleteCodeListItem(item);
}
}, messageKey);
params.setOkLabelKey("global.delete_item");
MessageUtil.showConfirm(params);
}
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class NumericAttributeVM method addPrecision.
@Command
@NotifyChange("precisions")
public void addPrecision() {
editingNewPrecision = true;
editedPrecision = new Precision();
openPrecisionEditPopUp();
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class SchemaLayoutVM method nodeSelected.
@Command
@NotifyChange({ "rootTabSet" })
public void nodeSelected(@BindingParam("node") Treeitem node) {
List<ModelVersion> versions = survey.getVersions();
setFormVersion(versions.isEmpty() ? null : versions.get(0));
UITabSet tabSet = getRootTabSet(node);
refreshTabSetLayoutPanel(tabSet, false);
this.rootTabSet = tabSet;
dispatchTabSetChangedCommand();
}
Aggregations