Example usage for javax.swing SwingConstants SOUTH

List of usage examples for javax.swing SwingConstants SOUTH

Introduction

In this page you can find the example usage for javax.swing SwingConstants SOUTH.

Prototype

int SOUTH

To view the source code for javax.swing SwingConstants SOUTH.

Click Source Link

Document

Compass-direction south (down).

Usage

From source file:op.care.med.inventory.PnlInventory.java

private CollapsiblePane createCP4(final MedInventory inventory) {
    /***//from  w w w .  ja  va  2  s.c  o m
     *                          _        ____ ____  _  _    _____                      _                 __
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |  / /_ _|_ ____   _____ _ __ | |_ ___  _ __ _   \ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_| | | || '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | | |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| | | || | | \ V /  __/ | | | || (_) | |  | |_| | |
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_| | ||___|_| |_|\_/ \___|_| |_|\__\___/|_|   \__, | |
     *                                                     \_\                                       |___/_/
     */
    final String key = inventory.getID() + ".xinventory";
    synchronized (cpMap) {
        if (!cpMap.containsKey(key)) {
            cpMap.put(key, new CollapsiblePane());
            try {
                cpMap.get(key).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }

        }

        cpMap.get(key).setName("inventory");

        //            final CollapsiblePane cpInventory = cpMap.get(key);

        BigDecimal sumInventory = BigDecimal.ZERO;
        try {
            EntityManager em = OPDE.createEM();
            sumInventory = MedInventoryTools.getSum(em, inventory);
            em.close();
        } catch (Exception e) {
            OPDE.fatal(e);
        }

        String title = "<html><table border=\"0\">" + "<tr>" +

                "<td width=\"520\" align=\"left\"><font size=+1>" + inventory.getText() + "</font></td>"
                + "<td width=\"200\" align=\"right\"><font size=+1>"
                + NumberFormat.getNumberInstance().format(sumInventory) + " "
                + DosageFormTools.getPackageText(MedInventoryTools.getForm(inventory)) + "</font></td>" +

                "</tr>" + "</table>" +

                "</html>";

        DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    cpMap.get(key).setCollapsed(!cpMap.get(key).isCollapsed());
                } catch (PropertyVetoException pve) {
                    // BAH!
                }
            }
        });
        cpMap.get(key).setTitleLabelComponent(cptitle.getMain());
        cpMap.get(key).setSlidingDirection(SwingConstants.SOUTH);
        cptitle.getButton().setIcon(inventory.isClosed() ? SYSConst.icon22stopSign : null);

        if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.MANAGER, "nursingrecords.inventory")) {
            /***
             *       ____ _                ___                      _
             *      / ___| | ___  ___  ___|_ _|_ ____   _____ _ __ | |_ ___  _ __ _   _
             *     | |   | |/ _ \/ __|/ _ \| || '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | |
             *     | |___| | (_) \__ \  __/| || | | \ V /  __/ | | | || (_) | |  | |_| |
             *      \____|_|\___/|___/\___|___|_| |_|\_/ \___|_| |_|\__\___/|_|   \__, |
             *                                                                    |___/
             */
            final JButton btnCloseInventory = new JButton(SYSConst.icon22playerStop);
            btnCloseInventory.setPressedIcon(SYSConst.icon22playerStopPressed);
            btnCloseInventory.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnCloseInventory.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnCloseInventory.setContentAreaFilled(false);
            btnCloseInventory.setBorder(null);
            btnCloseInventory.setToolTipText(SYSTools.xx("nursingrecords.inventory.btncloseinventory.tooltip"));
            btnCloseInventory.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    new DlgYesNo(
                            SYSTools.xx("nursingrecords.inventory.question.close1") + "<br/><b>"
                                    + inventory.getText() + "</b>" + "<br/>"
                                    + SYSTools.xx("nursingrecords.inventory.question.close2"),
                            SYSConst.icon48playerStop, new Closure() {
                                @Override
                                public void execute(Object answer) {
                                    if (answer.equals(JOptionPane.YES_OPTION)) {
                                        EntityManager em = OPDE.createEM();
                                        try {
                                            em.getTransaction().begin();

                                            MedInventory myInventory = em.merge(inventory);
                                            em.lock(myInventory, LockModeType.OPTIMISTIC);
                                            em.lock(myInventory.getResident(), LockModeType.OPTIMISTIC);

                                            // close all stocks
                                            for (MedStock stock : MedStockTools.getAll(myInventory)) {
                                                if (!stock.isClosed()) {
                                                    MedStock mystock = em.merge(stock);
                                                    em.lock(mystock, LockModeType.OPTIMISTIC);
                                                    mystock.setNextStock(null);
                                                    MedStockTools.close(em, mystock, SYSTools.xx(
                                                            "nursingrecords.inventory.stock.msg.inventory_closed"),
                                                            MedStockTransactionTools.STATE_EDIT_INVENTORY_CLOSED);
                                                }
                                            }
                                            // close inventory
                                            myInventory.setTo(new Date());

                                            em.getTransaction().commit();

                                            createCP4(myInventory);
                                            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();
                                            }
                                            OPDE.getDisplayManager()
                                                    .addSubMessage(DisplayManager.getLockMessage());
                                        } catch (Exception e) {
                                            if (em.getTransaction().isActive()) {
                                                em.getTransaction().rollback();
                                            }
                                            OPDE.fatal(e);
                                        } finally {
                                            em.close();
                                        }
                                    }
                                }
                            });
                }
            });
            btnCloseInventory.setEnabled(!inventory.isClosed());
            cptitle.getRight().add(btnCloseInventory);
        }
        if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.DELETE, "nursingrecords.inventory")) {
            /***
             *      ____       _ ___                      _
             *     |  _ \  ___| |_ _|_ ____   _____ _ __ | |_ ___  _ __ _   _
             *     | | | |/ _ \ || || '_ \ \ / / _ \ '_ \| __/ _ \| '__| | | |
             *     | |_| |  __/ || || | | \ V /  __/ | | | || (_) | |  | |_| |
             *     |____/ \___|_|___|_| |_|\_/ \___|_| |_|\__\___/|_|   \__, |
             *                                                          |___/
             */
            final JButton btnDelInventory = new JButton(SYSConst.icon22delete);
            btnDelInventory.setPressedIcon(SYSConst.icon22deletePressed);
            btnDelInventory.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnDelInventory.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnDelInventory.setContentAreaFilled(false);
            btnDelInventory.setBorder(null);
            btnDelInventory.setToolTipText(SYSTools.xx("nursingrecords.inventory.btndelinventory.tooltip"));
            btnDelInventory.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    new DlgYesNo(
                            SYSTools.xx("nursingrecords.inventory.question.delete1") + "<br/><b>"
                                    + inventory.getText() + "</b>" + "<br/>"
                                    + SYSTools.xx("nursingrecords.inventory.question.delete2"),
                            SYSConst.icon48delete, new Closure() {
                                @Override
                                public void execute(Object answer) {
                                    if (answer.equals(JOptionPane.YES_OPTION)) {
                                        EntityManager em = OPDE.createEM();
                                        try {
                                            em.getTransaction().begin();

                                            MedInventory myInventory = em.merge(inventory);
                                            em.lock(myInventory, LockModeType.OPTIMISTIC);
                                            em.lock(myInventory.getResident(), LockModeType.OPTIMISTIC);

                                            em.remove(myInventory);

                                            em.getTransaction().commit();

                                            //                                        lstInventories.remove(inventory);
                                            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();
                                            }
                                            OPDE.getDisplayManager()
                                                    .addSubMessage(DisplayManager.getLockMessage());
                                        } catch (Exception e) {
                                            if (em.getTransaction().isActive()) {
                                                em.getTransaction().rollback();
                                            }
                                            OPDE.fatal(e);
                                        } finally {
                                            em.close();
                                        }
                                    }
                                }
                            });
                }
            });
            cptitle.getRight().add(btnDelInventory);
        }

        final JToggleButton tbClosedStock = GUITools.getNiceToggleButton(null);
        tbClosedStock.setToolTipText(SYSTools.xx("nursingrecords.inventory.showclosedstocks"));
        if (!inventory.isClosed()) {
            tbClosedStock.addItemListener(new ItemListener() {
                @Override
                public void itemStateChanged(ItemEvent e) {
                    cpMap.get(key).setContentPane(createContentPanel4(inventory, tbClosedStock.isSelected()));
                }
            });
        }
        tbClosedStock.setSelected(inventory.isClosed());
        tbClosedStock.setEnabled(!inventory.isClosed());

        mapKey2ClosedToggleButton.put(key, tbClosedStock);

        cptitle.getRight().add(tbClosedStock);

        CollapsiblePaneAdapter adapter = new CollapsiblePaneAdapter() {
            @Override
            public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
                cpMap.get(key).setContentPane(createContentPanel4(inventory, tbClosedStock.isSelected()));
            }
        };
        synchronized (cpListener) {
            if (cpListener.containsKey(key)) {
                cpMap.get(key).removeCollapsiblePaneListener(cpListener.get(key));
            }
            cpListener.put(key, adapter);
            cpMap.get(key).addCollapsiblePaneListener(adapter);
        }

        if (!cpMap.get(key).isCollapsed()) {
            cpMap.get(key).setContentPane(createContentPanel4(inventory, tbClosedStock.isSelected()));
        }

        cpMap.get(key).setHorizontalAlignment(SwingConstants.LEADING);
        cpMap.get(key).setOpaque(false);
        cpMap.get(key).setBackground(getColor(SYSConst.medium2, lstInventories.indexOf(inventory) % 2 != 0));

        return cpMap.get(key);
    }
}

