Search in sources :

Example 1 with NotAValidFileException

use of de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NotAValidFileException in project scylla by bptlab.

the class SimulationConfigurationPane method open.

@Override
protected void open() throws JDOMException, IOException {
    buttonClosefile.setEnabled(true);
    try {
        creator = SimulationConfigurationCreator.createFromFile(getFile().getPath());
    } catch (NotAValidFileException e1) {
        setFile(null);
        e1.printStackTrace();
        return;
    }
    if (gcc != null)
        creator.setGCC(gcc);
    Element modelRoot = null;
    if (bpmnPath != null && !bpmnPath.isEmpty())
        try {
            Document doc;
            SAXBuilder builder = new SAXBuilder();
            doc = builder.build(bpmnPath);
            modelRoot = doc.getRootElement();
            creator.setModel(modelRoot, false);
        } catch (JDOMException | IOException e) {
            e.printStackTrace();
        } catch (NoProcessSpecifiedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (NotAuthorizedToOverrideException e) {
            int override = showModelOverrideConfirmationDialog(e);
            if (override == 0)
                try {
                    creator.setModel(modelRoot, true);
                } catch (NoProcessSpecifiedException | NotAuthorizedToOverrideException e1) {
                    e1.printStackTrace();
                }
            else
                clearBpmnPath();
            e.printStackTrace();
        }
    setChangeFlag(true);
    textfieldId.loadSavedValue();
    if (creator.getRandomSeed() != null) {
        textfieldSeed.setValue(creator.getRandomSeed());
    }
    if (creator.getProcessInstances() != null)
        spinnerNOI.setValue(Integer.parseInt(creator.getProcessInstances()));
    String startDt = creator.getStartDateTime();
    if (startDt != null) {
        startDateTime = ZonedDateTime.parse(startDt);
        textfieldStartTime.setValue(startDateTime.toLocalTime());
        textfieldStartDate.setValue(startDateTime.toLocalDate());
    }
    String endDt = creator.getEndDateTime();
    if (endDt != null) {
        checkboxUnlimited.setSelected(false);
        endDateTime = ZonedDateTime.parse(endDt);
        textfieldEndTime.setValue(endDateTime.toLocalTime());
        textfieldEndDate.setValue(endDateTime.toLocalDate());
    } else {
        checkboxUnlimited.setSelected(true);
        textfieldEndDate.getComponent().setEnabled(false);
        textfieldEndTime.getComponent().setEnabled(false);
    }
    importCreatorElements();
    setChangeFlag(false);
    setEnabled(true);
}
Also used : SAXBuilder(org.jdom2.input.SAXBuilder) NotAuthorizedToOverrideException(de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NotAuthorizedToOverrideException) Element(org.jdom2.Element) Document(org.jdom2.Document) NoProcessSpecifiedException(de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NoProcessSpecifiedException) NotAValidFileException(de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NotAValidFileException)

Aggregations

NoProcessSpecifiedException (de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NoProcessSpecifiedException)1 NotAValidFileException (de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NotAValidFileException)1 NotAuthorizedToOverrideException (de.hpi.bpt.scylla.creation.SimulationConfiguration.SimulationConfigurationCreator.NotAuthorizedToOverrideException)1 Document (org.jdom2.Document)1 Element (org.jdom2.Element)1 SAXBuilder (org.jdom2.input.SAXBuilder)1