Search in sources :

Example 16 with NotifyChange

use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.

the class ViewModel method updateRuntimeLog.

@Command
@NotifyChange("runtimeLogViewModel")
public void updateRuntimeLog() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.debug("Loaded Monitored Application: " + monitoredApp.getName());
    logger.debug("Updating RuntimeLog...");
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.runtimeLogTabName)) {
            runtimeLogViewModel.update();
        } else {
            runtimeLogViewModel.clear();
        }
    } else {
        runtimeLogViewModel.clear();
    }
    logger.info("Runtime.log updated");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 17 with NotifyChange

use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.

the class ViewModel method update.

@Command
@NotifyChange({ "resourcesViewModel", "coresViewModel", "currentGraphViewModel", "completeGraphViewModel", "loadChartViewModel", "statisticsViewModel", "runtimeLogViewModel" })
public void update() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.info("Loaded Monitored Application: " + monitoredApp.getName());
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.resourcesInformationTabName)) {
            logger.debug("Updating Resources Information...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseResources();
            logger.debug("Monitor XML File parsed");
            // Update
            resourcesViewModel.update(MonitorXmlParser.getWorkersDataArray());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.tasksInformationTabName)) {
            logger.debug("Updating Jobs Information...");
            // Monitoring parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.currentTasksGraphTabName)) {
            logger.debug("Updating Current Tasks Graph...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            currentGraphViewModel.update(monitoredApp);
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.completeTasksGraphTabName)) {
            logger.debug("Updating Complete Tasks Graph...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseCores();
            logger.debug("Monitor XML File parsed");
            // Update
            coresViewModel.update(MonitorXmlParser.getCoresDataArray());
            completeGraphViewModel.update(monitoredApp);
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.loadChartTabName)) {
            logger.debug("Updating Resouces Load Chart...");
            // Update
            loadChartViewModel.update();
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.statisticsTabName)) {
            logger.debug("Updating statistics...");
            // Monitor XML parse
            logger.debug("Parsing Monitor XML File...");
            MonitorXmlParser.parseStatistics();
            logger.debug("Monitor XML File parsed");
            // Update
            statisticsViewModel.update(MonitorXmlParser.getStatisticsParameters());
            logger.info("Structures updated");
        } else if (selectedTab.equals(Constants.runtimeLogTabName)) {
            // Check messagebox result
            if (runtimeLogConfirmation == 0) {
                logger.debug("Messagebox confirmation received. Loading runtime.log");
                this.updateRuntimeLog();
                // Reset messagebox handler to avoid automatic refresh
                runtimeLogConfirmation = -1;
            } else if (runtimeLogConfirmation == 1) {
                logger.debug("Messagebox denied");
                // Reset messagebox handler to avoid automatic refresh
                runtimeLogConfirmation = -1;
            }
        } else if (selectedTab.equals(Constants.executionInformationTabName)) {
        // Nothing to do. This tab doesn't have automatic update
        } else {
            logger.info("No Information Tab selected");
        }
    } else {
        resourcesViewModel.clear();
        coresViewModel.clear();
        currentGraphViewModel.clear();
        completeGraphViewModel.clear();
        loadChartViewModel.clear();
        statisticsViewModel.clear();
        runtimeLogViewModel.clear();
        logger.info("No Application Selected");
    }
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 18 with NotifyChange

use of org.zkoss.bind.annotation.NotifyChange in project compss by bsc-wdc.

the class ViewModel method updateExecutionInformation.

@Command
@NotifyChange("executionInformationViewModel")
public void updateExecutionInformation() {
    logger.debug("Loading Monitored Application...");
    Application monitoredApp = new Application();
    Session session = Sessions.getCurrent();
    if (session != null) {
        UserCredential userCred = ((UserCredential) session.getAttribute("userCredential"));
        if (userCred != null) {
            monitoredApp = userCred.getMonitoredApp();
        }
    }
    logger.debug("Loaded Monitored Application: " + monitoredApp.getName());
    logger.debug("Updating Execution Information...");
    if (monitoredApp.getName() != "") {
        if (selectedTab.equals(Constants.executionInformationTabName)) {
            executionInformationViewModel.update();
        }
    } else {
        executionInformationViewModel.clear();
    }
    logger.info("Execution Information updated");
}
Also used : UserCredential(es.bsc.compss.ui.auth.UserCredential) Session(org.zkoss.zk.ui.Session) NotifyChange(org.zkoss.bind.annotation.NotifyChange) Command(org.zkoss.bind.annotation.Command) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand)

Example 19 with NotifyChange

use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.

the class AttributeVM method addAttributeDefault.

@Command
@NotifyChange("attributeDefaults")
public void addAttributeDefault() {
    if (checkCanInsertAttributeDefault()) {
        editingNewAttributeDefault = true;
        editedAttributeDefault = new AttributeDefault();
        openAttributeDefaultEditPopUp();
    }
}
Also used : AttributeDefault(org.openforis.idm.metamodel.AttributeDefault) NotifyChange(org.zkoss.bind.annotation.NotifyChange) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand) Command(org.zkoss.bind.annotation.Command)

Example 20 with NotifyChange

use of org.zkoss.bind.annotation.NotifyChange in project collect by openforis.

the class AttributeVM method deleteAttributeDefault.

@Command
@NotifyChange({ "selectedAttributeDefault", "attributeDefaults" })
public void deleteAttributeDefault() {
    ConfirmParams params = new MessageUtil.ConfirmParams(new MessageUtil.ConfirmHandler() {

        @Override
        public void onOk() {
            editedItem.removeAttributeDefault(selectedAttributeDefault);
            selectedAttributeDefault = null;
            initAttributeDefaults();
            notifyChange("selectedAttributeDefault", "attributeDefaults");
        }
    }, "survey.schema.attribute.attribute_default.confirm_delete");
    params.setOkLabelKey("global.delete_item");
    MessageUtil.showConfirm(params);
}
Also used : ConfirmParams(org.openforis.collect.designer.util.MessageUtil.ConfirmParams) MessageUtil(org.openforis.collect.designer.util.MessageUtil) NotifyChange(org.zkoss.bind.annotation.NotifyChange) GlobalCommand(org.zkoss.bind.annotation.GlobalCommand) Command(org.zkoss.bind.annotation.Command)

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