From source file:op.care.med.inventory.PnlInventory.java

private CollapsiblePane createCP4(final MedStock stock) {
    /***/*w ww  .  j a va 2s  .  c o  m*/
     *                          _        ____ ____  _  _    __   _             _   __
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |  / /__| |_ ___   ___| | _\ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_| / __| __/ _ \ / __| |/ /| |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| \__ \ || (_) | (__|   < | |
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_| | |___/\__\___/ \___|_|\_\| |
     *                                                     \_\                     /_/
     */
    final String key = stock.getID() + ".xstock";
    synchronized (cpMap) {
        if (!cpMap.containsKey(key)) {
            cpMap.put(key, new CollapsiblePane());
            try {
                cpMap.get(key).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }

        }
        cpMap.get(key).setName("stock");

        BigDecimal sumStock = BigDecimal.ZERO;
        try {
            EntityManager em = OPDE.createEM();
            sumStock = MedStockTools.getSum(em, stock);
            em.close();
        } catch (Exception e) {
            OPDE.fatal(e);
        }

        String title = "<html><table border=\"0\">" + "<tr>" + (stock.isClosed() ? "<s>" : "")
                + "<td width=\"600\" align=\"left\">" + MedStockTools.getAsHTML(stock) + "</td>"
                + "<td width=\"200\" align=\"right\">" + NumberFormat.getNumberInstance().format(sumStock) + " "
                + DosageFormTools.getPackageText(MedInventoryTools.getForm(stock.getInventory())) + "</td>"
                + (stock.isClosed() ? "</s>" : "") + "</tr>" + "</table>" +

                "</html>";

        DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    cpMap.get(key).setCollapsed(!cpMap.get(key).isCollapsed());
                } catch (PropertyVetoException pve) {
                    // BAH!
                }
            }
        });

        cpMap.get(key).setTitleLabelComponent(cptitle.getMain());
        cpMap.get(key).setSlidingDirection(SwingConstants.SOUTH);

        cptitle.getRight().add(new StockPanel(stock));

        if (!stock.getInventory().isClosed()) {
            /***
             *      ____       _       _   _          _          _
             *     |  _ \ _ __(_)_ __ | |_| |    __ _| |__   ___| |
             *     | |_) | '__| | '_ \| __| |   / _` | '_ \ / _ \ |
             *     |  __/| |  | | | | | |_| |__| (_| | |_) |  __/ |
             *     |_|   |_|  |_|_| |_|\__|_____\__,_|_.__/ \___|_|
             *
             */
            final JButton btnPrintLabel = new JButton(SYSConst.icon22print2);
            btnPrintLabel.setPressedIcon(SYSConst.icon22print2Pressed);
            btnPrintLabel.setAlignmentX(Component.RIGHT_ALIGNMENT);
            btnPrintLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPrintLabel.setContentAreaFilled(false);
            btnPrintLabel.setBorder(null);
            btnPrintLabel.setToolTipText(SYSTools.xx("nursingrecords.inventory.stock.btnprintlabel.tooltip"));
            btnPrintLabel.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent actionEvent) {
                    LogicalPrinter logicalPrinter = OPDE.getLogicalPrinters().getMapName2LogicalPrinter()
                            .get(OPDE.getProps().getProperty(SYSPropsTools.KEY_LOGICAL_PRINTER));
                    PrinterForm printerForm1 = logicalPrinter.getForms()
                            .get(OPDE.getProps().getProperty(SYSPropsTools.KEY_MEDSTOCK_LABEL));
                    OPDE.getPrintProcessor().addPrintJob(new PrintListElement(stock, logicalPrinter,
                            printerForm1, OPDE.getProps().getProperty(SYSPropsTools.KEY_PHYSICAL_PRINTER)));
                }
            });
            btnPrintLabel.setEnabled(OPDE.getPrintProcessor().isWorking());
            cptitle.getRight().add(btnPrintLabel);
        }

        /***
         *      __  __
         *     |  \/  | ___ _ __  _   _
         *     | |\/| |/ _ \ '_ \| | | |
         *     | |  | |  __/ | | | |_| |
         *     |_|  |_|\___|_| |_|\__,_|
         *
         */
        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(stock);
                popup.getContentPane().add(pnl);
                popup.setDefaultFocusComponent(pnl);

                GUITools.showPopup(popup, SwingConstants.WEST);
            }
        });
        cptitle.getRight().add(btnMenu);

        CollapsiblePaneAdapter adapter = new CollapsiblePaneAdapter() {
            @Override
            public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
                cpMap.get(key).setContentPane(createContentPanel4(stock));
            }
        };
        synchronized (cpListener) {
            if (cpListener.containsKey(key)) {
                cpMap.get(key).removeCollapsiblePaneListener(cpListener.get(key));
            }
            cpListener.put(key, adapter);
            cpMap.get(key).addCollapsiblePaneListener(adapter);
        }

        if (!cpMap.get(key).isCollapsed()) {
            JPanel contentPane = createContentPanel4(stock);
            cpMap.get(key).setContentPane(contentPane);
        }

        cpMap.get(key).setHorizontalAlignment(SwingConstants.LEADING);
        cpMap.get(key).setOpaque(false);
        cpMap.get(key).setBackground(
                getColor(SYSConst.light3, lstInventories.indexOf(stock.getInventory()) % 2 != 0));

        return cpMap.get(key);
    }
}

