Search in sources :

Example 1 with ImageChooser

use of main.swing.generic.components.editors.ImageChooser in project Eidolons by IDemiurge.

the class DC_PortraitPanel method selectNewPortrait.

protected void selectNewPortrait() {
    String portrait = new ImageChooser().launch("Image", getEntity().getImagePath());
    if (portrait != null) {
        if (ImageManager.isImage(portrait)) {
            getEntity().setImage(portrait);
            getPortrait().setIcon(getEntity().getIcon());
        }
    }
}
Also used : ImageChooser(main.swing.generic.components.editors.ImageChooser)

Example 2 with ImageChooser

use of main.swing.generic.components.editors.ImageChooser in project Eidolons by IDemiurge.

the class LE_Palette method newPalette.

public void newPalette() {
    int optionChoice = DialogMaster.optionChoice("Choose object TYPE...", default_palette);
    OBJ_TYPE TYPE;
    List<ObjType> typeList;
    if (optionChoice == -1) {
        if (DialogMaster.confirm("Multi-type Palette?")) {
            optionChoice = DialogMaster.optionChoice("Choose object multi TYPE...", multi_types);
            if (optionChoice == -1) {
                return;
            }
            TYPE = multi_types[optionChoice];
            typeList = DataManager.getTypes(TYPE);
        } else {
            return;
        }
    } else {
        TYPE = default_palette[optionChoice];
        typeList = DataManager.getTypes(TYPE);
    }
    // int index = DialogMaster.optionChoice("Choose object TYPE...",
    // palettes.toArray());
    // PaletteWorkspace ws = palettes.getOrCreate(index);
    List<String> listData = DataManager.toStringList(typeList);
    List<String> secondListData = (TYPE instanceof C_OBJ_TYPE) ? new ArrayList<>() : DataManager.toStringList(typeList);
    // if (ws != null) {
    // secondListData = DataManager.convertToStringList(ws.getTypeList());
    // }
    String data = new ListChooser(listData, secondListData, false, TYPE).choose();
    if (data == null) {
        return;
    }
    List<ObjType> list = DataManager.toTypeList(data, TYPE);
    String name = DialogMaster.inputText();
    imagePath = new ImageChooser().launch(imagePath, "");
    PaletteWorkspace ws = new PaletteWorkspace(name, list, imagePath);
    addWorkspaceTab(ws);
    saveWorkspace(ws);
}
Also used : C_OBJ_TYPE(main.content.C_OBJ_TYPE) C_OBJ_TYPE(main.content.C_OBJ_TYPE) OBJ_TYPE(main.content.OBJ_TYPE) ObjType(main.entity.type.ObjType) ImageChooser(main.swing.generic.components.editors.ImageChooser) ListChooser(main.swing.generic.components.editors.lists.ListChooser)

Example 3 with ImageChooser

use of main.swing.generic.components.editors.ImageChooser in project Eidolons by IDemiurge.

the class TaskComp method handleButtonMouseClick.

protected void handleButtonMouseClick(MouseEvent arg0) {
    boolean alt = arg0.isAltDown();
    if (arg0.getSource() == imageComp) {
        String newPath = new ImageChooser().launch(entity.getImagePath(), entity.getImagePath());
        entity.setImage(newPath);
        refresh();
    } else if (arg0.getSource() == gloryComp) {
        Integer i = DialogMaster.inputInt("Set Glory reward...", entity.getIntParam(AT_PARAMS.GLORY));
        entity.setParam(AT_PARAMS.GLORY, i);
    } else if (arg0.getSource() == descrPanel) {
        if (!SwingUtilities.isRightMouseButton(arg0)) {
            if (arg0.getClickCount() == 1) {
                return;
            }
        }
        String descr = DialogMaster.inputText("", entity.getProperty(G_PROPS.DESCRIPTION));
        entity.setProperty(G_PROPS.DESCRIPTION, descr);
    } else if (arg0.getSource() == headerComp) {
        if (SwingUtilities.isRightMouseButton(arg0)) // handleClick(getRightClickCommand(), alt);
        {
            PromptMaster.fillOut(entity, !alt);
        } else if (arg0.getClickCount() > 1) {
        // handleClick(getDoubleClickCommand(), alt);
        }
    }
// else if (arg0.getSource() == buttonPanel)
// for (Rectangle r : mouseMap.keySet()) {
// if (r.contains(arg0.getPoint())) {
// handleClick(mouseMap.getOrCreate(r), alt);
// return;
// }
// }
}
Also used : ImageChooser(main.swing.generic.components.editors.ImageChooser)

Example 4 with ImageChooser

use of main.swing.generic.components.editors.ImageChooser in project Eidolons by IDemiurge.

the class TaskComponent method handleButtonMouseClick.

protected void handleButtonMouseClick(MouseEvent arg0) {
    boolean alt = arg0.isAltDown();
    if (arg0.getSource() == imageComp) {
        String newPath = new ImageChooser().launch(task.getImagePath(), task.getImagePath());
        task.setImage(newPath);
        refresh();
    } else if (arg0.getSource() == gloryComp) {
        Integer i = DialogMaster.inputInt("Set Glory reward...", task.getIntParam(AT_PARAMS.GLORY));
        task.setParam(AT_PARAMS.GLORY, i);
    } else if (arg0.getSource() == descrPanel) {
        if (!SwingUtilities.isRightMouseButton(arg0)) {
            if (arg0.getClickCount() == 1) {
                return;
            }
        }
        String descr = DialogMaster.inputText("", task.getProperty(G_PROPS.DESCRIPTION));
        task.setProperty(G_PROPS.DESCRIPTION, descr);
    } else if (arg0.getSource() == headerComp) {
        if (SwingUtilities.isRightMouseButton(arg0)) // handleClick(getRightClickCommand(), alt);
        {
            PromptMaster.fillOut(task, !alt);
        } else if (arg0.getClickCount() > 1) {
            handleClick(getDoubleClickCommand(), alt);
        }
    } else if (arg0.getSource() == buttonPanel) {
        for (Rectangle r : mouseMap.keySet()) {
            if (r.contains(arg0.getPoint())) {
                handleClick(mouseMap.get(r), alt);
                return;
            }
        }
    }
}
Also used : ImageChooser(main.swing.generic.components.editors.ImageChooser)

Example 5 with ImageChooser

use of main.swing.generic.components.editors.ImageChooser in project Eidolons by IDemiurge.

the class PortraitComp method handleMouseClick.

protected void handleMouseClick() {
    if (Launcher.DEV_MODE) {
        String portrait = new ImageChooser().launch("Image", hero.getImagePath());
        if (portrait != null) {
            if (ImageManager.isImage(portrait)) {
                hero.setImage(portrait);
                // hero.setProperty(G_PROPS.IMAGE, portrait, true);
                label.setIcon(hero.getIcon());
            }
        }
    }
}
Also used : ImageChooser(main.swing.generic.components.editors.ImageChooser)

Aggregations

ImageChooser (main.swing.generic.components.editors.ImageChooser)8 ListChooser (main.swing.generic.components.editors.lists.ListChooser)2 C_OBJ_TYPE (main.content.C_OBJ_TYPE)1 OBJ_TYPE (main.content.OBJ_TYPE)1 PROPERTY (main.content.values.properties.PROPERTY)1 ObjType (main.entity.type.ObjType)1 FileChooser (main.swing.generic.components.editors.FileChooser)1 TextEditor (main.swing.generic.components.editors.TextEditor)1