Search in sources :

Example 1 with NotifyChange

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");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) File(java.io.File) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command)

Example 2 with NotifyChange

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");
    }
}
Also used : File(java.io.File) SimpleDateFormat(java.text.SimpleDateFormat) EmptyCompleteGraphException(es.bsc.compss.exceptions.EmptyCompleteGraphException) EmptyCompleteGraphException(es.bsc.compss.exceptions.EmptyCompleteGraphException) IOException(java.io.IOException) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command)

Example 3 with NotifyChange

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);
    }
}
Also used : MessageUtil(org.openforis.collect.designer.util.MessageUtil) ConfirmHandler(org.openforis.collect.designer.util.MessageUtil.ConfirmHandler) NotifyChange(org.zkoss.bind.annotation.NotifyChange) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand) Command(org.zkoss.bind.annotation.Command)

Example 4 with NotifyChange

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();
}
Also used : Precision(org.openforis.idm.metamodel.Precision) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 5 with NotifyChange

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();
}
Also used : UITabSet(org.openforis.collect.metamodel.ui.UITabSet) ModelVersion(org.openforis.idm.metamodel.ModelVersion) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Aggregations

Command (org.zkoss.bind.annotation.Command)26 NotifyChange (org.zkoss.bind.annotation.NotifyChange)26 GlobalCommand (org.zkoss.bind.annotation.GlobalCommand)17 UserCredential (es.bsc.compss.ui.auth.UserCredential)4 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)4 File (java.io.File)3 IOException (java.io.IOException)3 MessageUtil (org.openforis.collect.designer.util.MessageUtil)3 UITab (org.openforis.collect.metamodel.ui.UITab)3 CollectSurvey (org.openforis.collect.model.CollectSurvey)3 UITab (org.openforis.collect.model.ui.UITab)3 Session (org.zkoss.zk.ui.Session)3 SimpleDateFormat (java.text.SimpleDateFormat)2 SessionStatus (org.openforis.collect.designer.session.SessionStatus)2 ConfirmParams (org.openforis.collect.designer.util.MessageUtil.ConfirmParams)2 UITabSet (org.openforis.collect.metamodel.ui.UITabSet)2 UITabDefinition (org.openforis.collect.model.ui.UITabDefinition)2 EmptyCompleteGraphException (es.bsc.compss.exceptions.EmptyCompleteGraphException)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1