List of usage examples for javax.swing BoxLayout LINE_AXIS
int LINE_AXIS
To view the source code for javax.swing BoxLayout LINE_AXIS.
Click Source Link
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/*from ww w. ja va2 s . c o 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.nursingprocess.DlgNursingProcess.java
private void btnAddInterventionActionPerformed(ActionEvent e) { /***//from w w w .j a v a 2 s . co m * _ _ _ _ _ * | |__ | |_ _ __ / \ __| | __| | * | '_ \| __| '_ \ / _ \ / _` |/ _` | * | |_) | |_| | | |/ ___ \ (_| | (_| | * |_.__/ \__|_| |_/_/ \_\__,_|\__,_| * */ final JidePopup popup = new JidePopup(); PnlSelectIntervention pnlSelectIntervention = new PnlSelectIntervention(new Closure() { @Override public void execute(Object o) { popup.hidePopup(); if (o != null) { for (Object obj : (Object[]) o) { Intervention intervention = (Intervention) obj; nursingProcess.getInterventionSchedule() .add(new InterventionSchedule(nursingProcess, intervention)); } reloadInterventions(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnAddIntervention); popup.removeExcludedComponent(btnAddIntervention); popup.getContentPane().add(pnlSelectIntervention); popup.setDefaultFocusComponent(pnlSelectIntervention); GUITools.showPopup(popup, SwingConstants.NORTH_WEST); }
From source file:op.care.nursingprocess.DlgNursingProcess.java
private void tblPlanungMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblPlanungMousePressed if (!SwingUtilities.isRightMouseButton(evt)) { return;//from www .j a v a 2s .c om } Point p = evt.getPoint(); ListSelectionModel lsm = tblPlanung.getSelectionModel(); int row = tblPlanung.rowAtPoint(p); if (lsm.isSelectionEmpty() || (lsm.getMinSelectionIndex() == lsm.getMaxSelectionIndex())) { lsm.setSelectionInterval(row, row); } menu = new JPopupMenu(); /*** * _ _ ____ ____ _ _ * (_) |_ ___ _ __ ___ | _ \ ___ _ __ _ _ _ __ | _ \ ___| | ___| |_ ___ * | | __/ _ \ '_ ` _ \| |_) / _ \| '_ \| | | | '_ \| | | |/ _ \ |/ _ \ __/ _ \ * | | || __/ | | | | | __/ (_) | |_) | |_| | |_) | |_| | __/ | __/ || __/ * |_|\__\___|_| |_| |_|_| \___/| .__/ \__,_| .__/|____/ \___|_|\___|\__\___| * |_| |_| */ JMenuItem itemPopupDelete = new JMenuItem(SYSTools.xx("misc.commands.delete"), SYSConst.icon22delete); itemPopupDelete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { for (int row : tblPlanung.getSelectedRows()) { listInterventionSchedule2Remove .add(((TMPlan) tblPlanung.getModel()).getInterventionSchedule(row)); nursingProcess.getInterventionSchedule() .remove(((TMPlan) tblPlanung.getModel()).getInterventionSchedule(row)); } ((TMPlan) tblPlanung.getModel()).fireTableDataChanged(); } }); menu.add(itemPopupDelete); /*** * _ _ ____ ____ _ _ _ * (_) |_ ___ _ __ ___ | _ \ ___ _ __ _ _ _ __/ ___| ___| |__ ___ __| |_ _| | ___ * | | __/ _ \ '_ ` _ \| |_) / _ \| '_ \| | | | '_ \___ \ / __| '_ \ / _ \/ _` | | | | |/ _ \ * | | || __/ | | | | | __/ (_) | |_) | |_| | |_) |__) | (__| | | | __/ (_| | |_| | | __/ * |_|\__\___|_| |_| |_|_| \___/| .__/ \__,_| .__/____/ \___|_| |_|\___|\__,_|\__,_|_|\___| * |_| |_| */ final JMenuItem itemPopupSchedule = new JMenuItem(SYSTools.xx("misc.commands.editsheduling"), SYSConst.icon22clock); itemPopupSchedule.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { final JidePopup popup = new JidePopup(); /** * This routine uses the <b>first</b> element of the selection as the template for editing * the schedule. After the edit it clones this "template", removes the original * InterventionSchedules (copying the apropriate Intervention of every single * Schedule first) and finally creates new schedules and adds them to * the CareProcess in question. */ int row = tblPlanung.getSelectedRows()[0]; InterventionSchedule firstInterventionScheduleWillBeTemplate = ((TMPlan) tblPlanung.getModel()) .getInterventionSchedule(row); JPanel dlg = new PnlSchedule(firstInterventionScheduleWillBeTemplate, new Closure() { @Override public void execute(Object o) { if (o != null) { InterventionSchedule template = (InterventionSchedule) o; ArrayList<InterventionSchedule> listInterventionSchedule2Add = new ArrayList(); for (int row : tblPlanung.getSelectedRows()) { InterventionSchedule oldTermin = ((TMPlan) tblPlanung.getModel()) .getInterventionSchedule(row); InterventionSchedule newTermin = template.clone(); newTermin.setIntervention(oldTermin.getIntervention()); listInterventionSchedule2Remove.add(oldTermin); listInterventionSchedule2Add.add(newTermin); } nursingProcess.getInterventionSchedule().removeAll(listInterventionSchedule2Remove); nursingProcess.getInterventionSchedule().addAll(listInterventionSchedule2Add); popup.hidePopup(); Collections.sort(nursingProcess.getInterventionSchedule()); ((TMPlan) tblPlanung.getModel()).fireTableDataChanged(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(jspPlanung); popup.removeExcludedComponent(jspPlanung); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.SOUTH_WEST); } }); menu.add(itemPopupSchedule); menu.show(evt.getComponent(), (int) p.getX(), (int) p.getY()); }
From source file:op.care.nursingprocess.PnlNursingProcess.java
private JPanel createNPPanel(final NursingProcess np) { /***// w ww .ja va 2s . c om * _ ____ ____ _ _ _ _ ____ * ___ _ __ ___ __ _| |_ ___ / ___| _ \| || | | \ | | _ \ * / __| '__/ _ \/ _` | __/ _ \ | | |_) | || |_ | \| | |_) | * | (__| | | __/ (_| | || __/ |___| __/|__ _| | |\ | __/ * \___|_| \___|\__,_|\__\___|\____|_| |_| |_| \_|_| * */ if (!contenPanelMap.containsKey(np)) { String title = "<html><table border=\"0\">"; if (!np.getCommontags().isEmpty()) { title += "<tr>" + " <td colspan=\"2\">" + CommontagsTools.getAsHTML(np.getCommontags(), SYSConst.html_16x16_tagPurple_internal) + "</td>" + " </tr>"; } title += "<tr valign=\"top\">" + "<td width=\"280\" align=\"left\">" + np.getPITAsHTML() + "</td>" + "<td width=\"500\" align=\"left\">" + (np.isClosed() ? "<s>" : "") + np.getContentAsHTML() + (np.isClosed() ? "</s>" : "") + "</td></tr>"; title += "</table>" + "</html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, null); cptitle.getButton().setVerticalTextPosition(SwingConstants.TOP); if (!np.getAttachedFilesConnections().isEmpty()) { /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = new JButton(Integer.toString(np.getAttachedFilesConnections().size()), SYSConst.icon22greenStar); btnFiles.setToolTipText(SYSTools.xx("misc.btnfiles.tooltip")); btnFiles.setForeground(Color.BLUE); btnFiles.setHorizontalTextPosition(SwingUtilities.CENTER); btnFiles.setFont(SYSConst.ARIAL18BOLD); btnFiles.setPressedIcon(SYSConst.icon22Pressed); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.setAlignmentY(Component.TOP_ALIGNMENT); btnFiles.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnFiles.setContentAreaFilled(false); btnFiles.setBorder(null); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Closure fileHandleClosure = np.isClosed() ? null : new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final NursingProcess myNP = em.find(NursingProcess.class, np.getID()); em.close(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myNP.getCategory()).add(myNP); Collections.sort(valuecache.get(myNP.getCategory())); createCP4(myNP.getCategory()); buildPanel(); } }; new DlgFiles(np, fileHandleClosure); } }); btnFiles.setEnabled(OPDE.isFTPworking()); cptitle.getRight().add(btnFiles); } if (!np.getAttachedQProcessConnections().isEmpty()) { /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = new JButton(Integer.toString(np.getAttachedQProcessConnections().size()), SYSConst.icon22redStar); btnProcess.setToolTipText(SYSTools.xx("misc.btnprocess.tooltip")); btnProcess.setForeground(Color.YELLOW); btnProcess.setHorizontalTextPosition(SwingUtilities.CENTER); btnProcess.setFont(SYSConst.ARIAL18BOLD); btnProcess.setPressedIcon(SYSConst.icon22Pressed); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.setAlignmentY(Component.TOP_ALIGNMENT); btnProcess.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnProcess.setContentAreaFilled(false); btnProcess.setBorder(null); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(np, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); final NursingProcess myNP = em.merge(np); em.lock(myNP, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSNP2PROCESS> attached = new ArrayList<SYSNP2PROCESS>( myNP.getAttachedQProcessConnections()); for (SYSNP2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections() .remove(linkObject); linkObject.getNursingProcess().getAttachedQProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + myNP.getTitle() + " ID: " + myNP.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess.getElements(); if (!listElements.contains(myNP)) { QProcess myQProcess = em.merge(qProcess); SYSNP2PROCESS myLinkObject = em .merge(new SYSNP2PROCESS(myQProcess, myNP)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + myNP.getTitle() + " ID: " + myNP.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedNursingProcessesConnections().add(myLinkObject); myNP.getAttachedQProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myNP.getCategory()).add(myNP); Collections.sort(valuecache.get(myNP.getCategory())); createCP4(myNP.getCategory()); buildPanel(); } 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 { reloadDisplay(); } } catch (RollbackException 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(); } } }); } }); btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)); cptitle.getRight().add(btnProcess); } if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) { /*** * _ _ ____ _ _ * | |__ | |_ _ __ | _ \ _ __(_)_ __ | |_ * | '_ \| __| '_ \| |_) | '__| | '_ \| __| * | |_) | |_| | | | __/| | | | | | | |_ * |_.__/ \__|_| |_|_| |_| |_|_| |_|\__| * */ JButton btnPrint = new JButton(SYSConst.icon22print2); btnPrint.setContentAreaFilled(false); btnPrint.setBorder(null); btnPrint.setPressedIcon(SYSConst.icon22print2Pressed); btnPrint.setAlignmentX(Component.RIGHT_ALIGNMENT); btnPrint.setAlignmentY(Component.TOP_ALIGNMENT); btnPrint.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { SYSFilesTools.print(NursingProcessTools.getAsHTML(np, true, true, true, true), true); } }); cptitle.getRight().add(btnPrint); // cptitle.getTitleButton().setVerticalTextPosition(SwingConstants.TOP); } /*** * __ __ * | \/ | ___ _ __ _ _ * | |\/| |/ _ \ '_ \| | | | * | | | | __/ | | | |_| | * |_| |_|\___|_| |_|\__,_| * */ final JButton btnMenu = new JButton(SYSConst.icon22menu); btnMenu.setPressedIcon(SYSConst.icon22Pressed); btnMenu.setAlignmentX(Component.RIGHT_ALIGNMENT); btnMenu.setAlignmentY(Component.TOP_ALIGNMENT); btnMenu.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMenu.setContentAreaFilled(false); btnMenu.setBorder(null); btnMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JidePopup popup = new JidePopup(); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnMenu); popup.removeExcludedComponent(btnMenu); JPanel pnl = getMenu(np); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnMenu.setEnabled(!np.isClosed()); cptitle.getButton().setIcon(getIcon(np)); cptitle.getRight().add(btnMenu); cptitle.getMain().setBackground(getColor(np.getCategory())[SYSConst.light2]); cptitle.getMain().setOpaque(true); contenPanelMap.put(np, cptitle.getMain()); } return contenPanelMap.get(np); }
From source file:op.care.nursingprocess.PnlNursingProcess.java
private JPanel getMenu(final NursingProcess np) { final JPanel pnlMenu = new JPanel(new VerticalLayout()); long numDFNs = DFNTools.getNumDFNs(np); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) { /***/*from ww w . j a va2s . com*/ * ____ _ * / ___| |__ __ _ _ __ __ _ ___ * | | | '_ \ / _` | '_ \ / _` |/ _ \ * | |___| | | | (_| | | | | (_| | __/ * \____|_| |_|\__,_|_| |_|\__, |\___| * |___/ */ JButton btnChange = GUITools.createHyperlinkButton("nursingrecords.nursingprocess.btnchange.tooltip", SYSConst.icon22playerPlay, null); btnChange.setAlignmentX(Component.RIGHT_ALIGNMENT); btnChange.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { NursingProcess template = np.clone(); template.setTo(SYSConst.DATE_UNTIL_FURTHER_NOTICE); template.setUserOFF(null); template.setUserON(OPDE.getLogin().getUser()); template.setNextEval(new DateTime().plusWeeks(4).toDate()); new DlgNursingProcess(template, new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); // Fetch the new Plan from the PAIR NursingProcess myNewNP = em.merge( ((Pair<NursingProcess, ArrayList<InterventionSchedule>>) o).getFirst()); NursingProcess myOldNP = em.merge(np); em.lock(myOldNP, LockModeType.OPTIMISTIC); // Close old NP myOldNP.setUserOFF(em.merge(OPDE.getLogin().getUser())); myOldNP.setTo(new DateTime().minusSeconds(1).toDate()); NPControl lastValidation = em .merge(new NPControl(myNewNP.getSituation(), myOldNP)); lastValidation.setLastValidation(true); myOldNP.getEvaluations().add(lastValidation); // Starts 1 second after the old one stopped myNewNP.setFrom(new DateTime(myOldNP.getTo()).plusSeconds(1).toDate()); // Create new DFNs according to plan DFNTools.generate(em, myNewNP.getInterventionSchedule(), new LocalDate(), true); em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myOldNP.getCategory()).add(myOldNP); valuecache.get(myNewNP.getCategory()).add(myNewNP); Collections.sort(valuecache.get(myNewNP.getCategory())); createCP4(myNewNP.getCategory()); boolean reloadSearch = false; for (Commontags ctag : myNewNP.getCommontags()) { if (!listUsedCommontags.contains(ctag)) { listUsedCommontags.add(ctag); reloadSearch = true; } } if (reloadSearch) { prepareSearchArea(); } buildPanel(); GUITools.flashBackground(contenPanelMap.get(myNewNP), Color.YELLOW, 2); } 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(); } // reloadTable(); } } }); } }); btnChange.setEnabled(!np.isClosed() && numDFNs != 0); pnlMenu.add(btnChange); /*** * ____ _ _ ____ _ * | __ ) _ _| |_| |_ ___ _ __ / ___|| |_ ___ _ __ * | _ \| | | | __| __/ _ \| '_ \ \___ \| __/ _ \| '_ \ * | |_) | |_| | |_| || (_) | | | | ___) | || (_) | |_) | * |____/ \__,_|\__|\__\___/|_| |_| |____/ \__\___/| .__/ * |_| */ final JButton btnStop = GUITools.createHyperlinkButton("nursingrecords.nursingprocess.btnstop.tooltip", SYSConst.icon22stop, null); btnStop.setAlignmentX(Component.RIGHT_ALIGNMENT); btnStop.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { final JidePopup popup = new JidePopup(); JPanel dlg = new PnlEval(np, new Closure() { @Override public void execute(Object o) { if (o != null) { popup.hidePopup(); Pair<NursingProcess, String> result = (Pair<NursingProcess, String>) o; EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NursingProcess myOldNP = em.merge(np); em.lock(myOldNP, LockModeType.OPTIMISTIC); myOldNP.setUserOFF(em.merge(OPDE.getLogin().getUser())); myOldNP.setTo(new Date()); NPControl lastValidation = em.merge(new NPControl(result.getSecond(), myOldNP)); lastValidation.setLastValidation(true); myOldNP.getEvaluations().add(lastValidation); em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myOldNP.getCategory()).add(myOldNP); Collections.sort(valuecache.get(myOldNP.getCategory())); createCP4(myOldNP.getCategory()); buildPanel(); // GUITools.flashBackground(contenPanelMap.get(myOldNP), Color.YELLOW, 2); } 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(); } OPDE.getDisplayManager() .addSubMessage(DisplayManager.getSuccessMessage(np.getTopic(), "closed")); reloadDisplay(); } } }, true); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(btnStop); popup.removeExcludedComponent(btnStop); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnStop.setEnabled(!np.isClosed() && numDFNs != 0); pnlMenu.add(btnStop); /*** * ____ _ _ _____ _ _ _ * | __ ) _ _| |_| |_ ___ _ __ | ____|__| (_) |_ * | _ \| | | | __| __/ _ \| '_ \ | _| / _` | | __| * | |_) | |_| | |_| || (_) | | | | | |__| (_| | | |_ * |____/ \__,_|\__|\__\___/|_| |_| |_____\__,_|_|\__| * */ JButton btnEdit = GUITools.createHyperlinkButton("nursingrecords.nursingprocess.btnedit.tooltip", SYSConst.icon22edit, null); btnEdit.setAlignmentX(Component.RIGHT_ALIGNMENT); btnEdit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgNursingProcess(np, new Closure() { @Override public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NursingProcess mynp = em.merge( ((Pair<NursingProcess, ArrayList<InterventionSchedule>>) o).getFirst()); em.lock(mynp, LockModeType.OPTIMISTIC); // Schedules to delete for (InterventionSchedule is : ((Pair<NursingProcess, ArrayList<InterventionSchedule>>) o) .getSecond()) { em.remove(em.merge(is)); } // No unused DFNs to delete Query delQuery = em.createQuery( "DELETE FROM DFN dfn WHERE dfn.nursingProcess = :nursingprocess "); delQuery.setParameter("nursingprocess", mynp); delQuery.executeUpdate(); // Create new DFNs according to plan DFNTools.generate(em, mynp.getInterventionSchedule(), new LocalDate(), true); em.getTransaction().commit(); boolean reloadSearch = false; for (Commontags ctag : mynp.getCommontags()) { if (!listUsedCommontags.contains(ctag)) { listUsedCommontags.add(ctag); reloadSearch = true; } } if (reloadSearch) { prepareSearchArea(); } // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(mynp.getCategory()).add(mynp); Collections.sort(valuecache.get(mynp.getCategory())); createCP4(mynp.getCategory()); buildPanel(); GUITools.flashBackground(contenPanelMap.get(mynp), Color.YELLOW, 2); } 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(); } // reloadTable(); } } }); } }); btnEdit.setEnabled(!np.isClosed() && numDFNs == 0); pnlMenu.add(btnEdit); } /*** * ____ _ _ ____ _ _ * | __ ) _ _| |_| |_ ___ _ __ | _ \ ___| | ___| |_ ___ * | _ \| | | | __| __/ _ \| '_ \ | | | |/ _ \ |/ _ \ __/ _ \ * | |_) | |_| | |_| || (_) | | | | | |_| | __/ | __/ || __/ * |____/ \__,_|\__|\__\___/|_| |_| |____/ \___|_|\___|\__\___| * */ if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.DELETE, internalClassID)) { // => ACL_MATRIX JButton btnDelete = GUITools.createHyperlinkButton("nursingrecords.nursingprocess.btndelete.tooltip", SYSConst.icon22delete, null); btnDelete.setAlignmentX(Component.RIGHT_ALIGNMENT); btnDelete.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgYesNo(SYSTools.xx("misc.questions.delete1") + "<br/><b>" + np.getTopic() + "</b><br/>" + SYSTools.xx("misc.questions.delete2"), SYSConst.icon48delete, new Closure() { @Override public void execute(Object o) { if (o.equals(JOptionPane.YES_OPTION)) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NursingProcess myOldNP = em.merge(np); em.lock(myOldNP, LockModeType.OPTIMISTIC); // DFNs to delete Query delQuery = em.createQuery( "DELETE FROM DFN dfn WHERE dfn.nursingProcess = :nursingprocess "); delQuery.setParameter("nursingprocess", myOldNP); // delQuery.setParameter("status", DFNTools.STATE_OPEN); delQuery.executeUpdate(); em.remove(myOldNP); em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); createCP4(myOldNP.getCategory()); buildPanel(); OPDE.getDisplayManager().addSubMessage( DisplayManager.getSuccessMessage(np.getTopic(), "deleted")); } 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(); } } } }); } }); btnDelete.setEnabled(!np.isClosed() && numDFNs == 0); pnlMenu.add(btnDelete); } /*** * ____ _ _____ _ * | __ )| |_ _ __ | ____|_ ____ _| | * | _ \| __| '_ \| _| \ \ / / _` | | * | |_) | |_| | | | |___ \ V / (_| | | * |____/ \__|_| |_|_____| \_/ \__,_|_| * */ if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) { final JButton btnEval = GUITools.createHyperlinkButton("nursingrecords.nursingprocess.btneval.tooltip", SYSConst.icon22redo, null); btnEval.setAlignmentX(Component.RIGHT_ALIGNMENT); btnEval.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { final JidePopup popup = new JidePopup(); JPanel dlg = new PnlEval(np, new Closure() { @Override public void execute(Object o) { if (o != null) { popup.hidePopup(); Pair<NursingProcess, String> result = (Pair<NursingProcess, String>) o; EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NursingProcess evaluatedNP = em.merge(result.getFirst()); em.lock(evaluatedNP, LockModeType.OPTIMISTIC); NPControl newEvaluation = em .merge(new NPControl(result.getSecond(), evaluatedNP)); evaluatedNP.getEvaluations().add(newEvaluation); em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(evaluatedNP.getCategory()).add(evaluatedNP); Collections.sort(valuecache.get(evaluatedNP.getCategory())); createCP4(evaluatedNP.getCategory()); buildPanel(); GUITools.flashBackground(contenPanelMap.get(evaluatedNP), Color.YELLOW, 2); } 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(); } OPDE.getDisplayManager().addSubMessage(new DisplayMessage( SYSTools.xx("nursingrecords.nursingprocess.success.neweval"))); reloadDisplay(); } } }, false); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(btnEval); popup.removeExcludedComponent(btnEval); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.NORTH_WEST); } }); btnEval.setEnabled(!np.isClosed()); pnlMenu.add(btnEval); /*** * _ _ _____ _ ____ * | |__ | |_ _ _|_ _|/ \ / ___|___ * | '_ \| __| '_ \| | / _ \| | _/ __| * | |_) | |_| | | | |/ ___ \ |_| \__ \ * |_.__/ \__|_| |_|_/_/ \_\____|___/ * */ final JButton btnTAGs = GUITools.createHyperlinkButton("misc.msg.editTags", SYSConst.icon22tagPurple, null); btnTAGs.setAlignmentX(Component.RIGHT_ALIGNMENT); btnTAGs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { final JidePopup popup = new JidePopup(); final JPanel pnl = new JPanel(new BorderLayout(5, 5)); final PnlCommonTags pnlCommonTags = new PnlCommonTags(np.getCommontags(), true, 3); pnl.add(new JScrollPane(pnlCommonTags), BorderLayout.CENTER); JButton btnApply = new JButton(SYSConst.icon22apply); pnl.add(btnApply, BorderLayout.SOUTH); btnApply.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); NursingProcess myNP = em.merge(np); em.lock(myNP, LockModeType.OPTIMISTIC_FORCE_INCREMENT); myNP.getCommontags().clear(); for (Commontags commontag : pnlCommonTags.getListSelectedTags()) { myNP.getCommontags().add(em.merge(commontag)); } em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myNP.getCategory()).add(myNP); Collections.sort(valuecache.get(myNP.getCategory())); boolean reloadSearch = false; for (Commontags ctag : myNP.getCommontags()) { if (!listUsedCommontags.contains(ctag)) { listUsedCommontags.add(ctag); reloadSearch = true; } } if (reloadSearch) { prepareSearchArea(); } createCP4(myNP.getCategory()); buildPanel(); GUITools.flashBackground(contenPanelMap.get(myNP), Color.YELLOW, 2); } catch (OptimisticLockException ole) { OPDE.warn(ole); OPDE.getDisplayManager().addSubMessage(DisplayManager.getLockMessage()); if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } if (ole.getMessage().indexOf("Class> entity.info.Resident") > -1) { OPDE.getMainframe().emptyFrame(); OPDE.getMainframe().afterLogin(); } else { reloadDisplay(); } } catch (Exception e) { if (em.getTransaction().isActive()) { em.getTransaction().rollback(); } OPDE.fatal(e); } finally { em.close(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.setOwner(btnTAGs); popup.removeExcludedComponent(btnTAGs); pnl.setPreferredSize(new Dimension(350, 150)); popup.getContentPane().add(pnl); popup.setDefaultFocusComponent(pnl); GUITools.showPopup(popup, SwingConstants.WEST); } }); btnTAGs.setEnabled(!np.isClosed()); pnlMenu.add(btnTAGs); pnlMenu.add(new JSeparator()); /*** * _ _ _____ _ _ * | |__ | |_ _ __ | ___(_) | ___ ___ * | '_ \| __| '_ \| |_ | | |/ _ \/ __| * | |_) | |_| | | | _| | | | __/\__ \ * |_.__/ \__|_| |_|_| |_|_|\___||___/ * */ final JButton btnFiles = GUITools.createHyperlinkButton("misc.btnfiles.tooltip", SYSConst.icon22attach, null); btnFiles.setAlignmentX(Component.RIGHT_ALIGNMENT); btnFiles.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { Closure fileHandleClosure = np.isClosed() ? null : new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final NursingProcess myNP = em.find(NursingProcess.class, np.getID()); em.close(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myNP.getCategory()).add(myNP); Collections.sort(valuecache.get(myNP.getCategory())); createCP4(myNP.getCategory()); buildPanel(); } }; new DlgFiles(np, fileHandleClosure); } }); btnFiles.setEnabled(OPDE.isFTPworking()); pnlMenu.add(btnFiles); /*** * _ _ ____ * | |__ | |_ _ __ | _ \ _ __ ___ ___ ___ ___ ___ * | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __| * | |_) | |_| | | | __/| | | (_) | (_| __/\__ \__ \ * |_.__/ \__|_| |_|_| |_| \___/ \___\___||___/___/ * */ final JButton btnProcess = GUITools.createHyperlinkButton("misc.btnprocess.tooltip", SYSConst.icon22link, null); btnProcess.setAlignmentX(Component.RIGHT_ALIGNMENT); btnProcess.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgProcessAssign(np, new Closure() { @Override public void execute(Object o) { if (o == null) { return; } Pair<ArrayList<QProcess>, ArrayList<QProcess>> result = (Pair<ArrayList<QProcess>, ArrayList<QProcess>>) o; ArrayList<QProcess> assigned = result.getFirst(); ArrayList<QProcess> unassigned = result.getSecond(); EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); em.lock(em.merge(resident), LockModeType.OPTIMISTIC); final NursingProcess myNP = em.merge(np); em.lock(myNP, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSNP2PROCESS> attached = new ArrayList<SYSNP2PROCESS>( myNP.getAttachedQProcessConnections()); for (SYSNP2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections().remove(linkObject); linkObject.getNursingProcess().getAttachedQProcessConnections() .remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + myNP.getTitle() + " ID: " + myNP.getID(), PReportTools.PREPORT_TYPE_REMOVE_ELEMENT, linkObject.getQProcess())); em.remove(linkObject); } } attached.clear(); for (QProcess qProcess : assigned) { java.util.List<QProcessElement> listElements = qProcess.getElements(); if (!listElements.contains(myNP)) { QProcess myQProcess = em.merge(qProcess); SYSNP2PROCESS myLinkObject = em.merge(new SYSNP2PROCESS(myQProcess, myNP)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + myNP.getTitle() + " ID: " + myNP.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedNursingProcessesConnections().add(myLinkObject); myNP.getAttachedQProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); // Refresh Display valuecache.get(np.getCategory()).remove(np); contenPanelMap.remove(np); valuecache.get(myNP.getCategory()).add(myNP); Collections.sort(valuecache.get(myNP.getCategory())); createCP4(myNP.getCategory()); buildPanel(); } 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 { reloadDisplay(); } } catch (RollbackException 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(); } } }); } }); btnProcess.setEnabled(!np.isClosed()); pnlMenu.add(btnProcess); } return pnlMenu; }
From source file:op.care.prescription.DlgOnDemand.java
private void btnSituationActionPerformed(ActionEvent e) { final JidePopup popup = new JidePopup(); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); final JTextField editor = new JTextField(txtSit.getText(), 30); editor.addActionListener(new ActionListener() { @Override/*w w w. j av a2 s .co m*/ public void actionPerformed(ActionEvent actionEvent) { saveSituation(editor.getText()); popup.hidePopup(); } }); popup.getContentPane().add(new JScrollPane(editor)); JButton saveButton = new JButton(SYSConst.icon22apply); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { saveSituation(editor.getText()); popup.hidePopup(); } }); popup.setMovable(false); popup.setOwner(btnAddSit); popup.removeExcludedComponent(btnAddSit); popup.getContentPane().add(saveButton); popup.setDefaultFocusComponent(editor); GUITools.showPopup(popup, SwingConstants.SOUTH_WEST); }
From source file:op.care.prescription.DlgOnDemand.java
/** * This method is called from within the constructor to * initialize the form.// www . j a v a 2 s . c om * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); txtMed = new JXSearchField(); cmbMed = new JComboBox<>(); panel4 = new JPanel(); btnMedWizard = new JButton(); cmbIntervention = new JComboBox<>(); txtSit = new JXSearchField(); cmbSit = new JComboBox<>(); panel3 = new JPanel(); btnAddSit = new JButton(); txtIntervention = new JXSearchField(); jPanel2 = new JPanel(); lblNumber = new JLabel(); lblDose = new JLabel(); lblMaxPerDay = new JLabel(); txtMaxTimes = new JTextField(); lblX = new JLabel(); txtEDosis = new JTextField(); lblCheckResultAfter = new JLabel(); cmbCheckAfter = new JComboBox<>(); jPanel3 = new JPanel(); pnlOFF = new JPanel(); rbActive = new JRadioButton(); rbDate = new JRadioButton(); txtOFF = new JTextField(); jScrollPane3 = new JScrollPane(); txtBemerkung = new JTextPane(); lblText = new JLabel(); pnlON = new JPanel(); cmbDocON = new JComboBox<>(); cmbHospitalON = new JComboBox<>(); panel1 = new JPanel(); btnClose = new JButton(); btnSave = new JButton(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("14dlu, $lcgap, default, 6dlu, 355dlu, $lcgap, 14dlu", "14dlu, $lgap, fill:default:grow, $lgap, fill:default, $lgap, 14dlu")); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("68dlu, $lcgap, pref:grow, $lcgap, pref", "3*(16dlu, $lgap), default, $lgap, fill:113dlu:grow, $lgap, 60dlu")); //---- txtMed ---- txtMed.setFont(new Font("Arial", Font.PLAIN, 14)); txtMed.setPrompt("Medikamente"); txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT); txtMed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMedActionPerformed(e); } }); txtMed.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMedFocusGained(e); } }); jPanel1.add(txtMed, CC.xy(1, 1)); //---- cmbMed ---- cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbMed.setFont(new Font("Arial", Font.PLAIN, 14)); cmbMed.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbMedItemStateChanged(e); } }); jPanel1.add(cmbMed, CC.xy(3, 1)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); //---- btnMedWizard ---- btnMedWizard.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnMedWizard.setBorderPainted(false); btnMedWizard.setBorder(null); btnMedWizard.setContentAreaFilled(false); btnMedWizard.setToolTipText("Neues Medikament eintragen"); btnMedWizard.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMedWizard.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnMedWizard.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnMedActionPerformed(e); } }); panel4.add(btnMedWizard); } jPanel1.add(panel4, CC.xy(5, 1)); //---- cmbIntervention ---- cmbIntervention .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbIntervention, CC.xywh(3, 5, 3, 1)); //---- txtSit ---- txtSit.setPrompt("Situationen"); txtSit.setFont(new Font("Arial", Font.PLAIN, 14)); txtSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtSitActionPerformed(e); } }); jPanel1.add(txtSit, CC.xy(1, 3)); //---- cmbSit ---- cmbSit.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbSit.setFont(new Font("Arial", Font.PLAIN, 14)); cmbSit.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbSitItemStateChanged(e); } }); cmbSit.addPropertyChangeListener("model", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { cmbSitPropertyChange(e); } }); jPanel1.add(cmbSit, CC.xy(3, 3)); //======== panel3 ======== { panel3.setLayout(new BoxLayout(panel3, BoxLayout.LINE_AXIS)); //---- btnAddSit ---- btnAddSit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddSit.setBorderPainted(false); btnAddSit.setBorder(null); btnAddSit.setContentAreaFilled(false); btnAddSit.setToolTipText("Neue Situation eintragen"); btnAddSit.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddSit.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddSit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSituationActionPerformed(e); } }); panel3.add(btnAddSit); } jPanel1.add(panel3, CC.xy(5, 3, CC.RIGHT, CC.DEFAULT)); //---- txtIntervention ---- txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); txtIntervention.setPrompt("Massnahmen"); txtIntervention.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMassActionPerformed(e); } }); jPanel1.add(txtIntervention, CC.xy(1, 5)); //======== jPanel2 ======== { jPanel2.setLayout(new FormLayout("default, $lcgap, pref, $lcgap, default, $lcgap, 37dlu:grow", "23dlu, fill:22dlu, $ugap, default")); //---- lblNumber ---- lblNumber.setText("Anzahl"); jPanel2.add(lblNumber, CC.xy(3, 1)); //---- lblDose ---- lblDose.setText("Dosis"); jPanel2.add(lblDose, CC.xy(7, 1, CC.CENTER, CC.DEFAULT)); //---- lblMaxPerDay ---- lblMaxPerDay.setText("Max. Tagesdosis:"); jPanel2.add(lblMaxPerDay, CC.xy(1, 2)); //---- txtMaxTimes ---- txtMaxTimes.setHorizontalAlignment(SwingConstants.CENTER); txtMaxTimes.setText("1"); txtMaxTimes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtMaxTimesActionPerformed(e); } }); txtMaxTimes.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMaxTimesFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtMaxTimesFocusLost(e); } }); jPanel2.add(txtMaxTimes, CC.xy(3, 2)); //---- lblX ---- lblX.setText("x"); jPanel2.add(lblX, CC.xy(5, 2)); //---- txtEDosis ---- txtEDosis.setHorizontalAlignment(SwingConstants.CENTER); txtEDosis.setText("1.0"); txtEDosis.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtEDosisFocusGained(e); } @Override public void focusLost(FocusEvent e) { txtEDosisFocusLost(e); } }); txtEDosis.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { txtEDosisActionPerformed(e); } }); jPanel2.add(txtEDosis, CC.xy(7, 2)); //---- lblCheckResultAfter ---- lblCheckResultAfter.setText("Nachkontrolle:"); jPanel2.add(lblCheckResultAfter, CC.xy(1, 4)); //---- cmbCheckAfter ---- cmbCheckAfter.setModel(new DefaultComboBoxModel<>(new String[] { "keine Nachkontrolle", "nach 1 Stunde", "nach 2 Stunden", "nach 3 Stunden" })); jPanel2.add(cmbCheckAfter, CC.xywh(3, 4, 5, 1)); } jPanel1.add(jPanel2, CC.xywh(1, 9, 5, 1, CC.CENTER, CC.TOP)); } contentPane.add(jPanel1, CC.xy(5, 3)); //======== jPanel3 ======== { jPanel3.setBorder(null); jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:100dlu:grow")); //======== pnlOFF ======== { pnlOFF.setBorder(new TitledBorder("Absetzung")); pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "fill:17dlu, $lgap, fill:17dlu")); //---- rbActive ---- rbActive.setText("text"); rbActive.setSelected(true); rbActive.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbActiveItemStateChanged(e); } }); pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1)); //---- rbDate ---- rbDate.setText(null); rbDate.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { rbDateItemStateChanged(e); } }); pnlOFF.add(rbDate, CC.xy(1, 3)); //---- txtOFF ---- txtOFF.setEnabled(false); txtOFF.setFont(new Font("Arial", Font.PLAIN, 14)); txtOFF.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtOFFFocusLost(e); } }); pnlOFF.add(txtOFF, CC.xy(2, 3)); } jPanel3.add(pnlOFF, CC.xy(1, 3)); //======== jScrollPane3 ======== { //---- txtBemerkung ---- txtBemerkung.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { txtBemerkungCaretUpdate(e); } }); jScrollPane3.setViewportView(txtBemerkung); } jPanel3.add(jScrollPane3, CC.xy(1, 7)); //---- lblText ---- lblText.setText("Bemerkung:"); jPanel3.add(lblText, CC.xy(1, 5)); //======== pnlON ======== { pnlON.setBorder(new TitledBorder("Ansetzung")); pnlON.setLayout(new FormLayout("119dlu:grow", "17dlu, $lgap, fill:17dlu")); //---- cmbDocON ---- cmbDocON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbDocON.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { cmbDocONKeyPressed(e); } }); pnlON.add(cmbDocON, CC.xy(1, 1)); //---- cmbHospitalON ---- cmbHospitalON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnlON.add(cmbHospitalON, CC.xy(1, 3)); } jPanel3.add(pnlON, CC.xy(1, 1)); } contentPane.add(jPanel3, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCloseActionPerformed(e); } }); panel1.add(btnClose); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnSaveActionPerformed(e); } }); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT)); setSize(1035, 515); setLocationRelativeTo(getOwner()); //---- bgMedikament ---- ButtonGroup bgMedikament = new ButtonGroup(); bgMedikament.add(rbActive); bgMedikament.add(rbDate); }
From source file:op.care.prescription.DlgOnDemand.java
private void btnMedActionPerformed(ActionEvent evt) {//GEN-FIRST:event_btnMedActionPerformed // String pzan = MedPackageTools.parsePZN(txtMed.getText()); final JidePopup popup = new JidePopup(); WizardDialog wizard = new MedProductWizard(new Closure() { @Override// ww w . jav a 2 s .c om public void execute(Object o) { if (o != null) { MedPackage aPackage = (MedPackage) o; txtMed.setText(aPackage.getPzn()); } popup.hidePopup(); } }).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(btnMedWizard); popup.removeExcludedComponent(btnMedWizard); popup.setTransient(true); popup.setDefaultFocusComponent(wizard.getContentPane()); popup.showPopup(new Insets(-5, wizard.getPreferredSize().width * -1 - 200, -5, -100), btnMedWizard); }
From source file:op.care.prescription.DlgRegular.java
private void btnAddDosisActionPerformed(ActionEvent e) { final JidePopup popup = new JidePopup(); JPanel dlg = new PnlScheduleDose(new PrescriptionSchedule(prescription), new Closure() { @Override//from w w w . j av a 2s . co m public void execute(Object o) { if (o != null) { prescription.getPrescriptionSchedule().add(((PrescriptionSchedule) o)); reloadTable(); popup.hidePopup(); } } }); popup.setMovable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(dlg); popup.setOwner(btnAddDosis); popup.removeExcludedComponent(btnAddDosis); popup.setDefaultFocusComponent(dlg); GUITools.showPopup(popup, SwingConstants.NORTH); }
From source file:op.care.prescription.DlgRegular.java
/** * This method is called from within the constructor to * initialize the form./*from w w w . j av a2 s .c om*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); txtMed = new JXSearchField(); cmbMed = new JComboBox<>(); panel4 = new JPanel(); btnMed = new JButton(); cmbIntervention = new JComboBox<>(); txtIntervention = new JXSearchField(); jPanel8 = new JPanel(); jspDosis = new JScrollPane(); tblDosis = new JTable(); panel2 = new JPanel(); btnAddDosis = new JButton(); jPanel3 = new JPanel(); pnlOFF = new JPanel(); rbActive = new JRadioButton(); rbDate = new JRadioButton(); txtTo = new JTextField(); rbEndOfPackage = new JRadioButton(); jScrollPane3 = new JScrollPane(); txtBemerkung = new JTextPane(); lblText = new JLabel(); pnlON = new JPanel(); cmbDocON = new JComboBox<>(); btnAddGP = new JButton(); cmbHospitalON = new JComboBox<>(); btnAddHospital = new JButton(); panel1 = new JPanel(); btnClose = new JButton(); btnSave = new JButton(); lblTX = new JLabel(); //======== this ======== setModalityType(Dialog.ModalityType.APPLICATION_MODAL); setResizable(false); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new FormLayout("$rgap, $lcgap, default, $lcgap, pref, $lcgap, $rgap", "$rgap, $lgap, fill:default:grow, $lgap, fill:default, $lgap, $rgap")); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("68dlu, $lcgap, 284dlu, $lcgap, pref", "2*(16dlu, $lgap), default, $lgap, fill:default:grow")); //---- txtMed ---- txtMed.setFont(new Font("Arial", Font.PLAIN, 14)); txtMed.setPrompt("Medikamente"); txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT); txtMed.addActionListener(e -> txtMedActionPerformed(e)); txtMed.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtMedFocusGained(e); } }); jPanel1.add(txtMed, CC.xy(1, 1)); //---- cmbMed ---- cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbMed.setFont(new Font("Arial", Font.PLAIN, 14)); cmbMed.addItemListener(e -> cmbMedItemStateChanged(e)); jPanel1.add(cmbMed, CC.xy(3, 1)); //======== panel4 ======== { panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS)); //---- btnMed ---- btnMed.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnMed.setBorderPainted(false); btnMed.setBorder(null); btnMed.setContentAreaFilled(false); btnMed.setToolTipText("Neues Medikament eintragen"); btnMed.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnMed.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnMed.addActionListener(e -> btnMedActionPerformed(e)); panel4.add(btnMed); } jPanel1.add(panel4, CC.xy(5, 1)); //---- cmbIntervention ---- cmbIntervention .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(cmbIntervention, CC.xywh(3, 3, 3, 1)); //---- txtIntervention ---- txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14)); txtIntervention.setPrompt("Massnahmen"); txtIntervention.addActionListener(e -> txtMassActionPerformed(e)); jPanel1.add(txtIntervention, CC.xy(1, 3)); //======== jPanel8 ======== { jPanel8.setBorder(new TitledBorder(null, "Dosis / H\u00e4ufigkeit", TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14))); jPanel8.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel8.setLayout(new FormLayout("370dlu", "fill:default:grow, $lgap, pref")); //======== jspDosis ======== { jspDosis.setToolTipText(null); //---- tblDosis ---- tblDosis.setModel(new DefaultTableModel( new Object[][] { { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, { null, null, null, null }, }, new String[] { "Title 1", "Title 2", "Title 3", "Title 4" })); tblDosis.setSurrendersFocusOnKeystroke(true); tblDosis.setToolTipText(null); tblDosis.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { tblDosisMousePressed(e); } }); jspDosis.setViewportView(tblDosis); } jPanel8.add(jspDosis, CC.xy(1, 1)); //======== panel2 ======== { panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS)); //---- btnAddDosis ---- btnAddDosis.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddDosis.setBorderPainted(false); btnAddDosis.setBorder(null); btnAddDosis.setContentAreaFilled(false); btnAddDosis.setToolTipText("Neue Dosierung eintragen"); btnAddDosis.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddDosis.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddDosis.addActionListener(e -> btnAddDosisActionPerformed(e)); panel2.add(btnAddDosis); } jPanel8.add(panel2, CC.xy(1, 3, CC.LEFT, CC.DEFAULT)); } jPanel1.add(jPanel8, CC.xywh(1, 7, 5, 1)); } contentPane.add(jPanel1, CC.xy(5, 3)); //======== jPanel3 ======== { jPanel3.setBorder(null); jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:108dlu:grow, $lgap, 60dlu")); //======== pnlOFF ======== { pnlOFF.setBorder(new TitledBorder("Absetzung")); pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "2*(fill:17dlu, $lgap), fill:17dlu")); //---- rbActive ---- rbActive.setText("text"); rbActive.setSelected(true); rbActive.addItemListener(e -> rbActiveItemStateChanged(e)); pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1)); //---- rbDate ---- rbDate.setText(null); rbDate.addItemListener(e -> rbDateItemStateChanged(e)); pnlOFF.add(rbDate, CC.xy(1, 3)); //---- txtTo ---- txtTo.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtToFocusLost(e); } }); pnlOFF.add(txtTo, CC.xy(2, 3)); //---- rbEndOfPackage ---- rbEndOfPackage.setText("text"); rbEndOfPackage.addItemListener(e -> rbEndOfPackageItemStateChanged(e)); pnlOFF.add(rbEndOfPackage, CC.xywh(1, 5, 2, 1)); } jPanel3.add(pnlOFF, CC.xy(1, 3)); //======== jScrollPane3 ======== { //---- txtBemerkung ---- txtBemerkung.addCaretListener(e -> txtBemerkungCaretUpdate(e)); jScrollPane3.setViewportView(txtBemerkung); } jPanel3.add(jScrollPane3, CC.xy(1, 7)); //---- lblText ---- lblText.setText("Bemerkung:"); jPanel3.add(lblText, CC.xy(1, 5)); //======== pnlON ======== { pnlON.setBorder(new TitledBorder("Ansetzung")); pnlON.setLayout(new FormLayout("119dlu:grow, $lcgap, default", "default, $lgap, default")); //---- cmbDocON ---- cmbDocON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbDocON.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { cmbDocONKeyPressed(e); } }); pnlON.add(cmbDocON, CC.xy(1, 1)); //---- btnAddGP ---- btnAddGP.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddGP.setBorderPainted(false); btnAddGP.setBorder(null); btnAddGP.setContentAreaFilled(false); btnAddGP.setToolTipText("Neues Medikament eintragen"); btnAddGP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddGP.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddGP.addActionListener(e -> btnAddGPActionPerformed(e)); pnlON.add(btnAddGP, CC.xy(3, 1)); //---- cmbHospitalON ---- cmbHospitalON.setModel( new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnlON.add(cmbHospitalON, CC.xy(1, 3)); //---- btnAddHospital ---- btnAddHospital.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png"))); btnAddHospital.setBorderPainted(false); btnAddHospital.setBorder(null); btnAddHospital.setContentAreaFilled(false); btnAddHospital.setToolTipText("Neues Medikament eintragen"); btnAddHospital.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAddHospital.setSelectedIcon( new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png"))); btnAddHospital.addActionListener(e -> btnAddHospitalActionPerformed(e)); pnlON.add(btnAddHospital, CC.xy(3, 3)); } jPanel3.add(pnlON, CC.xy(1, 1)); } contentPane.add(jPanel3, CC.xy(3, 3)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnClose.addActionListener(e -> btnCloseActionPerformed(e)); panel1.add(btnClose); //---- btnSave ---- btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnSave.addActionListener(e -> btnSaveActionPerformed(e)); panel1.add(btnSave); } contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT)); //---- lblTX ---- lblTX.setText(null); lblTX.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/ambulance2.png"))); contentPane.add(lblTX, CC.xy(3, 5)); setSize(1015, 640); setLocationRelativeTo(getOwner()); //---- bgMedikament ---- ButtonGroup bgMedikament = new ButtonGroup(); bgMedikament.add(rbActive); bgMedikament.add(rbDate); bgMedikament.add(rbEndOfPackage); }