Skip to content

Commit

Permalink
Refactored icon handling for characters
Browse files Browse the repository at this point in the history
  • Loading branch information
UrsKR committed Aug 10, 2006
1 parent 16b4103 commit f0cd7ad
Show file tree
Hide file tree
Showing 39 changed files with 36 additions and 190 deletions.
Binary file removed Character_Abyssal/resources/icons/AbyssalButton16.png
Binary file not shown.
Binary file removed Character_Db/resources/icons/TerrestrialButton16.png
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import javax.swing.Icon;

import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.lib.resources.AbstractUI;
import net.sf.anathema.lib.resources.IResources;

public class CharacterUI extends AbstractUI {

public CharacterUI(IResources resources) {
super(resources);
}
Expand Down Expand Up @@ -38,4 +38,16 @@ public Icon getCancelComboEditIcon() {
public Icon getFinalizeIcon() {
return getIcon("ButtonCheck16.png"); //$NON-NLS-1$
}

public Icon getSmallTypeIcon(CharacterType characterType) {
return getIcon(characterType.name() + "Icon16.png"); //$NON-NLS-1$
}

public Icon getMediumBallResource(CharacterType characterType) {
return getIcon("Border" + characterType.name() + "Button16.png"); //$NON-NLS-1$ //$NON-NLS-2$
}

public Icon getUnselectedBallResource() {
return getIcon("BorderUnselectedButton16.png"); //$NON-NLS-1$
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import net.sf.anathema.character.generic.additionaltemplate.IAdditionalModel;
import net.sf.anathema.character.generic.framework.additionaltemplate.IAdditionalViewFactory;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.character.intimacies.presenter.IntimaciesPresenter;
Expand All @@ -30,7 +29,7 @@ public String getToolTipText() {
return resources.getString("Intimacies.LockButton.Tooltip"); //$NON-NLS-1$
}
};
Icon ballResource = new CharacterTemplateResourceProvider(resources).getMediumBallResource(type);
Icon ballResource = new CharacterUI(resources).getMediumBallResource(type);
IntimaciesView view = new IntimaciesView(new IntValueDisplayFactory(resources, ballResource), properties);
new IntimaciesPresenter(((IIntimaciesAdditionalModel) model).getIntimaciesModel(), model, view, resources).initPresentation();
return view;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javax.swing.Icon;

import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.framework.value.IIntValueDisplay;
import net.sf.anathema.lib.resources.IResources;

Expand All @@ -13,7 +13,7 @@ public class IntValueDisplayFactory implements IIntValueDisplayFactory {

public IntValueDisplayFactory(IResources resources, Icon ballIcon) {
this.activeBallIcon = ballIcon;
this.passiveBallIcon = new CharacterTemplateResourceProvider(resources).getUnselectedBallResource();
this.passiveBallIcon = new CharacterUI(resources).getUnselectedBallResource();
}

public IIntValueDisplay createIntValueDisplay(int maxValue, int value) {
Expand Down
Binary file removed Character_Lunar/resources/icons/LunarButton16.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.sf.anathema.character.generic.additionaltemplate.IAdditionalModel;
import net.sf.anathema.character.generic.framework.additionaltemplate.IAdditionalViewFactory;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.character.library.intvalue.IntValueDisplayFactory;
import net.sf.anathema.character.lunar.beastform.presenter.BeastformPresenter;
Expand All @@ -17,7 +17,7 @@ public class BeastformViewFactory implements IAdditionalViewFactory {
public ISimpleTabView createView(IAdditionalModel model, final IResources resources, CharacterType type) {
IntValueDisplayFactory intValueDisplayFactory = new IntValueDisplayFactory(
resources,
new CharacterTemplateResourceProvider(resources).getMediumBallResource(type));
new CharacterUI(resources).getMediumBallResource(type));
BeastformView view = new BeastformView(intValueDisplayFactory, new IBeastformViewProperties() {
public String getCharmString() {
return resources.getString("Lunar.DeadlyBeastmanTransformation"); //$NON-NLS-1$
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.swing.Icon;

import net.sf.anathema.character.generic.IBasicCharacterData;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.template.presentation.IPresentationProperties;
import net.sf.anathema.character.library.intvalue.IIconToggleButtonProperties;
import net.sf.anathema.character.library.trait.favorable.FavorableState;
Expand Down Expand Up @@ -36,7 +36,7 @@ public Icon createStandardIcon() {
if (ability.getFavorization().isCaste()) {
return casteUI.getSmallCasteIcon(ability.getFavorization().getCaste());
}
return new CharacterTemplateResourceProvider(resources).getMediumBallResource(context.getCharacterType());
return new CharacterUI(resources).getMediumBallResource(context.getCharacterType());
}

public Icon createUnselectedIcon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.sf.anathema.character.generic.framework.ICharacterGenerics;
import net.sf.anathema.character.generic.framework.ICharacterGenericsExtension;
import net.sf.anathema.character.generic.framework.configuration.AnathemaCharacterPreferences;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.rules.IExaltedRuleSet;
import net.sf.anathema.character.generic.type.CharacterType;
Expand Down Expand Up @@ -86,8 +85,8 @@ public IItemView createView(IItem item) throws AnathemaException {
.getCharacterType();
IntValueDisplayFactory intValueDisplayFactory = new IntValueDisplayFactory(
resources,
new CharacterTemplateResourceProvider(resources).getMediumBallResource(characterType));
final Icon typeIcon = new CharacterTemplateResourceProvider(resources).getSmallTypeIcon(characterType);
characterUI.getMediumBallResource(characterType));
final Icon typeIcon = characterUI.getSmallTypeIcon(characterType);
ICharacterView characterView = new CharacterView(intValueDisplayFactory, printName, typeIcon);
IBonusPointManagement bonusPointManagement = new BonusPointManagement(character.getStatistics());
IExperiencePointManagement experiencePointManagement = new ExperiencePointManagement(character.getStatistics());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.disy.commons.core.message.BasicMessage;
import net.disy.commons.core.message.IBasicMessage;
import net.disy.commons.core.message.MessageType;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.character.view.repository.ITemplateTypeAggregation;
import net.sf.anathema.framework.view.IdentificateSelectCellRenderer;
Expand All @@ -19,11 +19,11 @@
public class CharacterCreationPageProperties {

private final IResources resources;
private CharacterTemplateResourceProvider iconProvider;
private final CharacterUI iconProvider;

public CharacterCreationPageProperties(IResources resources) {
this.resources = resources;
this.iconProvider = new CharacterTemplateResourceProvider(resources);
this.iconProvider = new CharacterUI(resources);
}

public String getDescription() {
Expand Down
1 change: 1 addition & 0 deletions Character_Mortal/.classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/Character_Reporting"/>
<classpathentry kind="output" path="build/classes"/>
Expand Down
Binary file not shown.
Binary file removed Character_Sidereal/resources/icons/SiderealButton16.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.swing.Icon;

import net.sf.anathema.character.generic.framework.additionaltemplate.listening.DedicatedCharacterChangeAdapter;
import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.character.library.intvalue.IIconToggleButtonProperties;
import net.sf.anathema.character.library.intvalue.IIntValueDisplayFactory;
Expand Down Expand Up @@ -45,7 +45,7 @@ public void initPresentation() {
final IValueView<Integer> experienceView = experienceOverview.addIntegerValueView(
resources.getString("Astrology.Overview.Experience"), 3); //$NON-NLS-1$

Icon siderealBall = new CharacterTemplateResourceProvider(resources).getMediumBallResource(CharacterType.SIDEREAL);
Icon siderealBall = new CharacterUI(resources).getMediumBallResource(CharacterType.SIDEREAL);
IIntValueDisplayFactory factory = new IntValueDisplayFactory(resources, siderealBall);
for (final IAstrologicalHouse house : model.getAllHouses()) {
view.startGroup(resources.getString("AstrologicalHouses.GroupLabel." + house.getId())); //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import javax.swing.Icon;

import net.sf.anathema.character.generic.impl.IIconConstants;
import net.sf.anathema.character.sidereal.caste.ISiderealCasteVisitor;
import net.sf.anathema.character.sidereal.caste.SiderealCaste;
import net.sf.anathema.character.sidereal.colleges.presenter.IAstrologicalHouse;
import net.sf.anathema.lib.resources.AbstractUI;
Expand All @@ -16,29 +14,8 @@ public SiderealCasteUI(IResources resources) {
}

public Icon getCasteIcon(IAstrologicalHouse house) {
final String[] iconName = new String[1];
SiderealCaste caste = SiderealCaste.valueOf(house.getId());
caste.accept(new ISiderealCasteVisitor() {
public void visitJourneys(SiderealCaste journeys) {
iconName[0] = IIconConstants.SIDEREAL_JOURNEYSCASTE;
}

public void visitSerenity(SiderealCaste serenity) {
iconName[0] = IIconConstants.SIDEREAL_SERENITYCASTE;
}

public void visitBattles(SiderealCaste battles) {
iconName[0] = IIconConstants.SIDEREAL_BATTLESCASTE;
}

public void visitSecrets(SiderealCaste secrets) {
iconName[0] = IIconConstants.SIDEREAL_SECRETSCASTE;
}

public void visitEndings(SiderealCaste endings) {
iconName[0] = IIconConstants.SIDEREAL_ENDINGSCASTE;
}
});
return getIcon(iconName[0]);
String iconName = "SiderealButton" + caste.name() + "16.png"; //$NON-NLS-1$ //$NON-NLS-2$
return getIcon(iconName);
}
}
Binary file removed Character_Solar/resources/icons/SolarButton16.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.sf.anathema.charmentry.module;

import net.sf.anathema.character.generic.framework.resources.CharacterTemplateResourceProvider;
import net.sf.anathema.character.generic.framework.resources.CharacterUI;
import net.sf.anathema.character.generic.type.CharacterType;
import net.sf.anathema.character.library.intvalue.IIntValueDisplayFactory;
import net.sf.anathema.character.library.intvalue.IntValueDisplayFactory;
Expand Down Expand Up @@ -29,7 +29,9 @@ public class CharmEntryViewFactory implements ICharmEntryViewFactory {
private final IIntValueDisplayFactory factory;

public CharmEntryViewFactory(IResources resources) {
this.factory = new IntValueDisplayFactory(resources, new CharacterTemplateResourceProvider(resources).getMediumBallResource(CharacterType.MORTAL));
this.factory = new IntValueDisplayFactory(
resources,
new CharacterUI(resources).getMediumBallResource(CharacterType.MORTAL));
}

public IHeaderDataEntryView createHeaderDataEntryView() {
Expand Down
Loading

0 comments on commit f0cd7ad

Please sign in to comment.