New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI Improvements, prep work for adding in Errata Items to repository #164
Changes from 8 commits
024ad71
3f73185
3f46de2
ccebc8c
a86b55f
e43717b
a980eb7
e415da0
f591e47
5956c27
62dc5de
21c00e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"statsByRuleSet": { | ||
"SecondEdition": [ | ||
{ | ||
"accuracy": 1, | ||
"damage": 4, | ||
"damageTypeString": "Lethal", | ||
"defence": -1, | ||
"rate": 2, | ||
"speed": 1, | ||
"inflictsNoDamage": false, | ||
"tags": [], | ||
"minimumDamage": 1, | ||
"name": "Close", | ||
"type": "Melee Weapon" | ||
} | ||
] | ||
}, | ||
"description": "2E Core p366, 2.5 Errata p15", | ||
"name": "Chopping Sword", | ||
"collectionFactory": {}, | ||
"composition": "None", | ||
"cost": { | ||
"costType": "Resources", | ||
"costValue": 2 | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A single sample JSON item. I have the rest of the Errata items done, I just need to alter the build system to take them into account, then I'll add them into git. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and your (now removed) comment in the changelog, made me think: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be one way to handle distribution. I was envisioning just rolling them into the deployment process, so they'd just naturally appear in the I'm open to adding in the items if and only if the user has no existing database, but the only problem I see is that we still don't have an ordering system in place for bootjobs. So we can't rely on the |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package net.sf.anathema.character.equipment.item; | ||
|
||
import java.awt.Component; | ||
|
||
import net.disy.commons.swing.action.SmartAction; | ||
import net.sf.anathema.character.equipment.item.model.IEquipmentDatabaseManagement; | ||
import net.sf.anathema.character.equipment.item.view.IEquipmentDatabaseView; | ||
import net.sf.anathema.lib.control.objectvalue.IObjectValueChangedListener; | ||
import net.sf.anathema.framework.presenter.resources.PlatformUI; | ||
import net.sf.anathema.lib.gui.wizard.workflow.ICondition; | ||
import net.sf.anathema.lib.resources.IResources; | ||
|
||
public final class CopyEquipmentTemplateAction extends SmartAction { | ||
private static final long serialVersionUID = -2131791434827503585L; | ||
private final IEquipmentDatabaseManagement model; | ||
private final IResources resources; | ||
|
||
public CopyEquipmentTemplateAction(IResources resources, IEquipmentDatabaseManagement model) { | ||
super(new PlatformUI(resources).getCopyIcon()); | ||
this.resources = resources; | ||
this.model = model; | ||
model.getTemplateEditModel().getDescription().getName().addTextChangedListener(new IObjectValueChangedListener<String>() { | ||
public void valueChanged(String newValue) { | ||
setEnabled(true); | ||
} | ||
}); | ||
setEnabled(true); | ||
setToolTipText(resources.getString("Equipment.Creation.Item.CopyActionTooltip")); //$NON-NLS-1$ | ||
} | ||
|
||
@Override | ||
protected void execute(Component parentComponent) { | ||
DiscardChangesVetor vetor = new DiscardChangesVetor(resources, new ICondition() { | ||
public boolean isFulfilled() { | ||
return model.getTemplateEditModel().isDirty(); | ||
} | ||
}, parentComponent); | ||
if (vetor.vetos()) { | ||
return; | ||
} | ||
model.getTemplateEditModel().copyNewTemplate(); | ||
setEnabled(false); | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New button to allow copying of an item in the equipment database. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ public void valueChanged(String newValue) { | |
} | ||
}); | ||
updateEnabled(view.getTemplateListView().getSelectedObject()); | ||
setToolTipText(resources.getString("Equipment.Creation.Item.RemoveActionTooltip")); //$NON-NLS-1$ | ||
} | ||
|
||
private void updateEnabled(String string) { | ||
|
@@ -38,7 +39,7 @@ private void updateEnabled(String string) { | |
|
||
@Override | ||
protected void execute(Component parentComponent) { | ||
String messageText = resources.getString("Equipment.Creation.DeleteMessage.Text"); //$NON-NLS-1$ | ||
String messageText = model.getTemplateEditModel().getEditTemplateId() + " - " + resources.getString("Equipment.Creation.DeleteMessage.Text"); //$NON-NLS-1$ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the name of the item you're deleting to the text in the popup box. |
||
String okText = resources.getString("Equipment.Creation.DeleteMessage.OKButton"); //$NON-NLS-1$ | ||
ConfigurableVetor vetor = new ConfigurableVetor(parentComponent, messageText, okText); | ||
if (vetor.vetos()) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,11 @@ Equipment.Creation.Stats=Stats | |
Equipment.Creation.Stats.AddActionTooltip=Add new stats | ||
Equipment.Creation.Stats.EditActionTooltip=Edit selected stats | ||
|
||
Equipment.Creation.Item.NewActionTooltip=Create new item | ||
Equipment.Creation.Item.CopyActionTooltip=Copy this item | ||
Equipment.Creation.Item.SaveActionTooltip=Save this item | ||
Equipment.Creation.Item.RemoveActionTooltip=Delete this item | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New tooltips! |
||
|
||
Equipment.Creation.UnsavedChangesMessage.Text=You have unsaved changes. Discard them? | ||
Equipment.Creation.UnsavedChangesMessage.OKButton=Discard changes | ||
Equipment.Creation.OverwriteMessage.Text=Really overwrite existing item? | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ public String[] getAllAvailableTemplateIds() { | |
|
||
@Override | ||
public IEquipmentTemplate loadTemplate(String templateId) { | ||
String id = new FilenameCleaner().clean(templateId); | ||
String id = cleanFilename(templateId); | ||
if (!access.exists(id)) { | ||
return null; | ||
} | ||
|
@@ -73,6 +73,12 @@ public void saveTemplate(IEquipmentTemplate template) { | |
availableTemplatesChangeControl.fireChangedEvent(); | ||
} | ||
|
||
public void saveTemplateNoOverwrite(IEquipmentTemplate template) { | ||
if( loadTemplate( template.getName() ) == null ) { | ||
saveTemplate( template ); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used only by the JSON conversion bootjob, just makes sure not to overwrite an existing item. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so the bootjob doesn't overwrite extracted-and-modified items when the user puts another .yap database into the folder, while the bootjob still relies on the version stored in the database file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intent is that during the bootjob process, after its loaded The idea was to add in all the 2.5 Errata items into git, and into the build process, so they'd extract during install to the See my comment at the end for more discussion on how to handle these 2.5 items. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While this is no longer necessary for handling overwriting of "default" items, I'd keep this in here simply because it handles an edge case: The user drops in somebody's |
||
@Override | ||
public void addAvailableTemplateChangeListener(IChangeListener listener) { | ||
availableTemplatesChangeControl.addChangeListener(listener); | ||
|
@@ -92,21 +98,25 @@ public void updateTemplate(String editTemplateId, IEquipmentTemplate saveTemplat | |
} | ||
|
||
private void delete(String editTemplateId) { | ||
String id = new FilenameCleaner().clean(editTemplateId); | ||
String id = cleanFilename(editTemplateId); | ||
if (access.exists(id)) { | ||
access.delete(id); | ||
} | ||
} | ||
|
||
private IEquipmentTemplate loadExistingTemplate(String templateId) { | ||
String id = new FilenameCleaner().clean(templateId); | ||
String id = cleanFilename(templateId); | ||
String json = access.read(id); | ||
return gson.fromJson(json); | ||
} | ||
|
||
private void save(IEquipmentTemplate template) { | ||
String id = new FilenameCleaner().clean(template.getName()); | ||
String id = cleanFilename(template.getName()); | ||
String json = gson.toJson(template); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are static to avoid excess object creation. |
||
access.write(id, json); | ||
} | ||
|
||
private String cleanFilename(String input) { | ||
return input.replaceAll("\\W", "_"); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My replacement for the |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package net.sf.anathema.character.equipment.impl.module; | ||
|
||
import net.sf.anathema.framework.IAnathemaModel; | ||
import net.sf.anathema.framework.presenter.toolbar.IAnathemaTool; | ||
import net.sf.anathema.framework.view.toolbar.IAnathemaToolbar; | ||
import net.sf.anathema.initialization.Tool; | ||
import net.sf.anathema.lib.resources.IResources; | ||
import net.sf.anathema.platform.database.StartDatabaseAction; | ||
|
||
@Tool | ||
public class StartEquipmentDatabaseTool implements IAnathemaTool { | ||
|
||
public void add(IResources resources, IAnathemaModel model, IAnathemaToolbar toolbar) { | ||
toolbar.addSeparator(); | ||
EquipmentDatabaseActionProperties properties = new EquipmentDatabaseActionProperties(resources, model); | ||
toolbar.addTools(StartDatabaseAction.createToolAction(resources, model, properties)); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm honestly not sure why nobody ever wrote this class. The backend work was mostly good to go, it just needed a tool action to add the Equipment Database to the toolbar. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had tried to do so once before, but was thrown off when the resulting button appeared to the left of new/load/save functions, which looks a bit unnatural. We'd briefly discussed adding some means of determining sorting or priority, which I'd planned to look at eventually. I suppose it doesn't really hurt to do now, though. :) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ private void configureActionIcons(Action action) { | |
|
||
Image image = new BufferedImage(width, height, Transparency.TRANSLUCENT); | ||
Graphics2D graphics = (Graphics2D) image.getGraphics(); | ||
Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f); | ||
Composite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .8f); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the toolbar so much more readable. I got really tired of mousing over toolbar icons to be able to figure out what's greyed out and what's actually usable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, the more brilliant look helps a long way. |
||
graphics.setComposite(alpha); | ||
graphics.drawImage(rolloverIcon.getImage(), 0, 0, null); | ||
graphics.dispose(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep in mind that .gitignore just keeps stuff from getting picked up by
git status
or your gui tool. You can still explicitly add anything ignored here into git by usinggit add
.