use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class EditableListOfNodesVM method setLayout.
@Command
@NotifyChange({ "nodesPerTab" })
public void setLayout(@BindingParam("type") String type, @BindingParam("node") EntityDefinition node) {
UIOptions uiOpts = getUIOptions();
Layout layout = Layout.valueOf(type);
uiOpts.setLayout(node, layout);
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class TabsGroupVM method removeTab.
@Command
@NotifyChange({ "tabs" })
public void removeTab(@BindingParam("tab") UITab tab) {
if (tab.getTabs().isEmpty()) {
SessionStatus sessionStatus = getSessionStatus();
CollectSurvey survey = sessionStatus.getSurvey();
UIOptions uiOpts = survey.getUIOptions();
List<NodeDefinition> nodesPerTab = uiOpts.getNodesPerTab(tab, false);
if (nodesPerTab.isEmpty()) {
UITabSet parent = tab.getParent();
parent.removeTab(tab);
postTabChangedCommand(parent);
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.associated_nodes_present");
}
} else {
MessageUtil.showWarning("survey.layout.tab.remove.error.nested_tabs_present");
}
}
use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.
the class TabsGroupVM method addTab.
@Command
@NotifyChange({ "tabs" })
public void addTab() {
UIOptions uiOptions = tabSet.getUIOptions();
UITab tab = uiOptions.createTab();
String tabName = generateNewTabName(tabSet);
tab.setName(tabName);
tabSet.addTab(tab);
postTabChangedCommand(tabSet);
openTabLabelEditPopUp(tab);
}
use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.
the class CurrentGraphViewModel method update.
@Command
@NotifyChange("graph")
void update(Application monitoredApp) {
logger.debug("Updating Graph...");
String monitorLocation = monitoredApp.getPath() + Constants.MONITOR_CURRENT_DOT_FILE;
File monitorFile = new File(monitorLocation);
if (monitorFile.exists()) {
if (monitorFile.length() > 45) {
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String modifiedTime = sdf.format(monitorFile.lastModified());
if (!modifiedTime.equals(graphLastUpdateTime)) {
try {
String graphSVG = File.separator + "svg" + File.separator + monitoredApp.getName() + "_" + Constants.GRAPH_FILE_NAME;
graph = loadGraph(monitorLocation, graphSVG);
graphLastUpdateTime = modifiedTime;
} catch (Exception e) {
graph = Constants.GRAPH_NOT_FOUND_PATH;
graphLastUpdateTime = "";
logger.error("Graph generation error");
}
} else {
logger.debug("Graph is already loaded");
}
} else {
// The empty graph has length = 45
graph = Constants.GRAPH_EXECUTION_DONE_PATH;
graphLastUpdateTime = "";
}
} else {
graph = Constants.GRAPH_NOT_FOUND_PATH;
graphLastUpdateTime = "";
logger.debug("Graph file not found");
}
}
use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.
the class RuntimeLogViewModel method update.
@Command
@NotifyChange({ "runtimeLog", "filter" })
public void update() {
if (!Properties.getBasePath().equals("")) {
// Check if applicaction has changed
String newPath = Properties.getBasePath() + File.separator + Constants.RUNTIME_LOG;
if (!this.runtimeLogPath.equals(newPath)) {
// Load new application
this.runtimeLogPath = newPath;
this.lastParsedLine = 0;
this.content = "";
this.filter = "";
}
// Parse
logger.debug("Parsing runtime.log file...");
try (BufferedReader br = new BufferedReader(new FileReader(this.runtimeLogPath))) {
StringBuilder sb = new StringBuilder("");
String line = br.readLine();
int i = 0;
while (line != null) {
if (i > this.lastParsedLine) {
if (line.contains(filter)) {
sb.append(line).append("\n");
}
}
i = i + 1;
line = br.readLine();
}
this.content += sb.toString();
this.lastParsedLine = i - 1;
} catch (IOException ioe) {
logger.error("Cannot parse runtime.log file: " + this.runtimeLogPath, ioe);
}
} else {
// Load default value
this.clear();
}
}
Aggregations