Search in sources :

Example 1 with EditWorldDialog

use of mudmap2.frontend.dialog.EditWorldDialog in project mudmap2 by Neop.

the class Mainwindow method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    WorldTab wt = getSelectedTab();
    switch(e.getActionCommand()) {
        case "new_world":
            createNewWorld();
            break;
        case "save_world":
            if (wt != null)
                wt.save();
            break;
        case "save_world_as":
            if (wt != null) {
                SaveWorldDialog dlg = new SaveWorldDialog(Mainwindow.this, wt);
                int ret = dlg.showSaveDialog(wt);
                if (ret == JFileChooser.APPROVE_OPTION) {
                    wt.getWorld().setWorldFile(dlg.getWorldFile());
                    wt.setFilename(dlg.getSelectedFile().getAbsolutePath());
                    wt.save();
                }
            }
            break;
        case "export_image":
            if (wt != null) {
                ExportImageDialog dlg = new ExportImageDialog(Mainwindow.this, wt);
                dlg.setVisible(true);
            }
            break;
        case "quit":
            quit();
            break;
        case "edit_world":
            if (wt != null) {
                (new EditWorldDialog(Mainwindow.this, wt.getWorld())).setVisible(true);
            }
            break;
        case "path_colors":
            if (wt != null) {
                (new PathColorDialog(Mainwindow.this, wt.getWorld())).setVisible(true);
                wt.repaint();
            }
            break;
        case "add_place_group":
            if (wt != null)
                (new PlaceGroupDialog(Mainwindow.this, wt.getWorld())).setVisible(true);
            break;
        case // set home position
        "set_home":
            if (wt != null)
                wt.getWorldPanel().setHome();
            break;
        case // go to home position
        "goto_home":
            if (wt != null)
                wt.getWorldPanel().gotoHome();
            break;
        default:
            String message = getClass().getName() + ": ActionCommand not recognized";
            Logger.getLogger(WorldManager.class.getName()).log(Level.SEVERE, message);
            JOptionPane.showMessageDialog(this, message, "MUD Map error", JOptionPane.ERROR_MESSAGE);
            break;
    }
}
Also used : PlaceGroupDialog(mudmap2.frontend.dialog.PlaceGroupDialog) SaveWorldDialog(mudmap2.frontend.dialog.SaveWorldDialog) PathColorDialog(mudmap2.frontend.dialog.PathColorDialog) EditWorldDialog(mudmap2.frontend.dialog.EditWorldDialog) ExportImageDialog(mudmap2.frontend.dialog.ExportImageDialog)

Aggregations

EditWorldDialog (mudmap2.frontend.dialog.EditWorldDialog)1 ExportImageDialog (mudmap2.frontend.dialog.ExportImageDialog)1 PathColorDialog (mudmap2.frontend.dialog.PathColorDialog)1 PlaceGroupDialog (mudmap2.frontend.dialog.PlaceGroupDialog)1 SaveWorldDialog (mudmap2.frontend.dialog.SaveWorldDialog)1