Skip to content

Commit

Permalink
Add filter in KontoAuswahlDialof (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannMaierhofer authored Jan 6, 2024
1 parent 0f660d3 commit 74c0171
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/de/jost_net/JVerein/gui/control/BuchungsControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public DialogInput getSuchKonto() throws RemoteException
}
String kontoid = settings.getString("suchkontoid", "");
suchkonto = new KontoauswahlInput().getKontoAuswahl(true, kontoid, false,
false);
true);
suchkonto.addListener(new FilterListener());
return suchkonto;
}
Expand Down
27 changes: 24 additions & 3 deletions src/de/jost_net/JVerein/gui/dialogs/KontoAuswahlDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@
package de.jost_net.JVerein.gui.dialogs;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import de.jost_net.JVerein.gui.parts.KontoList;
import de.jost_net.JVerein.rmi.Konto;
import de.willuhn.jameica.gui.Action;
import de.willuhn.jameica.gui.dialogs.AbstractDialog;
import de.willuhn.jameica.gui.parts.ButtonArea;
import de.willuhn.jameica.gui.parts.table.FeatureSummary;
import de.willuhn.jameica.gui.util.LabelGroup;
import de.willuhn.jameica.gui.input.CheckboxInput;
import de.willuhn.jameica.system.OperationCanceledException;

/**
Expand All @@ -43,6 +47,10 @@ public class KontoAuswahlDialog extends AbstractDialog<Konto>
private boolean nurHibiscus;

private boolean nurAktuelleKonten;

private CheckboxInput box = null;

private KontoList konten = null;

/**
* Dialog zur Kontenauswahl
Expand All @@ -66,10 +74,23 @@ public KontoAuswahlDialog(int position, boolean keinkonto,
protected void paint(Composite parent) throws Exception
{
LabelGroup group = new LabelGroup(parent, "Verfügbare Konten");
box = new CheckboxInput(nurAktuelleKonten);
box.addListener(new Listener()
{
public void handleEvent(Event event)
{
nurAktuelleKonten = (Boolean) box.getValue();
try
{
konten.update(nurHibiscus, nurAktuelleKonten);
} catch (Exception e) {}
}
});
group.addCheckbox(box, i18n.tr("Nur aktive Konten"));

if (text == null || text.length() == 0)
{
text = "Bitte wählen Sie das gewünschte Konto aus.";
text = " Bitte wählen Sie das gewünschte Konto aus.";
}
group.addText(text, true);

Expand All @@ -92,11 +113,11 @@ public void handleAction(Object context)
close();
}
};
final KontoList konten = new de.jost_net.JVerein.gui.parts.KontoList(a,
konten = new de.jost_net.JVerein.gui.parts.KontoList(a,
nurHibiscus, nurAktuelleKonten);
konten.setContextMenu(null);
konten.setMulti(false);
konten.setSummary(false);
konten.removeFeature(FeatureSummary.class);
konten.paint(parent);

ButtonArea b = new ButtonArea();
Expand Down
17 changes: 17 additions & 0 deletions src/de/jost_net/JVerein/gui/parts/KontoList.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ public synchronized void paint(Composite parent) throws RemoteException
super.paint(parent);
}

/**
* Update Konten-Liste nach neuen Kriterien.
*
* @param onlyHibiscus, nurAktuelleKonten
* @throws RemoteException
*/
public synchronized void update(boolean onlyHibiscus,
boolean nurAktuelleKonten) throws RemoteException
{
super.removeAll();
DBIterator<Konto> i = init(onlyHibiscus, nurAktuelleKonten);
while (i.hasNext())
{
super.addItem(i.next());
}
}

/**
* Initialisiert die Konten-Liste.
*
Expand Down

0 comments on commit 74c0171

Please sign in to comment.