Search in sources :

Example 1 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class SessionWindow method init.

public void init() {
    panel = new G_Panel("flowy");
    sessionControlPanel = new SessionControlPanel(session);
    String pos = "pos 0 0, id sessionControlPanel";
    panel.add(sessionControlPanel, pos);
    timer = new SessionTimer(session, session.getIntParam(AT_PARAMS.SESSION_TIME));
    // pos = "pos @center_x directionHeader.y2, id timer";
    pos = "pos 0 sessionControlPanel.y2, id timer";
    panel.add(timer, pos);
    // timer.x2
    boxPanel = new G_Panel();
    pos = "pos @center_x-125 directionHeader.y2-30, id boxPanel";
    panel.add(boxPanel, pos);
    directionBox = initBox(getDirections(), "Direction");
    styleBox = initBox(WORK_STYLE.values(), "Style");
    stateBox = initBox(STATE.values(), "State");
    viewBox = initBox(VIEW_OPTION.values(), "Custom View");
    directionHeader = new DirectionHeader(session);
    pos = "pos 0 sessionControlPanel.y2, id directionHeader";
    panel.add(directionHeader, pos);
    goalsPanel = new GoalPages(session);
    pos = "pos 0 timer.y2, id goalsPanel";
    panel.add(goalsPanel, pos);
    infoPanel = new InfoEditPanel();
    pos = "pos goalsPanel.x2 directionHeader.y2+50, id infoPanel";
    panel.add(infoPanel.getPanel(), pos);
    lockButton = new CustomButton(VISUALS.LOCK) {

        @Override
        public VISUALS getVisuals() {
            return session.isLocked() ? VISUALS.LOCK : VISUALS.UNLOCK;
        }

        @Override
        public void handleClick() {
            session.setLocked(!session.isLocked());
            refresh();
        }
    };
    pos = "pos timer.x+85 timer.y2-50, id lockButton";
    panel.add(lockButton, pos);
    panel.refreshComponents();
}
Also used : VISUALS(main.swing.generic.components.G_Panel.VISUALS) G_Panel(main.swing.generic.components.G_Panel) CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 2 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class EntityChoiceDialog method createComponent.

@Override
public Component createComponent() {
    G_Panel comp = new G_Panel();
    choicePanel = getChoicePanel();
    CustomButton okButton = new CustomButton(VISUALS.OK) {

        @Override
        public void handleClick() {
            ok();
        }
    };
    CustomButton closeButton = new CustomButton(VISUALS.CANCEL) {

        @Override
        public void handleClick() {
            WaitMaster.interrupt(getWaitOperation());
            close();
        }
    };
    comp.setOpaque(true);
    comp.setBackground(ColorManager.BACKGROUND);
    int x = choicePanel.getPanelWidth();
    // n * getObjSize();
    comp.add(choicePanel);
    comp.add(okButton, "id ok, pos " + x + " 0");
    comp.add(closeButton, "pos ok.x @max_bottom, id close");
    // comp.add(list, "id list, pos 0 0");
    comp.setPanelSize(getSize());
    return comp;
}
Also used : G_Panel(main.swing.generic.components.G_Panel) CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 3 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class OperationWindow method createComponent.

public Component createComponent() {
    panel = new G_Panel(getVisuals());
    operationsPool = new PoolComp(getPoolText(), getPoolTooltip(), false);
    // 
    CustomButton okButton = new CustomButton(OK) {

        public void handleClick() {
            done();
        }

        protected boolean isMoreY() {
            return true;
        }
    };
    CustomButton cancelButton = new CustomButton(CANCEL) {

        protected boolean isMoreY() {
            return true;
        }

        public void handleClick() {
            cancel();
        }
    };
    panel.add(getComponent(), "id tab, pos " + GuiManager.PANEL_FRAME_WIDTH + " " + GuiManager.PANEL_FRAME_HEIGHT);
    panel.add(okButton, "@id ok, pos max_right-" + GuiManager.PANEL_FRAME_WIDTH + " max_top-" + GuiManager.PANEL_FRAME_HEIGHT);
    panel.add(cancelButton, "@id cancel, pos max_right-" + GuiManager.PANEL_FRAME_WIDTH + " ok.y2");
    panel.add(operationsPool, "@id op, pos max_right-" + GuiManager.PANEL_FRAME_WIDTH + " cancel.y2");
    panel.setBackground(ColorManager.BACKGROUND);
    return panel;
}
Also used : PoolComp(eidolons.client.cc.gui.misc.PoolComp) G_Panel(main.swing.generic.components.G_Panel) CustomButton(eidolons.swing.components.buttons.CustomButton)

Example 4 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class DC_PagedLogPanel method addComponents.