From source file:op.care.med.structure.DlgTradeForm.java

private void btnEditActionPerformed(ActionEvent e) {
    PnlDosageForm pnl = new PnlDosageForm((DosageForm) cmbForm.getSelectedItem());

    GUITools.showPopup(GUITools.createPanelPopup(pnl, new Closure() {
        @Override/*from  w  w  w .jav  a2  s . c  o  m*/
        public void execute(Object o) {
            if (o != null) {
                cmbForm.setModel(new DefaultComboBoxModel(new DosageForm[] { (DosageForm) o }));
            }
        }
    }, this), SwingConstants.SOUTH);
}

From source file:op.care.med.structure.DlgTradeForm.java

private void btnAddActionPerformed(ActionEvent e) {
    PnlDosageForm pnl = new PnlDosageForm(new DosageForm(0));

    GUITools.showPopup(GUITools.createPanelPopup(pnl, new Closure() {
        @Override//  ww w  .  j  av  a  2s  . co  m
        public void execute(Object o) {
            if (o != null) {
                cmbForm.setModel(new DefaultComboBoxModel(new DosageForm[] { (DosageForm) o }));
            }
        }
    }, this), SwingConstants.SOUTH);
}

From source file:op.care.nursingprocess.PnlNursingProcess.java

private CollapsiblePane createCP4(final ResInfoCategory cat) {
    /***/* ww w . j  a v a 2 s  .  c o m*/
     *                          _        ____ ____  _  _               _
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |     ___ __ _| |_ ___  __ _  ___  _ __ _   _
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_   / __/ _` | __/ _ \/ _` |/ _ \| '__| | | |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| | (_| (_| | ||  __/ (_| | (_) | |  | |_| |
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_|    \___\__,_|\__\___|\__, |\___/|_|   \__, |
     *                                                                         |___/            |___/
     */
    final String keyCat = cat.getID() + ".xcategory";
    if (!cpMap.containsKey(keyCat)) {
        cpMap.put(keyCat, new CollapsiblePane());
        try {
            cpMap.get(keyCat).setCollapsed(true);
        } catch (PropertyVetoException e) {
            // Bah!
        }
    }
    final CollapsiblePane cpCat = cpMap.get(keyCat);

    String title = "<html><font size=+1><b>" + cat.getText() + "</b></font></html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                //                    if (cpCat.isCollapsed() && !tbInactive.isSelected()  && !isEmpty(cat) && containsOnlyClosedNPs(cat)) {
                //                        tbInactive.setSelected(true);
                //                    }
                cpCat.setCollapsed(!cpCat.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });

    if (isEmpty(cat)) {
        cptitle.getButton().setIcon(SYSConst.icon22ledGreenOff);
    } else if (containsOnlyClosedNPs(cat)) {
        cptitle.getButton().setIcon(SYSConst.icon22stopSign);
    } else {
        cptitle.getButton().setIcon(getIcon(getMinimumNextEvalDays(cat)));
    }

    cpCat.setTitleLabelComponent(cptitle.getMain());
    cpCat.setSlidingDirection(SwingConstants.SOUTH);
    cpCat.setBackground(getColor(cat)[SYSConst.medium2]);
    cpCat.setOpaque(true);
    cpCat.setHorizontalAlignment(SwingConstants.LEADING);

    cpCat.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            JPanel pnlContent = new JPanel(new VerticalLayout());
            if (valuecache.containsKey(cat)) {
                int i = 0; // for zebra pattern
                for (NursingProcess np : valuecache.get(cat)) {
                    //                        if (!np.isClosed()) { // tbInactive.isSelected() ||
                    JPanel pnl = createNPPanel(np);
                    pnl.setBackground(i % 2 == 0 ? Color.WHITE : getColor(cat)[SYSConst.light3]);
                    pnl.setOpaque(true);
                    pnlContent.add(pnl);
                    i++;
                    //                        }
                }
            }
            cpCat.setContentPane(pnlContent);
        }
    });

    if (!cpCat.isCollapsed()) {
        JPanel pnlContent = new JPanel(new VerticalLayout());
        if (valuecache.containsKey(cat)) {
            int i = 0; // for zebra pattern
            for (NursingProcess np : valuecache.get(cat)) {
                //                    if (!np.isClosed()) { // tbInactive.isSelected() ||
                JPanel pnl = createNPPanel(np);
                pnl.setBackground(i % 2 == 0 ? Color.WHITE : getColor(cat)[SYSConst.light3]);
                pnl.setOpaque(true);
                pnlContent.add(pnl);
                i++;
                //                    }
            }
        }
        cpCat.setContentPane(pnlContent);
    }

    return cpCat;
}

