Package trams.data

Examples of trams.data.Message


     */
    public void drawVehicles ( boolean isRedraw ) {
        //Now check if it is past midnight! If it is dispose, and create Allocation Screen.
        if ( isPastMidnight(theSimulator.getCurrentSimTime(), theSimulator.getPreviousSimTime()) && !doneAllocations ) {
            //Now add a message to summarise days events!!!
          Message message = (Message) theInterface.getContext().getBean("CouncilMessage");
          message.setSubject("Passenger Satisfaction for " + theSimulator.getPreviousDisplaySimDay());
          message.setText("Congratulations you have successfully completed transport operations for " + theInterface.getScenario().getScenarioName() + " on " + theSimulator.getPreviousDisplaySimDay() + " with a passenger satisfaction of " + theSimulator.getScenario().getPassengerSatisfaction() + "%.\n\nNow you need to allocate vehicles to routes for " + theSimulator.getCurrentDisplaySimDay() + " and keep the passenger satisfaction up! Click on the Management tab and then choose Allocations. Good luck!");
            message.setSender("Council");
            message.setFolder("Inbox");
            message.setDate(theSimulator.getCurrentDisplaySimTime());
            //Refresh messages.
            theFoldersBox.getSelectedItem().toString();
            theDateBox.getSelectedItem().toString();
            theMessageTypeBox.getSelectedItem().toString();
            theMessages = theInterface.getMessages(theFoldersBox.getSelectedItem().toString(),theDateBox.getSelectedItem().toString(),theMessageTypeBox.getSelectedItem().toString());
View Full Code Here


     */
    public boolean loadScenario ( String scenarioName, String playerName ) {
        //Process through program operations.
        if ( theOperations.createSimulator(scenarioName, playerName) ) {
            //Create welcome message.
          Message message = (Message) getContext().getBean("CouncilMessage");
          message.setSubject("Welcome Message");
          message.setText("Congratulations on your appointment as Managing Director of the " + getScenario().getScenarioName() + "! \n\n Your targets for the coming days and months are: " + getScenario().getTargets());
          message.setSender("Council");
          message.setFolder("Inbox");
          message.setDate(getSimulator().getCurrentDisplaySimTime());
            addMessage(message);
            return true;
        }
        return false;
    }
View Full Code Here

    public void createAndStoreMessage ( String subject, String text, String sender, String folder, String date ) {
      Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
       
        ApplicationContext theContext = new ClassPathXmlApplicationContext("trams/spring/context.xml");
        Message theMessage = (Message) theContext.getBean("CouncilMessage");
        theMessage.setSubject(subject);
        theMessage.setText(text);
        theMessage.setSender(sender);
        theMessage.setFolder(folder);
        theMessage.setDate(date);
        System.out.println(theMessage.getType());
       
        session.save(theMessage);
        session.getTransaction().commit();
    }
View Full Code Here

        scenario.setAttribute("satisfaction", "" + theSimulator.getScenario().getPassengerSatisfaction());
        game.appendChild(scenario);
        //Create message elements.
        for ( int h = (theSimulator.getNumberMessages()-1); h >= 0; h-- ) {
            //Store message element - it will be quicker.
            Message myMessage = theSimulator.getMessage(h);
            //First of all, create message element.
            Element message = doc.createElement("message");
            //Now set attributes.
            message.setAttribute("subject", myMessage.getSubject());
            message.setAttribute("text", myMessage.getText());
            message.setAttribute("sender", myMessage.getSender());
            message.setAttribute("folder", myMessage.getFolder());
            message.setAttribute("date", myMessage.getDate());
            message.setAttribute("type", myMessage.getType());
            //Finally add message to scenario.
            scenario.appendChild(message);
        }
        //Create route elements.
        for ( int i = 0; i < theSimulator.getScenario().getNumberRoutes(); i++ ) {
View Full Code Here

     * @param date a <code>String</code> with the date.
     * @param type a <code>String</code> with the type.
     */
    public Message createMessageObject ( String subject, String text, String sender, String folder, String date, String type ) {
        if ( type.equalsIgnoreCase("Council") ) {
          Message message = (Message) theContext.getBean("CouncilMessage");
          message.setSubject(subject);
          message.setText(text);
          message.setSender(sender);
          message.setFolder(folder);
          message.setDate(date);
          return message;
        } else if ( type.equalsIgnoreCase("Vehicle") ) {
            Message message = (Message) theContext.getBean("VehicleMessage");
            message.setSubject(subject);
            message.setText(text);
            message.setSender(sender);
            message.setFolder(folder);
            message.setDate(date);
            return message;
        } else {
            return null; //Null if can't find message.
        }
    }
View Full Code Here

TOP

Related Classes of trams.data.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.