From 920b16e17503bb4a443b568c0f684a504edf72ab Mon Sep 17 00:00:00 2001 From: Johann Maierhofer <126261667+JohannMaierhofer@users.noreply.github.com> Date: Sun, 29 Sep 2024 10:00:58 +0200 Subject: [PATCH] =?UTF-8?q?Submen=C3=BC=20f=C3=BCr=20freie=20Formulare=20(?= =?UTF-8?q?#332)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Submenü für freie Formulare * Iterator übergeben --- .../JVerein/gui/menu/FreieFormulareMenu.java | 42 +++++++++++++++++++ .../JVerein/gui/menu/MitgliedMenu.java | 14 +++---- 2 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 src/de/jost_net/JVerein/gui/menu/FreieFormulareMenu.java diff --git a/src/de/jost_net/JVerein/gui/menu/FreieFormulareMenu.java b/src/de/jost_net/JVerein/gui/menu/FreieFormulareMenu.java new file mode 100644 index 000000000..4b0815e5c --- /dev/null +++ b/src/de/jost_net/JVerein/gui/menu/FreieFormulareMenu.java @@ -0,0 +1,42 @@ +/********************************************************************** + * 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 . + * + * heiner@jverein.de + * www.jverein.de + **********************************************************************/ +package de.jost_net.JVerein.gui.menu; + +import java.rmi.RemoteException; + +import de.jost_net.JVerein.gui.action.FreiesFormularAction; +import de.jost_net.JVerein.rmi.Formular; +import de.willuhn.datasource.rmi.DBIterator; +import de.willuhn.jameica.gui.parts.CheckedContextMenuItem; +import de.willuhn.jameica.gui.parts.ContextMenu; + +/** + * Kontext-Menu zu den Mails. + */ +public class FreieFormulareMenu extends ContextMenu +{ + + public FreieFormulareMenu(DBIterator it) throws RemoteException + { + while (it.hasNext()) + { + Formular f = (Formular) it.next(); + addItem(new CheckedContextMenuItem(f.getBezeichnung(), + new FreiesFormularAction(f.getID()), "file-invoice.png")); + } + } +} diff --git a/src/de/jost_net/JVerein/gui/menu/MitgliedMenu.java b/src/de/jost_net/JVerein/gui/menu/MitgliedMenu.java index 28c45ab6d..154d7b477 100644 --- a/src/de/jost_net/JVerein/gui/menu/MitgliedMenu.java +++ b/src/de/jost_net/JVerein/gui/menu/MitgliedMenu.java @@ -22,7 +22,6 @@ import de.jost_net.JVerein.Einstellungen; import de.jost_net.JVerein.gui.action.NichtMitgliedDetailAction; -import de.jost_net.JVerein.gui.action.FreiesFormularAction; import de.jost_net.JVerein.gui.action.KontoauszugAction; import de.jost_net.JVerein.gui.action.MitgliedArbeitseinsatzZuordnungAction; import de.jost_net.JVerein.gui.action.MitgliedDeleteAction; @@ -111,7 +110,7 @@ public void handleAction(Object context) throws ApplicationException throw new ApplicationException(e); } } - }, "arrows-alt-h.png")); + }, "view-refresh.png")); } else { @@ -170,7 +169,7 @@ public void handleAction(Object context) throws ApplicationException throw new ApplicationException(e); } } - }, "arrows-alt-h.png")); + }, "view-refresh.png")); } if (detailaction instanceof NichtMitgliedDetailAction) { @@ -212,11 +211,12 @@ public void handleAction(Object context) throws ApplicationException .createList(Formular.class); it.addFilter("art = ?", new Object[] { FormularArt.FREIESFORMULAR.getKey() }); - while (it.hasNext()) + if (it.hasNext()) { - Formular f = (Formular) it.next(); - addItem(new CheckedContextMenuItem(f.getBezeichnung(), - new FreiesFormularAction(f.getID()), "file-invoice.png")); + addItem(ContextMenuItem.SEPARATOR); + ContextMenu freieformularemenu = new FreieFormulareMenu(it); + freieformularemenu.setText("Freie Formulare"); + addMenu(freieformularemenu); } } }