From source file:op.care.prescription.PnlPrescription.java

private CollapsiblePane createCP4(final Prescription prescription) {
    /***//  www  . j  a  v  a 2 s  . c  o m
     *                          _        ____ ____  _  _    ______                          _       _   _           __
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \| || |  / /  _ \ _ __ ___  ___  ___ _ __(_)_ __ | |_(_) ___  _ __\ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | || |_| || |_) | '__/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \| |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/|__   _| ||  __/| | |  __/\__ \ (__| |  | | |_) | |_| | (_) | | | | |
     *      \___|_|  \___|\__,_|\__\___|\____|_|      |_| | ||_|   |_|  \___||___/\___|_|  |_| .__/ \__|_|\___/|_| |_| |
     *                                                     \_\                               |_|                    /_/
     */
    final String key = prescription.getID() + ".xprescription";
    if (!cpMap.containsKey(key)) {
        cpMap.put(key, new CollapsiblePane());
        try {
            cpMap.get(key).setCollapsed(true);
        } catch (PropertyVetoException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
    }
    final CollapsiblePane cpPres = cpMap.get(key);

    String title = "<html><table border=\"0\">" + "<tr valign=\"top\">" + "<td width=\"280\" align=\"left\">"
            + prescription.getPITAsHTML() + "</td>" + "<td width=\"380\" align=\"left\">" + "<font size=+1>"
            + PrescriptionTools.getShortDescription(prescription) + "</font>"
            + PrescriptionTools.getDoseAsHTML(prescription)
            + PrescriptionTools.getInventoryInformationAsHTML(prescription) + "</td>"
            + "<td width=\"200\" align=\"left\">" + PrescriptionTools.getOriginalPrescription(prescription)
            + PrescriptionTools.getRemark(prescription) + "</td>";

    if (!prescription.getCommontags().isEmpty()) {
        title += "<tr>" + "    <td colspan=\"3\">" + CommontagsTools.getAsHTML(prescription.getCommontags(),
                SYSConst.html_16x16_tagPurple_internal) + "</td>" + "  </tr>";
    }

    if (PrescriptionTools.isAnnotationNecessary(prescription)) {
        title += "<tr>" + "    <td colspan=\"3\">" + PrescriptionTools.getAnnontationsAsHTML(prescription)
                + "</td>" + "  </tr>";
    }

    title += "</table>" + "</html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, null);
    cpPres.setCollapsible(false);
    cptitle.getButton().setIcon(getIcon(prescription));

    cpPres.setTitleLabelComponent(cptitle.getMain());
    cpPres.setSlidingDirection(SwingConstants.SOUTH);

    if (!prescription.getAttachedFilesConnections().isEmpty()) {
        /***
         *      _     _         _____ _ _
         *     | |__ | |_ _ __ |  ___(_) | ___  ___
         *     | '_ \| __| '_ \| |_  | | |/ _ \/ __|
         *     | |_) | |_| | | |  _| | | |  __/\__ \
         *     |_.__/ \__|_| |_|_|   |_|_|\___||___/
         *
         */
        final JButton btnFiles = new JButton(
                Integer.toString(prescription.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) {
                // checked for acls
                Closure fileHandleClosure = OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE,
                        internalClassID) ? null : new Closure() {
                            @Override
                            public void execute(Object o) {
                                EntityManager em = OPDE.createEM();
                                final Prescription myPrescription = em.find(Prescription.class,
                                        prescription.getID());
                                em.close();
                                lstPrescriptions.remove(prescription);
                                lstPrescriptions.add(myPrescription);
                                Collections.sort(lstPrescriptions);
                                final CollapsiblePane myCP = createCP4(myPrescription);
                                buildPanel();
                                GUITools.flashBackground(myCP, Color.YELLOW, 2);
                            }
                        };
                new DlgFiles(prescription, fileHandleClosure);
            }
        });
        btnFiles.setEnabled(OPDE.isFTPworking());
        cptitle.getRight().add(btnFiles);
    }

    if (!prescription.getAttachedProcessConnections().isEmpty()) {
        /***
         *      _     _         ____
         *     | |__ | |_ _ __ |  _ \ _ __ ___   ___ ___  ___ ___
         *     | '_ \| __| '_ \| |_) | '__/ _ \ / __/ _ \/ __/ __|
         *     | |_) | |_| | | |  __/| | | (_) | (_|  __/\__ \__ \
         *     |_.__/ \__|_| |_|_|   |_|  \___/ \___\___||___/___/
         *
         */
        final JButton btnProcess = new JButton(
                Integer.toString(prescription.getAttachedProcessConnections().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(prescription, 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);
                            Prescription myPrescription = em.merge(prescription);
                            em.lock(myPrescription, LockModeType.OPTIMISTIC_FORCE_INCREMENT);

                            ArrayList<SYSPRE2PROCESS> attached = new ArrayList<SYSPRE2PROCESS>(
                                    prescription.getAttachedProcessConnections());
                            for (SYSPRE2PROCESS linkObject : attached) {
                                if (unassigned.contains(linkObject.getQProcess())) {
                                    linkObject.getQProcess().getAttachedNReportConnections().remove(linkObject);
                                    linkObject.getPrescription().getAttachedProcessConnections()
                                            .remove(linkObject);
                                    em.merge(new PReport(
                                            SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": "
                                                    + myPrescription.getTitle() + " ID: "
                                                    + myPrescription.getID(),
                                            PReportTools.PREPORT_TYPE_REMOVE_ELEMENT,
                                            linkObject.getQProcess()));
                                    em.remove(linkObject);
                                }
                            }
                            attached.clear();

                            for (QProcess qProcess : assigned) {
                                List<QProcessElement> listElements = qProcess.getElements();
                                if (!listElements.contains(myPrescription)) {
                                    QProcess myQProcess = em.merge(qProcess);
                                    SYSPRE2PROCESS myLinkObject = em
                                            .merge(new SYSPRE2PROCESS(myQProcess, myPrescription));
                                    em.merge(new PReport(
                                            SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": "
                                                    + myPrescription.getTitle() + " ID: "
                                                    + myPrescription.getID(),
                                            PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess));
                                    qProcess.getAttachedPrescriptionConnections().add(myLinkObject);
                                    myPrescription.getAttachedProcessConnections().add(myLinkObject);
                                }
                            }

                            em.getTransaction().commit();

                            lstPrescriptions.remove(prescription);
                            lstPrescriptions.add(myPrescription);
                            Collections.sort(lstPrescriptions);
                            final CollapsiblePane myCP = createCP4(myPrescription);
                            buildPanel();
                            GUITools.flashBackground(myCP, 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 (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();
                        }

                    }
                });
            }
        });
        // checked for acls
        btnProcess.setEnabled(OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID));
        cptitle.getRight().add(btnProcess);
    }

    /***
     *      __  __
     *     |  \/  | ___ _ __  _   _
     *     | |\/| |/ _ \ '_ \| | | |
     *     | |  | |  __/ | | | |_| |
     *     |_|  |_|\___|_| |_|\__,_|
     *
     */
    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(prescription);
            popup.getContentPane().add(pnl);
            popup.setDefaultFocusComponent(pnl);

            GUITools.showPopup(popup, SwingConstants.WEST);
        }
    });
    cptitle.getRight().add(btnMenu);

    cpPres.setHorizontalAlignment(SwingConstants.LEADING);
    cpPres.setOpaque(false);

    return cpPres;
}

