Changeset 1493


Ignore:
Timestamp:
04/15/13 15:13:19 (7 years ago)
Author:
philsmart
Message:
 
Location:
raptor-web/trunk/src/main
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/model/wizard/GraphWizardModel.java

    r1491 r1493  
    1414 
    1515import uk.ac.cardiff.model.report.Series; 
     16import uk.ac.cardiff.model.wsmodel.MethodParameter; 
     17import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    1618import uk.ac.cardiff.model.wsmodel.StatisticFunctionType; 
    1719import uk.ac.cardiff.model.wsmodel.SuggestionValues; 
     
    124126    private SuggestionValues suggestionValues; 
    125127 
     128    /** The selected post processor, as a reference for removal */ 
     129    private ProcessorInformation selectedPostProcessor; 
     130 
     131    /** Record for holding information about a new processor to add */ 
     132    private ProcessorInformation processorToAdd; 
     133 
    126134    /** The filename to use for report downloads. */ 
    127135    private String downloadFilename; 
     
    141149        qualitativeTimeRange = QualitativeTimeRange.LAST_WEEK; 
    142150        initChartOptions(); 
     151    } 
     152 
     153    public void initialiseNewProcessorAdd() { 
     154        processorToAdd = new ProcessorInformation(); 
     155 
     156    } 
     157 
     158    /** 
     159     * Makes a copy of any method parameters from the suggestion values, into the processorToAdd 
     160     */ 
     161    public void setupProcessorToAdd() { 
     162        if (processorToAdd != null) { 
     163            log.trace("Finding method parameters for {}", processorToAdd.getFriendlyName()); 
     164            List<ProcessorInformation> processorsInformation = suggestionValues.getPossiblePostProcessors(); 
     165            for (ProcessorInformation information : processorsInformation) { 
     166                if (information.getFriendlyName().equals(processorToAdd.getFriendlyName())) { 
     167                    processorToAdd.setProcessorClass(information.getProcessorClass()); 
     168                    if (information.getMethodParameters() != null) { 
     169                        List<MethodParameter> parameters = new ArrayList<MethodParameter>(); 
     170                        for (MethodParameter parameter : information.getMethodParameters()) { 
     171                            MethodParameter parameterNew = new MethodParameter(); 
     172                            log.debug("Setup parameter {}", parameter.getParameterName()); 
     173                            parameterNew.setParameterName(parameter.getParameterName()); 
     174                            parameterNew.setParameterType(parameter.getParameterType()); 
     175                            parameterNew.setValueType(parameter.getValueType()); 
     176                            parameters.add(parameterNew); 
     177                        } 
     178                        processorToAdd.setMethodParameters(parameters); 
     179                    } else { 
     180                        processorToAdd.setMethodParameters(null); 
     181                    } 
     182                } 
     183            } 
     184 
     185        } 
    143186    } 
    144187 
     
    518561    } 
    519562 
     563    /** 
     564     * @return Returns the selectedPostProcessor. 
     565     */ 
     566    public ProcessorInformation getSelectedPostProcessor() { 
     567        return selectedPostProcessor; 
     568    } 
     569 
     570    /** 
     571     * @param selectedPostProcessor The selectedPostProcessor to set. 
     572     */ 
     573    public void setSelectedPostProcessor(ProcessorInformation selectedPostProcessor) { 
     574        this.selectedPostProcessor = selectedPostProcessor; 
     575    } 
     576 
     577    /** 
     578     * @return Returns the processorToAdd. 
     579     */ 
     580    public ProcessorInformation getProcessorToAdd() { 
     581        return processorToAdd; 
     582    } 
     583 
     584    /** 
     585     * @param processorToAdd The processorToAdd to set. 
     586     */ 
     587    public void setProcessorToAdd(ProcessorInformation processorToAdd) { 
     588        this.processorToAdd = processorToAdd; 
     589    } 
     590 
    520591} 
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/service/GraphWizardService.java

    r1491 r1493  
    88 */ 
    99public interface GraphWizardService { 
     10    // TODO this is too similar to graphService to be a seperate service. 
    1011 
    1112    /** 
     
    3738     * @param model 
    3839     */ 
    39     void removeSelectedFilterFromSelectedStatistic(GraphWizardModel model); 
     40    public void removeSelectedFilterFromSelectedStatistic(GraphWizardModel model); 
    4041 
    4142    /** 
    4243     * @param model 
    4344     */ 
    44     void removeSeriesFromSelectedStatistic(GraphWizardModel model); 
     45    public void removeSeriesFromSelectedStatistic(GraphWizardModel model); 
    4546 
    4647    public void generateExcelReport(GraphWizardModel model); 
     
    5253    public void loadSavedReports(GraphWizardModel model); 
    5354 
     55    /** 
     56     * @param model 
     57     */ 
     58    public void addProcessorToSelectedStatistic(GraphWizardModel model); 
     59 
     60    /** 
     61     * @param model 
     62     */ 
     63    public void removePostProcessorFromSelectedStatistic(GraphWizardModel model); 
     64 
    5465} 
  • raptor-web/trunk/src/main/java/uk/ac/cardiff/raptorweb/service/impl/GraphWizardServiceImpl.java

    r1491 r1493  
    1111import uk.ac.cardiff.model.report.AggregatorGraphModel; 
    1212import uk.ac.cardiff.model.wsmodel.DynamicStatisticalUnitInformation; 
     13import uk.ac.cardiff.model.wsmodel.MethodParameter; 
     14import uk.ac.cardiff.model.wsmodel.ProcessorInformation; 
    1315import uk.ac.cardiff.model.wsmodel.StatisticFunctionType; 
    1416import uk.ac.cardiff.model.wsmodel.StatisticalUnitInformation; 
     
    5557 
    5658    @Override 
     59    public void addProcessorToSelectedStatistic(GraphWizardModel model) { 
     60        ProcessorInformation processorToAdd = model.getProcessorToAdd(); 
     61        log.debug("Adding processor [{} with parameters {}]", processorToAdd.getFriendlyName(), 
     62                (processorToAdd.getMethodParameters() != null)); 
     63 
     64        if (processorToAdd.getMethodParameters() != null) { 
     65            for (MethodParameter methodParameter : processorToAdd.getMethodParameters()) { 
     66                log.debug("Parameter [{},{},{}]", 
     67                        new Object[] {methodParameter.getParameterName(), methodParameter.getValue(), 
     68                                methodParameter.getValue().getClass()}); 
     69            } 
     70        } 
     71        model.getSelectedGraphSet().getStatisticalUnitInformation().getStatisticalUnitInformation().getPostprocessors() 
     72                .add(processorToAdd); 
     73    } 
     74 
     75    @Override 
     76    public void removePostProcessorFromSelectedStatistic(GraphWizardModel model) { 
     77        model.getSelectedGraphSet().getStatisticalUnitInformation().getStatisticalUnitInformation().getPostprocessors() 
     78                .remove(model.getSelectedPostProcessor()); 
     79    } 
     80 
     81    @Override 
    5782    public void generateExcelReport(GraphWizardModel model) { 
    5883        // if (model.getCurrentTableGraph() != null) 
  • raptor-web/trunk/src/main/webapp/WEB-INF/flows/reports/graph-wizard-subflow.xml

    r1491 r1493  
    3737 
    3838    <view-state id="graphTypeSelector" view="wizard/graph-type-selector.xhtml"> 
    39         
     39 
    4040        <transition on="lookupStatistic"> 
    4141            <evaluate expression="graphWizardService.lookupStatisticalUnitInformation(graphWizardModel)" /> 
     
    6060        </transition> 
    6161 
     62        <transition on="next" to="graphProcessorSelector" /> 
     63        <transition on="back" to="graphTypeSelector" /> 
     64        <transition on="cancel" to="cancelWizard" /> 
     65    </view-state> 
     66 
     67 
     68    <view-state id="graphProcessorSelector" view="wizard/graph-processor-selector.xhtml"> 
     69 
     70        <transition on="removePostProcessorFromSelectedStatistic"> 
     71            <evaluate expression="graphWizardService.removePostProcessorFromSelectedStatistic(graphWizardModel)"></evaluate> 
     72        </transition> 
     73         
     74        <transition on="addProcessorToSelectedStatistic"> 
     75            <evaluate expression="graphWizardService.addProcessorToSelectedStatistic(graphWizardModel)"></evaluate> 
     76        </transition> 
     77         
     78        <transition on="initialiseNewProcessorAdd"> 
     79            <evaluate expression="graphWizardModel.initialiseNewProcessorAdd()" /> 
     80        </transition> 
     81 
     82        <transition on="setupProcessorToAdd"> 
     83            <evaluate expression="graphWizardModel.setupProcessorToAdd()" /> 
     84        </transition> 
     85 
    6286        <transition on="next" to="graphOptionsSelector" /> 
    63         <transition on="back" to="graphTypeSelector" /> 
     87        <transition on="back" to="graphSeriesSelector" /> 
    6488        <transition on="cancel" to="cancelWizard" /> 
    6589    </view-state> 
     
    93117            <evaluate expression="graphWizardService.generatePDFReport(graphWizardModel)" /> 
    94118        </transition> 
    95          
     119 
    96120        <transition on="save"> 
    97121            <evaluate expression="savedWizardReportsService.save(graphWizardModel,flowScope.websession.user.name)" /> 
Note: See TracChangeset for help on using the changeset viewer.