List of usage examples for java.awt List add
public void add(String item)
From source file:op.care.med.structure.PnlMed.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.INSERT, internalClassID)) { final JideButton addButton = GUITools.createHyperlinkButton(MedProductWizard.internalClassID, SYSConst.icon22wizard, null); addButton.addActionListener(new ActionListener() { @Override//w ww .ja va 2s . co m public void actionPerformed(ActionEvent actionEvent) { final JidePopup popup = new JidePopup(); WizardDialog wizard = new MedProductWizard(new Closure() { @Override public void execute(Object o) { popup.hidePopup(); // keine Manahme ntig } }).getWizard(); popup.setMovable(false); popup.setPreferredSize((new Dimension(800, 450))); popup.setResizable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(wizard.getContentPane()); popup.setOwner(addButton); popup.removeExcludedComponent(addButton); popup.setTransient(false); popup.setDefaultFocusComponent(wizard.getContentPane()); popup.addPropertyChangeListener("visible", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { popup.getContentPane().getComponentCount(); } }); GUITools.showPopup(popup, SwingConstants.NORTH_EAST); } }); list.add(addButton); } // OPDE.debug("isCalcMediUPR1: " + OPDE.isCalcMediUPR1()); // // if (OPDE.isDebug()) { // Iterator it = OPDE.getProps().entrySet().iterator(); // while (it.hasNext()) { // OPDE.debug(it.next().toString()); // } // } if (OPDE.isCalcMediUPR1() && OPDE.getAppInfo().isAllowedTo(InternalClassACL.INSERT, internalClassID)) { JideButton buchenButton = GUITools.createHyperlinkButton("nursingrecords.inventory.newstocks", SYSConst.icon22addrow, new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgNewStocks(null); } }); list.add(buchenButton); } return list; }
From source file:op.care.values.PnlValues.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); JideButton controlButton = GUITools.createHyperlinkButton( SYSTools.xx("nursingrecords.vitalparameters.btnControlling.tooltip"), SYSConst.icon22magnify1, new ActionListener() { @Override// www . ja va 2s .co m public void actionPerformed(ActionEvent actionEvent) { if (!resident.isActive()) { OPDE.getDisplayManager() .addSubMessage(new DisplayMessage("misc.msg.cantChangeInactiveResident")); return; } new DlgValueControl(resident, new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Resident myResident = em.merge(resident); em.lock(myResident, LockModeType.OPTIMISTIC); myResident.setControlling((Properties) o); em.getTransaction().commit(); resident = myResident; } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } } }); } }); list.add(controlButton); return list; }
From source file:op.controlling.PnlControlling.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); if (tabMain.getSelectedIndex() == TAB_QMSPLAN) { if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) { JideButton addButton = GUITools.createHyperlinkButton(SYSTools.xx("misc.commands.new"), new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")), new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgQMSPlan(new Qmsplan(""), new Closure() { @Override public void execute(Object qmsplan) { if (qmsplan != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); final Qmsplan myQMSPlan = (Qmsplan) em.merge(qmsplan); em.getTransaction().commit(); // pnlQMSPlan.getListQMSPlans().add(myQMSPlan); pnlQMSPlan.reload(); prepareSearchArea(); } catch (OptimisticLockException ole) { OPDE.warn(ole); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } else { reload(); } } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } }/*from w w w . j a v a2 s . c om*/ } }); } }); list.add(addButton); } } return list; }
From source file:op.controlling.PnlControlling.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); if (tabMain.getSelectedIndex() == TAB_QMSPLAN) { final JToggleButton tbClosedOnes2 = GUITools .getNiceToggleButton(SYSTools.xx("misc.filters.showclosed")); ArrayList<Commontags> listTags = CommontagsTools.getAllUsedInQMSPlans(true); if (!listTags.isEmpty()) { JPanel pnlTags = new JPanel(); pnlTags.setLayout(new BoxLayout(pnlTags, BoxLayout.PAGE_AXIS)); pnlTags.setOpaque(false);/*from w ww . j a va2s . com*/ final JButton btnReset = GUITools.createHyperlinkButton("misc.commands.resetFilter", SYSConst.icon16tagPurpleDelete4, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // init = true; // tbClosedOnes2.setSelected(false); // init = false; // pnlQMSPlan.reload(); // // pnlQMSPlan.cleanup(); // pnlQMSPlan = new PnlQMSPlan(null); // tabMain.setComponentAt(TAB_QMSPLAN, pnlQMSPlan); filterTag = null; tbClosedOnes2.setSelected(false); } }); pnlTags.add(btnReset, RiverLayout.LEFT); for (final Commontags commontag : listTags) { final JButton btnTag = GUITools.createHyperlinkButton(commontag.getText(), SYSConst.icon16tagPurple, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // init = true; // tbClosedOnes2.setSelected(true); // init = false; // // pnlQMSPlan.cleanup(); // pnlQMSPlan = new PnlQMSPlan(null); // tabMain.setComponentAt(TAB_QMSPLAN, pnlQMSPlan); // //TODO: mark the filter when it is used. maybe a yellow background filterTag = commontag; tbClosedOnes2.setSelected(true); } }); pnlTags.add(btnTag); } list.add(pnlTags); } tbClosedOnes2.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { // if (init) return; pnlQMSPlan.reload(filterTag, itemEvent.getStateChange() == ItemEvent.SELECTED); } }); list.add(tbClosedOnes2); tbClosedOnes2.setHorizontalAlignment(SwingConstants.LEFT); } return list; }
From source file:op.users.PnlUser.java
private java.util.List<Component> addFilters() { java.util.List<Component> list = new ArrayList<Component>(); /***//from ww w . j a v a2 s . c om * _ _ ___ _ _ _ _ * | |_| |__ / _ \| | __| | | | |___ ___ _ __ ___ * | __| '_ \| | | | |/ _` | | | / __|/ _ \ '__/ __| * | |_| |_) | |_| | | (_| | |_| \__ \ __/ | \__ \ * \__|_.__/ \___/|_|\__,_|\___/|___/\___|_| |___/ * */ tbOldUsers = GUITools.getNiceToggleButton(SYSTools.xx("opde.users.showclosedmembers")); tbOldUsers.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent itemEvent) { if (initPhase) return; buildPanel(); } }); tbOldUsers.setHorizontalAlignment(SwingConstants.LEFT); list.add(tbOldUsers); return list; }
From source file:op.users.PnlUser.java
private java.util.List<Component> addCommands() { java.util.List<Component> list = new ArrayList<Component>(); /***//from ww w.jav a2s . c o m * _ _ _ _ _ * / \ __| | __| | | | |___ ___ _ __ * / _ \ / _` |/ _` | | | / __|/ _ \ '__| * / ___ \ (_| | (_| | |_| \__ \ __/ | * /_/ \_\__,_|\__,_|\___/|___/\___|_| * */ final JideButton btnAddUser = GUITools.createHyperlinkButton(SYSTools.xx("opde.users.btnAddUser"), SYSConst.icon22addUser, null); btnAddUser.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (tabMain.getSelectedIndex() != TAB_USER) { tabMain.setSelectedIndex(TAB_USER); } new DlgUser(new Users(), new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Users user = em.merge((Users) o); // Put everyone into >>everyone<< Groups everyone = em.find(Groups.class, "everyone"); em.lock(everyone, LockModeType.OPTIMISTIC); user.getGroups().add(everyone); everyone.getMembers().add(user); em.getTransaction().commit(); lstUsers.add(user); reloadDisplay(); } catch (Exception e) { em.getTransaction().rollback(); } finally { em.close(); } } } }); } }); list.add(btnAddUser); /*** * _ _ _ ____ * / \ __| | __| |/ ___|_ __ ___ _ _ _ __ * / _ \ / _` |/ _` | | _| '__/ _ \| | | | '_ \ * / ___ \ (_| | (_| | |_| | | | (_) | |_| | |_) | * /_/ \_\__,_|\__,_|\____|_| \___/ \__,_| .__/ * |_| */ final JideButton btnAddGroup = GUITools.createHyperlinkButton(SYSTools.xx("opde.users.btnAddGroup"), SYSConst.icon22addGroup, null); btnAddGroup.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (tabMain.getSelectedIndex() != TAB_GROUPS) { tabMain.setSelectedIndex(TAB_GROUPS); } new DlgGroup(new Groups(), new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); Groups myGroup = em.merge((Groups) o); em.getTransaction().commit(); createCP4(myGroup); lstGroups.add(myGroup); Collections.sort(lstGroups); buildPanel(); } catch (Exception e) { // em.getTransaction().rollback(); OPDE.fatal(e); } finally { em.close(); } } } }); } }); list.add(btnAddGroup); /*** * _ _ ____ _ _ * | |__ | |_ _ __ | _ \ _ __(_)_ __ | |_ * | '_ \| __| '_ \| |_) | '__| | '_ \| __| * | |_) | |_| | | | __/| | | | | | | |_ * |_.__/ \__|_| |_|_| |_| |_|_| |_|\__| * */ // JideButton btnPrint = GUITools.createHyperlinkButton(SYSTools.xx("misc.commands.print"), SYSConst.icon22print2, new ActionListener() { // @Override // public void actionPerformed(ActionEvent actionEvent) { // // } // }); // list.add(btnPrint); return list; }
From source file:org.isatools.isacreator.ontologyselectiontool.ViewTermDefinitionUI.java
private Map<String, String> sortMap(Map<String, String> toSort) { Map<String, String> sortedMap = new ListOrderedMap<String, String>(); if (toSort != null) { Set<String> keys = toSort.keySet(); java.util.List<String> sortedKeys = new ArrayList<String>(); for (String key : keys) { if (key != null) { sortedKeys.add(key); }/*from w w w . j a v a 2 s . c o m*/ } Collections.sort(sortedKeys); for (String key : sortedKeys) { sortedMap.put(key, toSort.get(key)); } } return sortedMap; }
From source file:org.photovault.swingui.framework.AbstractController.java
/** * Register an event listener that is being executed when an event is intercepted by this controller. * * @param eventClass The actual event class this listeners is interested in. * @param eventListener The listener implementation. *//*from w w w . ja v a 2 s. com*/ public void registerEventListener(Class eventClass, DefaultEventListener eventListener) { log.debug("Registering listener: " + eventListener + " for event type: " + eventClass.getName()); java.util.List<DefaultEventListener> listenersForEvent = eventListeners.get(eventClass); if (listenersForEvent == null) { listenersForEvent = new ArrayList<DefaultEventListener>(); } listenersForEvent.add(eventListener); eventListeners.put(eventClass, listenersForEvent); }
From source file:org.yccheok.jstock.gui.JStock.java
private void solveCaseSensitiveFoldersIssue() { final Country currentCountry = this.jStockOptions.getCountry(); final String currentWatchlist = this.jStockOptions.getWatchlistName(); final String currentPortfolio = this.jStockOptions.getPortfolioName(); //////////////////////////////////////////////////////////////////////// // WATCHLIST//from www. j a v a 2s.com //////////////////////////////////////////////////////////////////////// for (Country country : Country.values()) { java.util.List<String> watchlistNames = org.yccheok.jstock.watchlist.Utils.getWatchlistNames(country); Map<String, java.util.List<String>> watchlistNamesMap = new HashMap<String, java.util.List<String>>(); java.util.List<java.util.List<String>> duplicatedNames = new ArrayList<java.util.List<String>>(); Set<String> lowerCaseNames = new HashSet<String>(); for (String watchlistName : watchlistNames) { String lowerCaseWatchlistName = watchlistName.toLowerCase(); lowerCaseNames.add(lowerCaseWatchlistName); java.util.List<String> names = watchlistNamesMap.get(lowerCaseWatchlistName); if (names == null) { names = new ArrayList<String>(); watchlistNamesMap.put(lowerCaseWatchlistName, names); } names.add(watchlistName); if (names.size() > 1) { duplicatedNames.add(names); } } for (java.util.List<String> names : duplicatedNames) { int counter = 0; boolean originalNameUsed = false; for (int i = 0, ei = names.size(); i < ei; i++) { final String originalName = names.get(i); if (currentCountry == country && currentWatchlist.equals(originalName)) { originalNameUsed = true; continue; } String newName = originalName; if (originalNameUsed || i < (ei - 1)) { // Cannot use the original name. newName = originalName + counter++; while (lowerCaseNames.contains(newName.toLowerCase())) { newName = originalName + counter++; } lowerCaseNames.add(newName.toLowerCase()); } else { // Use original name. originalNameUsed = true; } String originalDirectory = org.yccheok.jstock.watchlist.Utils.getWatchlistDirectory(country, originalName); String newDirectory = org.yccheok.jstock.watchlist.Utils.getWatchlistDirectory(country, newName); if (false == originalDirectory.equalsIgnoreCase(newDirectory)) { new File(originalDirectory).renameTo(new File(newDirectory)); } } } } //////////////////////////////////////////////////////////////////////// // PORTFOLIO //////////////////////////////////////////////////////////////////////// for (Country country : Country.values()) { java.util.List<String> portfolioNames = org.yccheok.jstock.portfolio.Utils.getPortfolioNames(country); Map<String, java.util.List<String>> portfolioNamesMap = new HashMap<String, java.util.List<String>>(); java.util.List<java.util.List<String>> duplicatedNames = new ArrayList<java.util.List<String>>(); Set<String> lowerCaseNames = new HashSet<String>(); for (String portfolioName : portfolioNames) { String lowerCasePortfolioName = portfolioName.toLowerCase(); lowerCaseNames.add(lowerCasePortfolioName); java.util.List<String> names = portfolioNamesMap.get(lowerCasePortfolioName); if (names == null) { names = new ArrayList<String>(); portfolioNamesMap.put(lowerCasePortfolioName, names); } names.add(portfolioName); if (names.size() > 1) { duplicatedNames.add(names); } } for (java.util.List<String> names : duplicatedNames) { int counter = 0; boolean originalNameUsed = false; for (int i = 0, ei = names.size(); i < ei; i++) { final String originalName = names.get(i); if (currentCountry == country && currentPortfolio.equals(originalName)) { originalNameUsed = true; continue; } String newName = originalName; if (originalNameUsed || i < (ei - 1)) { // Cannot use the original name. newName = originalName + counter++; while (lowerCaseNames.contains(newName.toLowerCase())) { newName = originalName + counter++; } lowerCaseNames.add(newName.toLowerCase()); } else { // Use original name. originalNameUsed = true; } String originalDirectory = org.yccheok.jstock.portfolio.Utils.getPortfolioDirectory(country, originalName); String newDirectory = org.yccheok.jstock.portfolio.Utils.getPortfolioDirectory(country, newName); if (false == originalDirectory.equalsIgnoreCase(newDirectory)) { new File(originalDirectory).renameTo(new File(newDirectory)); } } } } }
From source file:org.yccheok.jstock.gui.JStock.java
private java.util.List<Pair<Code, Symbol>> loadUserDefinedDatabaseFromCSV(Country country) { final File userDefinedDatabaseCSVFile = new File(org.yccheok.jstock.gui.Utils.getUserDataDirectory() + country + File.separator + "database" + File.separator + "user-defined-database.csv"); Statements statements = Statements.newInstanceFromCSVFile(userDefinedDatabaseCSVFile); if (statements.getType() != Statement.Type.UserDefinedDatabase) { return new ArrayList<Pair<Code, Symbol>>(); }/*from w w w . jav a2 s .com*/ java.util.List<Pair<Code, Symbol>> pairs = new ArrayList<Pair<Code, Symbol>>(); for (int i = 0, ei = statements.size(); i < ei; i++) { Statement statement = statements.get(i); Atom atom0 = statement.getAtom(0); Atom atom1 = statement.getAtom(1); Code code = Code.newInstance(atom0.getValue().toString()); Symbol symbol = Symbol.newInstance(atom1.getValue().toString()); pairs.add(new Pair<Code, Symbol>(code, symbol)); } return pairs; }