List of usage examples for javax.swing SwingConstants LEADING
int LEADING
To view the source code for javax.swing SwingConstants LEADING.
Click Source Link
From source file:op.care.supervisor.PnlHandover.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();/*from www.j a va 2 s .c o m*/ } } } final CollapsiblePane cpDay = cpMap.get(key); if (hollidays == null) { hollidays = SYSCalendar.getHolidays(day.getYear(), day.getYear()); } String titleDay = "<html><font size=+1>" + dayFormat.format(day.toDate()) + SYSTools.catchNull(hollidays.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! } } }); final JButton btnAcknowledge = new JButton(SYSConst.icon163ledGreenOn); btnAcknowledge.setAlignmentX(Component.RIGHT_ALIGNMENT); btnAcknowledge.setToolTipText(SYSTools.xx("nursingrecords.handover.tooltips.btnAcknowledge")); btnAcknowledge.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); synchronized (cacheHO) { ArrayList<Handovers> listHO = new ArrayList<Handovers>(cacheHO.get(key)); for (final Handovers ho : listHO) { if (!Handover2UserTools.containsUser(em, ho, OPDE.getLogin().getUser())) { Handovers myHO = em.merge(ho); Handover2User connObj = em .merge(new Handover2User(myHO, em.merge(OPDE.getLogin().getUser()))); myHO.getUsersAcknowledged().add(connObj); } } } synchronized (cacheNR) { ArrayList<NReport> listNR = new ArrayList<NReport>(cacheNR.get(key)); for (final NReport nreport : listNR) { if (!NR2UserTools.containsUser(em, nreport, OPDE.getLogin().getUser())) { NReport myNR = em.merge(nreport); NR2User connObj = em.merge(new NR2User(myNR, em.merge(OPDE.getLogin().getUser()))); myNR.getUsersAcknowledged().add(connObj); } } } em.getTransaction().commit(); createCP4Day(day); 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(); } } }); titleCPDay.getRight().add(btnAcknowledge); cpDay.setTitleLabelComponent(titleCPDay.getMain()); cpDay.setSlidingDirection(SwingConstants.SOUTH); if (hollidays.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) { createContentPanel4Day(day, cpDay); btnAcknowledge.setEnabled(true); } @Override public void paneCollapsed(CollapsiblePaneEvent collapsiblePaneEvent) { btnAcknowledge.setEnabled(false); } }); btnAcknowledge.setEnabled(!cpDay.isCollapsed()); if (!cpDay.isCollapsed()) { createContentPanel4Day(day, cpDay); } return cpDay; }
From source file:op.care.values.PnlValues.java
private CollapsiblePane createCP4Type(final ResValueTypes vtype) { final String keyType = vtype.getID() + ".xtypes"; final CollapsiblePane cpType = getCP(keyType); final DefaultCPTitle cptitle = new DefaultCPTitle(vtype.getText(), new ActionListener() { @Override//from w w w . ja v a2 s . c o m public void actionPerformed(ActionEvent e) { try { cpType.setCollapsed(!cpType.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cptitle.getButton().setFont(SYSConst.ARIAL24); cptitle.getButton().setForeground(vtype.getColor()); cpType.setBackground(Color.white); cpType.setTitleLabelComponent(cptitle.getMain()); cpType.setSlidingDirection(SwingConstants.SOUTH); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) { /*** * _ _ _ __ _____ __ * / \ __| | __| | / /_ __ ___ _ __ |_ _| _ _ __ __\ \ * / _ \ / _` |/ _` | | || '_ \ / _ \ '__| | || | | | '_ \ / _ \ | * / ___ \ (_| | (_| | | || |_) | __/ | | || |_| | |_) | __/ | * /_/ \_\__,_|\__,_| | || .__/ \___|_| |_| \__, | .__/ \___| | * \_\_| |___/|_| /_/ */ final JButton btnAdd = new JButton(SYSConst.icon22add); btnAdd.setPressedIcon(SYSConst.icon22addPressed); btnAdd.setAlignmentX(Component.RIGHT_ALIGNMENT); btnAdd.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); btnAdd.setContentAreaFilled(false); btnAdd.setBorder(null); btnAdd.setToolTipText( SYSTools.xx("nursingrecords.vitalparameters.btnAdd.tooltip") + " (" + vtype.getText() + ")"); btnAdd.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { addValue(vtype); } }); cptitle.getRight().add(btnAdd); btnAdd.setEnabled(resident.isActive()); } cpType.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpType.setContentPane(createContentPanel4Type(vtype)); } }); if (!cpType.isCollapsed()) { cpType.setContentPane(createContentPanel4Type(vtype)); } if (!ResValueTools.getYearsWithValues(resident, vtype).isEmpty()) { // cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOn); cpType.setCollapsible(true); } else { // cptitle.getTitleButton().setIcon(SYSConst.icon22ledGreenOff); cpType.setCollapsible(false); } cpType.setHorizontalAlignment(SwingConstants.LEADING); cpType.setOpaque(false); // cpType.setBackground(getColor(vtype, SYSConst.medium1)); return cpType; }
From source file:op.care.values.PnlValues.java
private CollapsiblePane createCP4Year(final ResValueTypes vtype, final int year) { final String keyYears = vtype.getID() + ".xtypes." + Integer.toString(year) + ".year"; final CollapsiblePane cpYear = getCP(keyYears); DefaultCPTitle cptitle = new DefaultCPTitle(Integer.toString(year), new ActionListener() { @Override/*from ww w . jav a 2s . c om*/ public void actionPerformed(ActionEvent e) { try { cpYear.setCollapsed(!cpYear.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cptitle.getButton().setFont(SYSConst.ARIAL18); cptitle.getButton().setForeground(GUITools.blend(vtype.getColor(), Color.BLACK, 0.75f)); cpYear.setBackground(Color.white); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) { final JButton btnPrintYear = new JButton(SYSConst.icon22print2); btnPrintYear.setPressedIcon(SYSConst.icon22print2Pressed); btnPrintYear.setAlignmentX(Component.RIGHT_ALIGNMENT); btnPrintYear.setContentAreaFilled(false); btnPrintYear.setBorder(null); btnPrintYear.setToolTipText(SYSTools.xx("misc.tooltips.btnprintyear")); btnPrintYear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { if (!mapType2Values.containsKey(keyYears)) { mapType2Values.put(keyYears, ResValueTools.getResValues(resident, vtype, year)); } SYSFilesTools.print(SYSTools.toHTML(ResValueTools.getAsHTML(mapType2Values.get(keyYears))), true); } }); cptitle.getRight().add(btnPrintYear); } cpYear.setTitleLabelComponent(cptitle.getMain()); cpYear.setSlidingDirection(SwingConstants.SOUTH); cpYear.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { // if (vtype.getValType() == ResValueTypesTools.LIQUIDBALANCE) { // cpYear.setContentPane(createContentPanel4Year(year)); // } else { cpYear.setContentPane(createContentPanel4Year(vtype, year)); // } cpYear.setOpaque(false); } }); // cpYear.setBackground(getColor(vtype, SYSConst.light4)); if (!cpYear.isCollapsed()) { // if (vtype.getValType() == ResValueTypesTools.LIQUIDBALANCE) { // cpYear.setContentPane(createContentPanel4Year(year)); // } else { cpYear.setContentPane(createContentPanel4Year(vtype, year)); // } cpYear.setOpaque(false); } cpYear.setHorizontalAlignment(SwingConstants.LEADING); cpYear.setOpaque(false); return cpYear; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Fall() { final CollapsiblePane cpPain = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.fall") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override// ww w. java 2s . com public void actionPerformed(ActionEvent e) { try { cpPain.setCollapsed(!cpPain.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpPain.setTitleLabelComponent(cptitle.getMain()); cpPain.setSlidingDirection(SwingConstants.SOUTH); cpPain.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpPain.setContentPane(createContentPanel4Pain()); } }); if (!cpPain.isCollapsed()) { cpPain.setContentPane(createContentPanel4Fall()); } cpPain.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpPain; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Pain() { final CollapsiblePane cpPain = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.pain") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override/*from w w w .j a v a 2s. c o m*/ public void actionPerformed(ActionEvent e) { try { cpPain.setCollapsed(!cpPain.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpPain.setTitleLabelComponent(cptitle.getMain()); cpPain.setSlidingDirection(SwingConstants.SOUTH); cpPain.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpPain.setContentPane(createContentPanel4Pain()); } }); if (!cpPain.isCollapsed()) { cpPain.setContentPane(createContentPanel4Pain()); } cpPain.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpPain; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Orga() { final CollapsiblePane cpOrga = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.orga") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override/*w w w. j a v a2 s .c o m*/ public void actionPerformed(ActionEvent e) { try { cpOrga.setCollapsed(!cpOrga.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpOrga.setTitleLabelComponent(cptitle.getMain()); cpOrga.setSlidingDirection(SwingConstants.SOUTH); cpOrga.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpOrga.setContentPane(createContentPanel4Orga()); } }); if (!cpOrga.isCollapsed()) { cpOrga.setContentPane(createContentPanel4Orga()); } cpOrga.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpOrga; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Staff() { final CollapsiblePane cpStaff = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.staff") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override//from w ww .ja v a2s . c o m public void actionPerformed(ActionEvent e) { try { cpStaff.setCollapsed(!cpStaff.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpStaff.setTitleLabelComponent(cptitle.getMain()); cpStaff.setSlidingDirection(SwingConstants.SOUTH); cpStaff.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpStaff.setContentPane(createContentPanel4Orga()); } }); if (!cpStaff.isCollapsed()) { cpStaff.setContentPane(createContentPanel4Staff()); } cpStaff.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpStaff; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Hygiene() { final CollapsiblePane cpHygiene = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.hygiene") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override/*w ww . j ava 2 s . c om*/ public void actionPerformed(ActionEvent e) { try { cpHygiene.setCollapsed(!cpHygiene.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpHygiene.setTitleLabelComponent(cptitle.getMain()); cpHygiene.setSlidingDirection(SwingConstants.SOUTH); cpHygiene.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpHygiene.setContentPane(createContentPanel4Hygiene()); } }); if (!cpHygiene.isCollapsed()) { cpHygiene.setContentPane(createContentPanel4Hygiene()); } cpHygiene.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpHygiene; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Nutrition() { final CollapsiblePane cpOrga = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.nutrition") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override//from w ww.ja va2s.c o m public void actionPerformed(ActionEvent e) { try { cpOrga.setCollapsed(!cpOrga.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpOrga.setTitleLabelComponent(cptitle.getMain()); cpOrga.setSlidingDirection(SwingConstants.SOUTH); cpOrga.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpOrga.setContentPane(createContentPanel4Nutrition()); } }); if (!cpOrga.isCollapsed()) { cpOrga.setContentPane(createContentPanel4Nutrition()); } cpOrga.setHorizontalAlignment(SwingConstants.LEADING); // cpOrga.setOpaque(false); // cpOrga.setBackground(getColor(vtype, SYSConst.medium1)); return cpOrga; }
From source file:op.controlling.PnlControlling.java
private CollapsiblePane createCP4Drugs() { final CollapsiblePane cpDrugs = new CollapsiblePane(); String title = "<html><font size=+1>" + SYSTools.xx("opde.controlling.drugs") + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override/*from ww w . j a v a2 s. com*/ public void actionPerformed(ActionEvent e) { try { cpDrugs.setCollapsed(!cpDrugs.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); cpDrugs.setTitleLabelComponent(cptitle.getMain()); cpDrugs.setSlidingDirection(SwingConstants.SOUTH); cpDrugs.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { cpDrugs.setContentPane(createContentPanel4Drugs()); } }); if (!cpDrugs.isCollapsed()) { cpDrugs.setContentPane(createContentPanel4Drugs()); } cpDrugs.setHorizontalAlignment(SwingConstants.LEADING); return cpDrugs; }