PageRenderTime 3ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/src/mpv5/ui/menus/FavouritesMenuItem.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 50 lines | 23 code | 7 blank | 20 comment | 0 complexity | 4714bedf89ff7dd992ee828f65cd71db MD5 | raw file
Possible License(s): LGPL-3.0, Apache-2.0, GPL-3.0, GPL-2.0, AGPL-3.0, JSON, BSD-3-Clause
  1. /*
  2. * This file is part of YaBS.
  3. *
  4. * YaBS is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * YaBS is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with YaBS. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package mpv5.ui.menus;
  18. import javax.swing.JMenuItem;
  19. import mpv5.db.common.DatabaseObject;
  20. import mpv5.ui.frames.MPView;
  21. /**
  22. *
  23. *
  24. */
  25. public class FavouritesMenuItem extends JMenuItem {
  26. private static final long serialVersionUID = 1L;
  27. private DatabaseObject item;
  28. public FavouritesMenuItem(final DatabaseObject dbo) {
  29. this.item = dbo;
  30. this.setText(dbo.__getCname());
  31. this.setIcon(dbo.getIcon());
  32. addActionListener(new java.awt.event.ActionListener() {
  33. public void actionPerformed(java.awt.event.ActionEvent evt) {
  34. mpv5.YabsViewProxy.instance().getIdentifierView().addTab(item);
  35. }
  36. });
  37. }
  38. public FavouritesMenuItem(DatabaseObject dbo, String name) {
  39. this.item = dbo;
  40. this.setText(name);
  41. this.setIcon(dbo.getIcon());
  42. }
  43. }