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();
}
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;
}
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;
}
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);
}
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;
}
Aggregations