forked from jverein/jverein
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gesamtsumme in Sollbuchungen View (#252)
- Loading branch information
1 parent
e27dc5f
commit 0e14327
Showing
3 changed files
with
114 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/de/jost_net/JVerein/gui/parts/SollbuchungListTablePart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/********************************************************************** | ||
* Copyright (c) by Heiner Jostkleigrewe | ||
* This program is free software: you can redistribute it and/or modify it under the terms of the | ||
* GNU General Public License as published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
* the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
* [email protected] | ||
* www.jverein.de | ||
**********************************************************************/ | ||
|
||
package de.jost_net.JVerein.gui.parts; | ||
|
||
import java.rmi.RemoteException; | ||
import java.util.List; | ||
|
||
import de.jost_net.JVerein.Einstellungen; | ||
import de.jost_net.JVerein.rmi.Mitgliedskonto; | ||
import de.willuhn.datasource.GenericIterator; | ||
import de.willuhn.jameica.gui.Action; | ||
import de.willuhn.jameica.gui.parts.TablePart; | ||
import de.willuhn.jameica.gui.parts.table.Feature; | ||
import de.willuhn.jameica.gui.parts.table.Feature.Context; | ||
import de.willuhn.jameica.gui.parts.table.FeatureSummary; | ||
|
||
public class SollbuchungListTablePart extends TablePart | ||
{ | ||
|
||
public SollbuchungListTablePart(Action action) | ||
{ | ||
super(action); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
public SollbuchungListTablePart(GenericIterator mitgliedskonten, Action action) | ||
{ | ||
super(mitgliedskonten, action); | ||
} | ||
|
||
/** | ||
* Belegt den Context mit dem anzuzeigenden Text. | ||
* Ersetzt getSummary() welches deprecated ist. | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
@Override | ||
protected Context createFeatureEventContext(Feature.Event e, Object data) | ||
{ | ||
Context ctx = super.createFeatureEventContext(e, data); | ||
if (this.hasEvent(FeatureSummary.class,e)) | ||
{ | ||
double sumBetrag = 0.0; | ||
String summary = ""; | ||
try | ||
{ | ||
@SuppressWarnings("rawtypes") | ||
List l = this.getItems(); | ||
summary = new String(l.size() + " Datensätze"); | ||
for (int i = 0; i < l.size(); i++) | ||
{ | ||
Mitgliedskonto b = (Mitgliedskonto) l.get(i); | ||
sumBetrag += b.getBetrag(); | ||
} | ||
summary += " / " + "Gesamtbetrag:" + " " | ||
+ Einstellungen.DECIMALFORMAT.format(sumBetrag) + " " | ||
+ Einstellungen.CURRENCY; | ||
} | ||
catch (RemoteException re) | ||
{ | ||
// nichts tun | ||
} | ||
ctx.addon.put(FeatureSummary.CTX_KEY_TEXT,summary); | ||
} | ||
return ctx; | ||
} | ||
|
||
} |