From source file:op.care.reports.PnlReport.java

private CollapsiblePane createCP4Year(final int year, LocalDate min, LocalDate max) {
    /***/*from  w  ww.  j  a  va  2  s.  com*/
     *                          _        ____ ____     __             __   _______    _    ____
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \   / _| ___  _ __  \ \ / / ____|  / \  |  _ \
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | | |_ / _ \| '__|  \ V /|  _|   / _ \ | |_) |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/  |  _| (_) | |      | | | |___ / ___ \|  _ <
     *      \___|_|  \___|\__,_|\__\___|\____|_|     |_|  \___/|_|      |_| |_____/_/   \_\_| \_\
     *
     */

    final LocalDate start = new LocalDate(year, 1, 1).isBefore(min.dayOfMonth().withMinimumValue())
            ? min.dayOfMonth().withMinimumValue()
            : new LocalDate(year, 1, 1);
    final LocalDate end = new LocalDate(year, 12, 31).isAfter(max.dayOfMonth().withMaximumValue())
            ? max.dayOfMonth().withMaximumValue()
            : new LocalDate(year, 12, 31);

    final String keyYear = Integer.toString(year) + ".year";
    synchronized (cpMap) {
        if (!cpMap.containsKey(keyYear)) {
            cpMap.put(keyYear, new CollapsiblePane());
            try {
                cpMap.get(keyYear).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }

        }
    }

    final CollapsiblePane cpYear = cpMap.get(keyYear);

    String title = "<html><font size=+1>" + "<b>" + Integer.toString(year) + "</b>" + "</font></html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                cpYear.setCollapsed(!cpYear.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });

    cpYear.setTitleLabelComponent(cptitle.getMain());
    cpYear.setSlidingDirection(SwingConstants.SOUTH);
    cpYear.setBackground(SYSConst.orange1[SYSConst.medium3]);
    cpYear.setOpaque(true);

    /***
     *           _ _      _            _
     *       ___| (_) ___| | _____  __| |   ___  _ __    _   _  ___  __ _ _ __
     *      / __| | |/ __| |/ / _ \/ _` |  / _ \| '_ \  | | | |/ _ \/ _` | '__|
     *     | (__| | | (__|   <  __/ (_| | | (_) | | | | | |_| |  __/ (_| | |
     *      \___|_|_|\___|_|\_\___|\__,_|  \___/|_| |_|  \__, |\___|\__,_|_|
     *                                                   |___/
     */
    cpYear.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            JPanel pnlContent = new JPanel(new VerticalLayout());

            // somebody clicked on the year
            for (LocalDate month = end; month.compareTo(start) >= 0; month = month.minusMonths(1)) {
                pnlContent.add(createCP4Month(month));
            }

            cpYear.setContentPane(pnlContent);

        }
    });
    //        cpYear.setBackground(getColor(vtype, SYSConst.light4));

    if (!cpYear.isCollapsed()) {
        JPanel pnlContent = new JPanel(new VerticalLayout());

        for (LocalDate month = end; month.compareTo(start) >= 0; month = month.minusMonths(1)) {
            pnlContent.add(createCP4Month(month));
        }

        cpYear.setContentPane(pnlContent);
        cpYear.setOpaque(false);
    }

    cpYear.setHorizontalAlignment(SwingConstants.LEADING);
    cpYear.setOpaque(false);

    return cpYear;
}