protected void addComponents() {
    String pos = "pos 0 0";
    add(getCurrentComponent(), pos);
    addControls();
    returnButton = new CustomButton(VISUALS.ADD) {

        public void handleClick() {
            back();
        }

        protected void playClickSound() {
            DC_SoundMaster.playStandardSound(STD_SOUNDS.SLING);
        }

        public VISUALS getVisuals() {
            if (!isEnabled()) {
                return VISUALS.ADD_BLOCKED;
            }
            return super.getVisuals();
        }

        public boolean isEnabled() {
            // nodeViewMode
            return true;
        }
    };
    // toggleButton = new CustomButton(BUTTON_VISUALS) {
    // public void handleClick() {
    // toggleMode();
    // }
    // 
    // protected void playSound() {
    // DC_SoundMaster.playStandardSound(STD_SOUNDS.CLOCK);
    // }
    // 
    // };
    // 
    // pos = "pos " + (getPanelWidth() - BUTTON_VISUALS.getWidth()) + " "
    // + (getPanelHeight() - BUTTON_VISUALS.getHeight()) + "";
    // add(toggleButton, pos);
    pos = "pos 0 0";
    add(returnButton, pos);
    int i = 0;
    if (entryNodes != null) {
        for (final LogEntryNode node : entryNodes) {
            int lineIndex = (node.getLineIndex()) % getRowCount();
            if (lineIndex == 0) {
                lineIndex = getRowCount();
            }
            Integer y = Math.min(getPanelHeight() - EntryNodeMaster.getRowHeight(isTopPage()), EntryNodeMaster.getRowHeight(isTopPage()) * (lineIndex));
            // TODO
            // top
            // vs
            // generic
            // separate!
            ImageButton entryNodeButton = new ImageButton((node.getButtonImagePath())) {

                @Override
                public void handleClick() {
                    if (entryNode == null) {
                        setCachedTopPageIndex(getCurrentIndex());
                    }
                    if (node.getLinkedAnimation() != null) {
                        for (ANIM anim : node.getLinkedAnimations()) {
                            PhaseAnimation animation = (PhaseAnimation) anim;
                            // DC_Game.game.getAnimationManager()
                            // .getAnimation(key);
                            animation.setPhaseFilter(node.getAnimPhasesToPlay());
                            if (animation != null) {
                                animation.setReplay(true);
                                animation.start();
                                animation.setAutoFinish(false);
                            }
                        }
                        Coordinates bufferedOffset = game.getAnimationManager().updatePoints();
                        game.getManager().refreshGUI();
                        game.getBattleField().getGrid().setNextOffsetCoordinate(bufferedOffset);
                    }
                    setNodeView(node);
                }

                @Override
                protected void playClickSound() {
                    DC_SoundMaster.playStandardSound(STD_SOUNDS.DIS__OPEN_MENU);
                }
            };
            pos = "pos " + 0 + " " + (y);
            add(entryNodeButton, pos);
            entryNodeButton.activateMouseListener();
            setComponentZOrder(entryNodeButton, i);
            i++;
        }
    }
    setComponentZOrder(returnButton, i);
    i++;
    // setComponentZOrder(toggleButton, i);
    // i++;
    setComponentZOrder(forwardButton, i);
    i++;
    setComponentZOrder(backButton, i);
    i++;
    setComponentZOrder(getCurrentComponent(), i);
}
Also used : ImageButton(main.swing.components.ImageButton) PhaseAnimation(eidolons.system.graphics.PhaseAnimation) CustomButton(eidolons.swing.components.buttons.CustomButton) Coordinates(main.game.bf.Coordinates) LogEntryNode(main.system.text.LogEntryNode) ANIM(main.system.graphics.ANIM)

Example 5 with CustomButton

use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.

the class UnlockDialog method createComponent.

@Override
public Component createComponent() {
    G_Panel panel = new G_Panel(PANEL_WIDE);
    CustomButton xpButton = new UnlockButton(true);
    xpButton.setToolTipText(XP);
    xpButton.setText(xpCost + " xp");
    CustomButton goldButton = new UnlockButton(false);
    goldButton.setText(goldCost + " gold");
    goldButton.setToolTipText(GOLD);
    CustomButton cancelButton = new CustomButton(VISUALS.CANCEL) {

        @Override
        public void handleClick() {
            cancel();
        }
    };
    TextCompDC label = new TextCompDC(VISUALS.PROP_BOX);
    label.setText("Unlock " + param.getName());
    panel.add(label, "pos 20 50");
    if (xpCost > 0) {
        panel.add(xpButton, "pos 50 100");
    }
    panel.add(cancelButton, "pos 300 50");
    if (goldCost > 0) {
        panel.add(goldButton, "pos 300 100");
    }
    return panel;
}
Also used : G_Panel(main.swing.generic.components.G_Panel) CustomButton(eidolons.swing.components.buttons.CustomButton) TextCompDC(eidolons.swing.components.panels.page.info.element.TextCompDC)

Aggregations

CustomButton (eidolons.swing.components.buttons.CustomButton)17 G_Panel (main.swing.generic.components.G_Panel)6 TextCompDC (eidolons.swing.components.panels.page.info.element.TextCompDC)2 PoolComp (eidolons.client.cc.gui.misc.PoolComp)1 PortraitComp (eidolons.client.cc.gui.neo.header.PortraitComp)1 HT_Node (eidolons.client.cc.gui.neo.tree.HT_Node)1 ActionButtonEnum (eidolons.swing.components.buttons.ActionButtonEnum)1 PhaseAnimation (eidolons.system.graphics.PhaseAnimation)1 ObjType (main.entity.type.ObjType)1 Coordinates (main.game.bf.Coordinates)1 TASK_COMMAND (main.gui.sub.TaskComponent.TASK_COMMAND)1 ImageButton (main.swing.components.ImageButton)1 CompVisuals (main.swing.generic.components.CompVisuals)1 VISUALS (main.swing.generic.components.G_Panel.VISUALS)1 ANIM (main.system.graphics.ANIM)1 LogEntryNode (main.system.text.LogEntryNode)1 MigLayout (net.miginfocom.swing.MigLayout)1