Package maze.model

Examples of maze.model.MazeInfo


      statTable.setEnabled(false);

      JScrollPane statPane = new JScrollPane(statTable);
      rightPanel.add(statPane);

      MazeInfo mi = (MazeInfo) mazeList.getList().getSelectedValue();
      if (mi != null)
      {
         this.maze = mi.getModel().clone();
      }

      this.algorithm = (RobotBase) algorithmCombo.getSelectedItem();

      // Set the split pane divider in a delayed manner.
View Full Code Here


    * Get the maze model that is currently selected in the maze list.
    * @return MazeModel or null if none selected.
    */
   private MazeModel getSelectedMazeModel()
   {
      MazeInfo mi = (MazeInfo) mazeList.getList().getSelectedValue();
      if (mi != null)
         return mi.getModel();
      else
         return null;
   }
View Full Code Here

      MazeInfoModel mim = Main.getPrimaryFrameInstance().getMazeInfoModel();

      if (result.equals(NewMazeDialog.MAZ))
      {
         MazeInfo newMi = mim.createNew("New Maze " + mLastNew, false);
         if (newMi == null)
         {
            JOptionPane.showMessageDialog(MazeEditorPage.this,
                                          "Unable to create new maze",
                                          "Maze Creation Error",
                                          JOptionPane.OK_OPTION);
            return;
         }
         mLastNew++;
      }
      else if (result.equals(NewMazeDialog.MZ2))
      {
         MazeInfo newMi = mim.createNew(dialog.getText(), true);
         if (newMi == null)
         {
            JOptionPane.showMessageDialog(MazeEditorPage.this,
                                          "Unable to create new maze",
                                          "Maze Creation Error",
                                          JOptionPane.OK_OPTION);
            return;
         }
         MazeModel mm = newMi.getModel();
         mm.setSize(dialog.getMazeSize());
      }
   }
View Full Code Here

    * Save the current maze.
    */
   @Override
   public void saveCurrent()
   {
      MazeInfo mi = (MazeInfo) mOpenMazes.getList().getSelectedValue();
      if (mi != null)
      {
         mi = mi.saveMaze();
         mOpenMazes.getList().setSelectedValue(mi, true);
      }
   }
View Full Code Here

    * Close the current maze.
    */
   @Override
   public void close()
   {
      MazeInfo mi = (MazeInfo) mOpenMazes.getList().getSelectedValue();
      if (mi != null)
      {
         if (!mi.isMutable())
         {
            JOptionPane.showMessageDialog(this,
                                          "This maze cannot be closed",
                                          "Maze Close",
                                          JOptionPane.INFORMATION_MESSAGE);
            return;
         }
         if (mi.isDirty())
            saveCurrent();
         MazeInfoModel mim = Main.getPrimaryFrameInstance().getMazeInfoModel();
         JList list = mOpenMazes.getList();
         list.setSelectedIndex(list.getSelectedIndex() - 1);
         mim.close(mi);
View Full Code Here

   {
      final PrimaryFrame primary = Main.getPrimaryFrameInstance();
      DefaultComboBoxModel cbm = primary.getMazeInfoModel().getMazeInfoComboBoxModel();
      for (int i = 0; i < cbm.getSize(); i++)
      {
         MazeInfo mi = (MazeInfo) cbm.getElementAt(i);
         if (mi.isDirty())
         {
            int result;
            result = JOptionPane.showConfirmDialog(this,
                                                   "Would you like to save \"" +
                                                         mi.getName() +
                                                         "\"",
                                                   "Save Maze?",
                                                   JOptionPane.YES_NO_OPTION,
                                                   JOptionPane.QUESTION_MESSAGE);
            if (result == JOptionPane.YES_OPTION)
               mi.saveMaze();
            else if (result != JOptionPane.NO_OPTION)
               return false; // Abort exit if canceled.
         }
      }
      return true;
View Full Code Here

   @Override
   public void valueChanged(ListSelectionEvent e)
   {
      try
      {
         MazeInfo mi = (MazeInfo) this.myList.getSelectedValue();
         if (mi != null)
            this.mazeView.setModel(mi.getModel());
      }
      catch (RuntimeException ex)
      {
         ex.printStackTrace();
      }
View Full Code Here

   {
      @Override
      public Component getListCellRendererComponent(JList list, Object value, int index,
            boolean isSelected, boolean cellHasFocus)
      {
         MazeInfo mi = (MazeInfo) value;
         final String postfix;
         if (mi.isDirty())
            postfix = "*";
         else
            postfix = "";
         Component c = super.getListCellRendererComponent(list,
                                                          mi.getName() + postfix,
                                                          index,
                                                          isSelected,
                                                          cellHasFocus);
         JComponent jc = (JComponent) c;
         String path = mi.getPath();
         if (path != null && !path.equals(""))
            jc.setToolTipText(path);
         return jc;
      }
View Full Code Here

TOP

Related Classes of maze.model.MazeInfo

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.