From source file:op.care.reports.PnlReport.java

private CollapsiblePane createCP4Month(final LocalDate month) {
    /***//from  w w  w .  ja  v a2 s  .c o  m
     *                          _        ____ ____     __                      __  __  ___  _   _ _____ _   _
     *       ___ _ __ ___  __ _| |_ ___ / ___|  _ \   / _| ___  _ __    __ _  |  \/  |/ _ \| \ | |_   _| | | |
     *      / __| '__/ _ \/ _` | __/ _ \ |   | |_) | | |_ / _ \| '__|  / _` | | |\/| | | | |  \| | | | | |_| |
     *     | (__| | |  __/ (_| | ||  __/ |___|  __/  |  _| (_) | |    | (_| | | |  | | |_| | |\  | | | |  _  |
     *      \___|_|  \___|\__,_|\__\___|\____|_|     |_|  \___/|_|     \__,_| |_|  |_|\___/|_| \_| |_| |_| |_|
     *
     */
    final String key = monthFormatter.format(month.toDate()) + ".month";
    synchronized (cpMap) {
        if (!cpMap.containsKey(key)) {
            cpMap.put(key, new CollapsiblePane());
            try {
                cpMap.get(key).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }

        }
    }
    final CollapsiblePane cpMonth = cpMap.get(key);

    String title = "<html><font size=+1><b>" + monthFormatter.format(month.toDate()) + "</b>"
            + "</font></html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                cpMonth.setCollapsed(!cpMonth.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) {
        /***
         *      ____       _       _   __  __             _   _
         *     |  _ \ _ __(_)_ __ | |_|  \/  | ___  _ __ | |_| |__
         *     | |_) | '__| | '_ \| __| |\/| |/ _ \| '_ \| __| '_ \
         *     |  __/| |  | | | | | |_| |  | | (_) | | | | |_| | | |
         *     |_|   |_|  |_|_| |_|\__|_|  |_|\___/|_| |_|\__|_| |_|
         *
         */
        final JButton btnPrintMonth = new JButton(SYSConst.icon22print2);
        btnPrintMonth.setPressedIcon(SYSConst.icon22print2Pressed);
        btnPrintMonth.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnPrintMonth.setContentAreaFilled(false);
        btnPrintMonth.setBorder(null);
        btnPrintMonth.setToolTipText(SYSTools.xx("misc.tooltips.btnprintmonth"));
        btnPrintMonth.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                SYSFilesTools.print(NReportTools.getNReportsAsHTML(
                        NReportTools.getNReports4Month(resident, month), true, null, null), false);
            }
        });
        cptitle.getRight().add(btnPrintMonth);
    }
    cpMonth.setTitleLabelComponent(cptitle.getMain());
    cpMonth.setSlidingDirection(SwingConstants.SOUTH);
    cpMonth.setBackground(SYSConst.orange1[SYSConst.medium2]);
    cpMonth.setOpaque(true);
    cpMonth.setHorizontalAlignment(SwingConstants.LEADING);

    cpMonth.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            cpMonth.setContentPane(createContentPanel4Month(month));
        }
    });

    if (!cpMonth.isCollapsed()) {
        cpMonth.setContentPane(createContentPanel4Month(month));
    }

    return cpMonth;
}

From source file:op.care.reports.PnlReport.java

private CollapsiblePane createCP4Week(final LocalDate week) {
    final String key = weekFormater.format(week.toDate()) + ".week";
    synchronized (cpMap) {
        if (!cpMap.containsKey(key)) {
            cpMap.put(key, new CollapsiblePane());
            try {
                cpMap.get(key).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }/*  w  w w .j  a v  a 2 s.c  o  m*/

        }
    }
    final CollapsiblePane cpWeek = cpMap.get(key);

    String title = "<html><font size=+1><b>"
            + DateFormat.getDateInstance(DateFormat.SHORT).format(week.dayOfWeek().withMaximumValue().toDate())
            + " - "
            + DateFormat.getDateInstance(DateFormat.SHORT).format(week.dayOfWeek().withMinimumValue().toDate())
            + " (" + SYSTools.xx("misc.msg.weekinyear") + week.getWeekOfWeekyear() + ")" + "</b>"
            + "</font></html>";

    DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                cpWeek.setCollapsed(!cpWeek.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });

    GUITools.addExpandCollapseButtons(cpWeek, cptitle.getRight());

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) {
        final JButton btnPrintWeek = new JButton(SYSConst.icon22print2);
        btnPrintWeek.setPressedIcon(SYSConst.icon22print2Pressed);
        btnPrintWeek.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnPrintWeek.setContentAreaFilled(false);
        btnPrintWeek.setBorder(null);
        btnPrintWeek.setToolTipText(SYSTools.xx("misc.tooltips.btnprintweek"));
        btnPrintWeek.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                SYSFilesTools.print(NReportTools.getNReportsAsHTML(
                        NReportTools.getNReports4Week(resident, week), true, null, null), false);
            }
        });
        cptitle.getRight().add(btnPrintWeek);
    }

    cpWeek.setTitleLabelComponent(cptitle.getMain());
    cpWeek.setSlidingDirection(SwingConstants.SOUTH);

    cpWeek.setBackground(SYSConst.orange1[SYSConst.medium1]);
    cpWeek.setOpaque(false);
    cpWeek.setHorizontalAlignment(SwingConstants.LEADING);
    //        cpMonth.setBackground(getColor(vtype, SYSConst.light3));

    /***
     *           _ _      _            _                                       _   _
     *       ___| (_) ___| | _____  __| |   ___  _ __    _ __ ___   ___  _ __ | |_| |__
     *      / __| | |/ __| |/ / _ \/ _` |  / _ \| '_ \  | '_ ` _ \ / _ \| '_ \| __| '_ \
     *     | (__| | | (__|   <  __/ (_| | | (_) | | | | | | | | | | (_) | | | | |_| | | |
     *      \___|_|_|\___|_|\_\___|\__,_|  \___/|_| |_| |_| |_| |_|\___/|_| |_|\__|_| |_|
     *
     */
    cpWeek.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            cpWeek.setContentPane(createContenPanel4Week(week));
        }
    });

    if (!cpWeek.isCollapsed()) {
        cpWeek.setContentPane(createContenPanel4Week(week));
    }

    return cpWeek;
}

From source file:op.care.reports.PnlReport.java

private CollapsiblePane createCP4Day(final LocalDate day) {
    final String key = DateFormat.getDateInstance().format(day.toDate());
    synchronized (cpMap) {
        if (!cpMap.containsKey(key)) {
            cpMap.put(key, new CollapsiblePane());
            try {
                cpMap.get(key).setCollapsed(true);
            } catch (PropertyVetoException e) {
                e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
            }/*from   w ww. jav a  2s.  c  om*/
        }
    }
    final CollapsiblePane cpDay = cpMap.get(key);
    String titleDay = "<html><font size=+1>" + dayFormat.format(day.toDate())
            + SYSTools.catchNull(holidays.get(day), " (", ")") + "</font></html>";
    final DefaultCPTitle titleCPDay = new DefaultCPTitle(titleDay, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                cpDay.setCollapsed(!cpDay.isCollapsed());
            } catch (PropertyVetoException pve) {
                // BAH!
            }
        }
    });

    if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) {
        final JButton btnPrintDay = new JButton(SYSConst.icon22print2);
        btnPrintDay.setPressedIcon(SYSConst.icon22print2Pressed);
        btnPrintDay.setAlignmentX(Component.RIGHT_ALIGNMENT);
        btnPrintDay.setContentAreaFilled(false);
        btnPrintDay.setBorder(null);
        btnPrintDay.setToolTipText(SYSTools.xx("misc.tooltips.btnprintday"));
        btnPrintDay.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {
                SYSFilesTools.print(NReportTools.getNReportsAsHTML(NReportTools.getNReports4Day(resident, day),
                        true, null, null), false);
            }
        });
        titleCPDay.getRight().add(btnPrintDay);
    }

    cpDay.setTitleLabelComponent(titleCPDay.getMain());
    cpDay.setSlidingDirection(SwingConstants.SOUTH);

    if (holidays.containsKey(day)) {
        cpDay.setBackground(SYSConst.red1[SYSConst.medium1]);
    } else if (day.getDayOfWeek() == DateTimeConstants.SATURDAY
            || day.getDayOfWeek() == DateTimeConstants.SUNDAY) {
        cpDay.setBackground(SYSConst.red1[SYSConst.light3]);
    } else {
        cpDay.setBackground(SYSConst.orange1[SYSConst.light3]);
    }
    cpDay.setOpaque(true);

    cpDay.setHorizontalAlignment(SwingConstants.LEADING);
    cpDay.setStyle(CollapsiblePane.PLAIN_STYLE);
    cpDay.addCollapsiblePaneListener(new CollapsiblePaneAdapter() {
        @Override
        public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) {
            cpDay.setContentPane(createContentPanel4Day(day));
        }
    });

    if (!cpDay.isCollapsed()) {
        cpDay.setContentPane(createContentPanel4Day(day));
    }

    return cpDay;
}