use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.
the class ChoiceView method addControls.
protected void addControls() {
backButton = new CustomButton(VISUALS.BACK) {
public void handleClick() {
back();
}
};
add(backButton, getBackButtonPos());
okButton = new CustomButton(VISUALS.FORWARD_BLOCKED) {
@Override
public boolean isEnabled() {
return !isOkBlocked();
}
public void handleClick() {
ok();
}
};
add(okButton, getOkButtonPos());
}
use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.
the class T3UpperPanel method init.
public void init() {
heroPortrait = new PortraitComp(hero);
controlPanel = new G_Panel();
for (final String c : controls) {
controlPanel.add(new CustomButton(VISUALS.BUTTON_NEW_TINY, (c)) {
public void handleClick() {
handleControl(c, false);
}
@Override
public void handleAltClick() {
handleControl(c, true);
}
});
}
add(controlPanel, "id cp, pos @center_x 0");
add(heroPortrait.getComp(), "pos @center_x cp.y2");
}
use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.
the class HT_ControlPanel method addControls.
private void addControls() {
viewModeButton = new CustomButton(new CompVisuals(STD_IMAGES.SEARCH.getImage())) {
@Override
public void handleClick() {
handleControl(VIEW_MODE);
}
};
viewModeButton.removeMouseListener(viewModeButton);
viewModeButton.addMouseListener(view);
add(viewModeButton);
}
use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.
the class HT_View method mouseClicked.
@Override
public void mouseClicked(MouseEvent e) {
tree = treeCache.get(arg);
getTree().setDisplayRequirements(false);
if (e.getSource() instanceof CustomButton) {
CustomButton customButton = (CustomButton) e.getSource();
if (e.isAltDown()) {
customButton.handleAltClick();
} else {
customButton.handleClick();
}
return;
}
if (e.getClickCount() > 1) {
// else
if (SwingUtilities.isRightMouseButton(e)) {
// toggleViewMode();
cycleViewMode();
return;
}
}
Point point = e.getPoint();
HT_Node node = null;
for (Rectangle rect : tree.getMap().getMouseMap().keySet()) {
if (rect.contains(point)) {
node = tree.getMap().getMouseMap().get(rect);
break;
}
}
if (node == null) {
handleSpecialClick(e);
return;
}
ObjType type = node.getValue();
if (CoreEngine.isArcaneVault()) {
// ARCANE VAULT ARCANE VAULT ARCANE VAULT
if (e.isControlDown()) {
Boolean vertical_horizontal_manual = null;
// if (e.isShiftDown())
// vertical_horizontal_manual =
// SwingUtilities.isRightMouseButton(e);
adjustLink(vertical_horizontal_manual, node);
return;
} else {
if (e.isAltDown()) {
editDefaultProp(type);
} else if (e.isShiftDown()) {
if (TreeControlPanel.setProp(e.isAltDown(), type)) {
rebuildAndSetTree();
}
return;
}
}
if (e.getClickCount() > 1) {
if (!SwingUtilities.isRightMouseButton(e)) {
editImage(type);
}
// if (e.isAltDown()) {
// editDefaultProp(type);
// } else {
// editImage(type);
// return;
// }
ID_OPERATION operation = null;
if (SwingUtilities.isRightMouseButton(e)) {
operation = ID_OPERATION.SWAP;
} else {
// TODO
}
if (operation != null) {
adjustIds(operation, DataManager.getSublings(type, tree.getTypes()));
return;
}
}
// NON-AV
} else if (e.isAltDown() || e.getClickCount() > 1) {
boolean result = CharacterCreator.getHeroManager().addItem(hero, type, getTYPE(), getPROP());
if (result) {
added(type);
} else {
DC_SoundMaster.playStandardSound(STD_SOUNDS.CLICK_BLOCKED);
getTree().setDisplayRequirements(true);
}
}
select(node, type);
// node.refresh();
}
use of eidolons.swing.components.buttons.CustomButton in project Eidolons by IDemiurge.
the class StatsControlComponent method initYesNoButtons.
protected void initYesNoButtons() {
okButton = new CustomButton(VISUALS.OK) {
@Override
public void handleClick() {
// TODO enabled?
OK();
playClickSound();
}
};
cancelButton = new CustomButton(VISUALS.CANCEL) {
@Override
public void handleClick() {
// TODO dt flag for enabled()?
resetHero();
playDisabledSound();
}
};
cancelButton.activateMouseListener();
}
Aggregations