[ROSEV_JAMEICAPLUGIN]

- Add a button to save the HTML Donors List to a file.
- Improve capitalization of the donor's name.

svn path=/trunk/rosev_jameicaplugin/; revision=2312
This commit is contained in:
Colin Finck 2016-12-01 15:25:01 +00:00
parent a6fe71be8d
commit fa07947b8e
3 changed files with 35 additions and 4 deletions

View File

@ -6,7 +6,7 @@ Amount=Betrag
Anonymous=Anonym
Close=Schließen
Comment=Kommentar
Copy\ to\ clipboard=In die Zwischenablage kopieren
Copy=Kopieren
Currency\ Code=Währungscode
Date=Datum
Delete=Löschen

View File

@ -14,12 +14,15 @@ import de.willuhn.jameica.gui.dialogs.AbstractDialog;
import de.willuhn.jameica.gui.parts.ButtonArea;
import de.willuhn.jameica.gui.util.Color;
import de.willuhn.util.ApplicationException;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Text;
import org.reactos.ev.jameicaplugin.JameicaPlugin;
import org.reactos.ev.jameicaplugin.formatter.HTMLFormatter;
@ -47,18 +50,45 @@ public class HTMLOutput extends AbstractDialog<Object>
text.setText(formatter.format(donationList));
ButtonArea buttons = new ButtonArea();
buttons.addButton(" " + JameicaPlugin.i18n().tr("Copy to clipboard") + " ", new Action()
buttons.addButton(" " + JameicaPlugin.i18n().tr("Copy") + " ", new Action()
{
@Override
public void handleAction(Object context) throws ApplicationException
{
Clipboard cb = new Clipboard(GUI.getDisplay());
final Clipboard cb = new Clipboard(GUI.getDisplay());
cb.setContents(new Object[]
{ text.getText() }, new Transfer[]
{ TextTransfer.getInstance() });
}
});
buttons.addButton(" " + JameicaPlugin.i18n().tr("Save") + "... ", new Action()
{
@Override
public void handleAction(Object context) throws ApplicationException
{
final FileDialog fd = new FileDialog(GUI.getShell(), SWT.SAVE);
fd.setFileName("html-output.txt");
fd.setFilterExtensions(new String[]
{ "*.txt" });
fd.setOverwrite(false);
final String f = fd.open();
if (f == null || f.length() == 0)
return;
try
{
final PrintWriter pw = new PrintWriter(f);
pw.write(text.getText());
pw.close();
}
catch (FileNotFoundException e)
{
}
}
});
buttons.addButton(" " + JameicaPlugin.i18n().tr("Close") + " ", new Action()
{
@Override
public void handleAction(Object context) throws ApplicationException
{
close();

View File

@ -169,7 +169,8 @@ public class Transaction implements GenericObject
name = unidecode(name);
// Capitalize each word of the name.
this.name = WordUtils.capitalizeFully(name);
this.name = WordUtils.capitalizeFully(name, new char[]
{ ' ', '-', '.', ',' });
}
public void setAnonymous(Boolean anonymous)