List of usage examples for java.beans PropertyVetoException printStackTrace
public void printStackTrace()
From source file:op.allowance.PnlAllowance.java
private PnlTX getPnlTX(Resident resident, final Allowance allowance) { final BigDecimal editAmount = allowance != null ? allowance.getAmount() : null; final Allowance allow = (allowance == null ? new Allowance(resident) : allowance); return new PnlTX(allow, new Closure() { @Override//from w ww. j ava 2 s.com public void execute(Object o) { if (o != null) { EntityManager em = OPDE.createEM(); try { em.getTransaction().begin(); final Allowance myAllowance = em.merge((Allowance) o); em.lock(em.merge(myAllowance.getResident()), LockModeType.OPTIMISTIC); em.getTransaction().commit(); DateTime txDate = new DateTime(myAllowance.getPit()); final String keyResident = myAllowance.getResident().getRID(); final String keyYear = myAllowance.getResident().getRID() + "-" + txDate.getYear(); final String keyMonth = myAllowance.getResident().getRID() + "-" + txDate.getYear() + "-" + txDate.getMonthOfYear(); if (!lstResidents.contains(myAllowance.getResident())) { lstResidents.add(myAllowance.getResident()); Collections.sort(lstResidents); } if (!cashmap.containsKey(keyMonth)) { cashmap.put(keyMonth, AllowanceTools.getMonth(myAllowance.getResident(), myAllowance.getPit())); } else { if (cashmap.get(keyMonth).contains(myAllowance)) { cashmap.get(keyMonth).remove(myAllowance); } cashmap.get(keyMonth).add(myAllowance); Collections.sort(cashmap.get(keyMonth)); } // little trick to fix the carries if (editAmount != null) { updateCarrySums(myAllowance.getResident(), new LocalDate(myAllowance.getPit()), editAmount.negate()); } // add the new / edited amount updateCarrySums(myAllowance); createCP4(myAllowance.getResident()); try { if (cpMap.get(keyResident).isCollapsed()) cpMap.get(keyResident).setCollapsed(false); if (cpMap.get(keyYear).isCollapsed()) cpMap.get(keyYear).setCollapsed(false); if (cpMap.get(keyMonth).isCollapsed()) cpMap.get(keyMonth).setCollapsed(false); } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } buildPanel(); GUITools.scroll2show(jspCash, cpMap.get(keyMonth), cpsCash, new Closure() { @Override public void execute(Object o) { GUITools.flashBackground(linemap.get(myAllowance), 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(); } } } }); }
From source file:op.allowance.PnlAllowance.java
private CollapsiblePane createCP4(final Resident resident) { /***/*from ww w .j ava 2s. co m*/ * _ ____ ____ _ _ ______ _ _ _ __ * ___ _ __ ___ __ _| |_ ___ / ___| _ \| || | / / _ \ ___ ___(_) __| | ___ _ __ | |\ \ * / __| '__/ _ \/ _` | __/ _ \ | | |_) | || |_| || |_) / _ \/ __| |/ _` |/ _ \ '_ \| __| | * | (__| | | __/ (_| | || __/ |___| __/|__ _| || _ < __/\__ \ | (_| | __/ | | | |_| | * \___|_| \___|\__,_|\__\___|\____|_| |_| | ||_| \_\___||___/_|\__,_|\___|_| |_|\__| | * \_\ /_/ */ final String key = resident.getRID(); 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 cpResident = cpMap.get(key); if (!carrySums.containsKey(getKey(resident, SYSCalendar.eoy(new LocalDate())))) { carrySums.put(getKey(resident, SYSCalendar.eoy(new LocalDate())), AllowanceTools.getSUM(resident, SYSCalendar.eoy(new LocalDate()))); } BigDecimal sumOverall = carrySums.get(getKey(resident, SYSCalendar.eoy(new LocalDate()))); String title = "<html><table border=\"0\">" + "<tr>" + "<td width=\"520\" align=\"left\"><font size=+1>" + resident.toString() + "</font></td>" + "<td width=\"200\" align=\"right\"><font size=+1" + (sumOverall.compareTo(BigDecimal.ZERO) < 0 ? " color=\"red\" " : "") + ">" + cf.format(sumOverall) + "</font></td>" + "</tr>" + "</table>" + "</html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cpResident.setCollapsed(!cpResident.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); if (OPDE.getAppInfo().isAllowedTo(InternalClassACL.ARCHIVE, internalClassID) && OPDE.getAppInfo().isAllowedTo(InternalClassACL.PRINT, internalClassID)) { /*** * ____ _ _ ____ _ _ _ * | _ \ _ __(_)_ __ | |_| _ \ ___ ___(_) __| | ___ _ __ | |_ * | |_) | '__| | '_ \| __| |_) / _ \/ __| |/ _` |/ _ \ '_ \| __| * | __/| | | | | | | |_| _ < __/\__ \ | (_| | __/ | | | |_ * |_| |_| |_|_| |_|\__|_| \_\___||___/_|\__,_|\___|_| |_|\__| * */ final JButton btnPrintResident = new JButton(SYSConst.icon22print2); btnPrintResident.setPressedIcon(SYSConst.icon22print2Pressed); btnPrintResident.setAlignmentX(Component.RIGHT_ALIGNMENT); btnPrintResident.setContentAreaFilled(false); btnPrintResident.setBorder(null); btnPrintResident.setToolTipText(SYSTools.xx("admin.residents.cash.btnprintresident.tooltip")); btnPrintResident.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { SYSFilesTools.print( AllowanceTools.getAsHTML(AllowanceTools.getAll(resident), BigDecimal.ZERO, resident), true); } }); cptitle.getRight().add(btnPrintResident); } cpResident.setTitleLabelComponent(cptitle.getMain()); cpResident.setSlidingDirection(SwingConstants.SOUTH); /*** * _ _ _ _ _ _ _ * ___| (_) ___| | _____ __| | ___ _ __ _ __ ___ ___(_) __| | ___ _ __ | |_ * / __| | |/ __| |/ / _ \/ _` | / _ \| '_ \ | '__/ _ \/ __| |/ _` |/ _ \ '_ \| __| * | (__| | | (__| < __/ (_| | | (_) | | | | | | | __/\__ \ | (_| | __/ | | | |_ * \___|_|_|\___|_|\_\___|\__,_| \___/|_| |_| |_| \___||___/_|\__,_|\___|_| |_|\__| * */ cpResident.addCollapsiblePaneListener(new CollapsiblePaneAdapter() { @Override public void paneExpanded(CollapsiblePaneEvent collapsiblePaneEvent) { // somebody clicks on the name of the resident. the cash informations // are loaded from the database, if necessary. cpResident.setContentPane(createContentPanel4(resident)); } }); cpResident.setBackground(getBG(resident, 7)); if (!cpResident.isCollapsed()) { cpResident.setContentPane(createContentPanel4(resident)); } cpResident.setHorizontalAlignment(SwingConstants.LEADING); cpResident.setOpaque(false); return cpResident; }
From source file:canreg.client.gui.analysis.ExportReportInternalFrame.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from www .j a v a 2s .com*/ */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { resultPanel = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); exportSourceInformationCheckBox = new javax.swing.JCheckBox(); jSplitPane1 = new javax.swing.JSplitPane(); rangeFilterPanel = new canreg.client.gui.components.RangeFilterPanel(); variableChooserPanel = new canreg.client.gui.components.VariablesChooserPanel(); settingsPanel = new javax.swing.JPanel(); setupPanel = new javax.swing.JPanel(); loadSetupButton = new javax.swing.JButton(); saveSetupButton = new javax.swing.JButton(); optionsPanel = new javax.swing.JPanel(); headingCheckBox = new javax.swing.JCheckBox(); variableNamesComboBox = new javax.swing.JComboBox(); variableNamesLabel = new javax.swing.JLabel(); fileFormatLabel = new javax.swing.JLabel(); fileFormatComboBox = new javax.swing.JComboBox(); formatDateCheckBox = new javax.swing.JCheckBox(); correctUnknownCheckBox = new javax.swing.JCheckBox(); dateFormatComboBox = new javax.swing.JComboBox(); exportPanel = new javax.swing.JPanel(); writeFileButton = new javax.swing.JButton(); setClosable(true); setMaximizable(true); setResizable(true); org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(canreg.client.CanRegClientApp.class).getContext() .getResourceMap(ExportReportInternalFrame.class); setTitle(resourceMap.getString("Form.title")); // NOI18N setDoubleBuffered(true); setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N setMinimumSize(new java.awt.Dimension(800, 400)); setName("Form"); // NOI18N try { setSelected(true); } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace(); } resultPanel.setBorder( javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("resultPanel.border.title"))); // NOI18N resultPanel.setName("resultPanel"); // NOI18N javax.swing.GroupLayout resultPanelLayout = new javax.swing.GroupLayout(resultPanel); resultPanel.setLayout(resultPanelLayout); resultPanelLayout.setHorizontalGroup(resultPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); resultPanelLayout.setVerticalGroup(resultPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 173, Short.MAX_VALUE)); jTabbedPane1.setName("jTabbedPane1"); // NOI18N jPanel1.setName("jPanel1"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(canreg.client.CanRegClientApp.class).getContext() .getActionMap(ExportReportInternalFrame.class, this); exportSourceInformationCheckBox.setAction(actionMap.get("exportSourceInformationTickBoxUpdated")); // NOI18N exportSourceInformationCheckBox.setText(resourceMap.getString("exportSourceInformationCheckBox.text")); // NOI18N exportSourceInformationCheckBox .setToolTipText(resourceMap.getString("exportSourceInformationCheckBox.toolTipText")); // NOI18N exportSourceInformationCheckBox.setName("exportSourceInformationCheckBox"); // NOI18N jSplitPane1.setDividerLocation(400); jSplitPane1.setResizeWeight(0.5); jSplitPane1.setName("jSplitPane1"); // NOI18N rangeFilterPanel.setName("rangeFilterPanel"); // NOI18N jSplitPane1.setLeftComponent(rangeFilterPanel); variableChooserPanel.setName("variableChooserPanel"); // NOI18N jSplitPane1.setRightComponent(variableChooserPanel); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout .setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSplitPane1).addGroup(jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE).addComponent(exportSourceInformationCheckBox))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jSplitPane1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(exportSourceInformationCheckBox))); jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N settingsPanel.setName("settingsPanel"); // NOI18N setupPanel.setBorder( javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("setupPanel.border.title"))); // NOI18N setupPanel.setName("setupPanel"); // NOI18N loadSetupButton.setText(resourceMap.getString("loadSetupButton.text")); // NOI18N loadSetupButton.setEnabled(false); loadSetupButton.setName("loadSetupButton"); // NOI18N saveSetupButton.setText(resourceMap.getString("saveSetupButton.text")); // NOI18N saveSetupButton.setEnabled(false); saveSetupButton.setName("saveSetupButton"); // NOI18N javax.swing.GroupLayout setupPanelLayout = new javax.swing.GroupLayout(setupPanel); setupPanel.setLayout(setupPanelLayout); setupPanelLayout .setHorizontalGroup(setupPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(setupPanelLayout.createSequentialGroup().addComponent(loadSetupButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(saveSetupButton))); setupPanelLayout.setVerticalGroup(setupPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(setupPanelLayout.createSequentialGroup() .addGroup(setupPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(loadSetupButton).addComponent(saveSetupButton)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); optionsPanel.setBorder( javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("optionsPanel.border.title"))); // NOI18N optionsPanel.setName("optionsPanel"); // NOI18N headingCheckBox.setSelected(true); headingCheckBox.setText(resourceMap.getString("headingCheckBox.text")); // NOI18N headingCheckBox.setEnabled(false); headingCheckBox.setName("headingCheckBox"); // NOI18N variableNamesComboBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Short", "English", "Full", "Standard" })); variableNamesComboBox.setName("variableNamesComboBox"); // NOI18N variableNamesLabel.setText(resourceMap.getString("variableNamesLabel.text")); // NOI18N variableNamesLabel.setName("variableNamesLabel"); // NOI18N fileFormatLabel.setText(resourceMap.getString("fileFormatLabel.text")); // NOI18N fileFormatLabel.setName("fileFormatLabel"); // NOI18N fileFormatComboBox.setEditable(true); fileFormatComboBox.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Comma Separated", "Tab Separated Values" })); fileFormatComboBox.setName("fileFormatComboBox"); // NOI18N formatDateCheckBox.setAction(actionMap.get("formatDateCheckBoxChanged")); // NOI18N formatDateCheckBox.setText(resourceMap.getString("formatDateCheckBox.text")); // NOI18N formatDateCheckBox.setToolTipText(resourceMap.getString("formatDateCheckBox.toolTipText")); // NOI18N formatDateCheckBox.setName("formatDateCheckBox"); // NOI18N correctUnknownCheckBox.setText(resourceMap.getString("correctUnknownCheckBox.text")); // NOI18N correctUnknownCheckBox.setToolTipText(resourceMap.getString("correctUnknownCheckBox.toolTipText")); // NOI18N correctUnknownCheckBox.setEnabled(false); correctUnknownCheckBox.setName("correctUnknownCheckBox"); // NOI18N dateFormatComboBox.setEditable(true); dateFormatComboBox.setModel(new javax.swing.DefaultComboBoxModel( new String[] { "dd/mm/yyyy", "mm/dd/yyyy", "mm/dd/yy", "yyyy/mm/dd" })); dateFormatComboBox.setToolTipText(resourceMap.getString("dateFormatComboBox.toolTipText")); // NOI18N dateFormatComboBox.setEnabled(false); dateFormatComboBox.setName("dateFormatComboBox"); // NOI18N dateFormatComboBox.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { dateFormatComboBoxMousePressed(evt); } }); javax.swing.GroupLayout optionsPanelLayout = new javax.swing.GroupLayout(optionsPanel); optionsPanel.setLayout(optionsPanelLayout); optionsPanelLayout.setHorizontalGroup(optionsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(optionsPanelLayout.createSequentialGroup().addGroup(optionsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(optionsPanelLayout.createSequentialGroup() .addComponent(variableNamesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(variableNamesLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 526, Short.MAX_VALUE) .addComponent(headingCheckBox)) .addGroup(optionsPanelLayout.createSequentialGroup().addComponent(fileFormatLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(fileFormatComboBox, 0, 713, Short.MAX_VALUE)) .addGroup(optionsPanelLayout.createSequentialGroup().addComponent(formatDateCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(dateFormatComboBox, 0, 691, Short.MAX_VALUE)) .addComponent(correctUnknownCheckBox)).addContainerGap())); optionsPanelLayout.setVerticalGroup(optionsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(optionsPanelLayout.createSequentialGroup().addGroup(optionsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(variableNamesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(variableNamesLabel).addComponent(headingCheckBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(fileFormatLabel).addComponent(fileFormatComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(optionsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(formatDateCheckBox).addComponent(dateFormatComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(correctUnknownCheckBox).addGap(28, 28, 28))); exportPanel.setBorder( javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("exportPanel.border.title"))); // NOI18N exportPanel.setName("exportPanel"); // NOI18N writeFileButton.setAction(actionMap.get("writeFileAction")); // NOI18N writeFileButton.setName("writeFileButton"); // NOI18N javax.swing.GroupLayout exportPanelLayout = new javax.swing.GroupLayout(exportPanel); exportPanel.setLayout(exportPanelLayout); exportPanelLayout .setHorizontalGroup(exportPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(writeFileButton, javax.swing.GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE)); exportPanelLayout.setVerticalGroup(exportPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(exportPanelLayout.createSequentialGroup() .addComponent(writeFileButton, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) .addContainerGap())); javax.swing.GroupLayout settingsPanelLayout = new javax.swing.GroupLayout(settingsPanel); settingsPanel.setLayout(settingsPanelLayout); settingsPanelLayout.setHorizontalGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(settingsPanelLayout.createSequentialGroup() .addComponent(setupPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(exportPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(optionsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); settingsPanelLayout.setVerticalGroup(settingsPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(settingsPanelLayout.createSequentialGroup() .addComponent(optionsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(settingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(exportPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(setupPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(84, Short.MAX_VALUE))); jTabbedPane1.addTab(resourceMap.getString("settingsPanel.TabConstraints.tabTitle"), settingsPanel); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane1).addComponent(resultPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(resultPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pack(); }
From source file:edu.umass.cs.reconfiguration.SQLReconfiguratorDB.java
private static DataSource setupDataSourceC3P0(String connectURI, Properties props) throws SQLException { ComboPooledDataSource cpds = new ComboPooledDataSource(); try {/*from w w w . j a va 2s . c om*/ cpds.setDriverClass(SQL.getDriver(SQL_TYPE)); cpds.setJdbcUrl(connectURI); cpds.setUser(props.getProperty("user")); cpds.setPassword(props.getProperty("password")); cpds.setAutoCommitOnClose(true); cpds.setMaxPoolSize(MAX_POOL_SIZE); } catch (PropertyVetoException pve) { pve.printStackTrace(); } return cpds; }
From source file:op.allowance.PnlAllowance.java
private CollapsiblePane createCP4(final Resident resident, final int year) { LocalDate min = SYSCalendar.bom(minmax.get(resident).getFirst()); LocalDate max = resident.isActive() ? new LocalDate() : SYSCalendar.eom(minmax.get(resident).getSecond()); 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 key = resident.getRID() + "-" + year; if (!cpMap.containsKey(key)) { cpMap.put(key, new CollapsiblePane()); try {/*from ww w .j a v a 2 s .c o m*/ cpMap.get(key).setCollapsed(true); } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } final CollapsiblePane cpYear = cpMap.get(key); if (!carrySums.containsKey(key + "-12")) { carrySums.put(key + "-12", AllowanceTools.getSUM(resident, SYSCalendar.eoy(start))); } String title = "<html><table border=\"0\">" + "<tr>" + "<td width=\"520\" align=\"left\"><font size=+1>" + Integer.toString(year) + "</font></td>" + "<td width=\"200\" align=\"right\">" + (carrySums.get(key + "-12").compareTo(BigDecimal.ZERO) < 0 ? "<font color=\"red\">" : "") + cf.format(carrySums.get(key + "-12")) + (carrySums.get(key + "-12").compareTo(BigDecimal.ZERO) < 0 ? "</font>" : "") + "</td>" + "</tr>" + "</table>" + "</font></html>"; DefaultCPTitle cptitle = new DefaultCPTitle(title, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { cpYear.setCollapsed(!cpYear.isCollapsed()); } catch (PropertyVetoException pve) { // BAH! } } }); GUITools.addExpandCollapseButtons(cpYear, cptitle.getRight()); /*** * ____ _ _ __ __ * | _ \ _ __(_)_ __ | |\ \ / /__ __ _ _ __ * | |_) | '__| | '_ \| __\ V / _ \/ _` | '__| * | __/| | | | | | | |_ | | __/ (_| | | * |_| |_| |_|_| |_|\__||_|\___|\__,_|_| * */ 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) { String carry4printKey = resident.getRID() + "-" + (year - 1) + "-12"; if (!carrySums.containsKey(carry4printKey)) { carrySums.put(carry4printKey, AllowanceTools.getSUM(resident, SYSCalendar.eoy(start.minusYears(1)))); } SYSFilesTools.print(AllowanceTools.getAsHTML(AllowanceTools.getYear(resident, start.toDate()), carrySums.get(carry4printKey), resident), true); } }); cptitle.getRight().add(btnPrintYear); 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 // monthly informations will be generated. even if there // are no allowances for that month for (LocalDate month = end; month.compareTo(start) >= 0; month = month.minusMonths(1)) { pnlContent.add(createCP4(resident, month)); } cpYear.setContentPane(pnlContent); cpYear.setOpaque(false); } }); cpYear.setBackground(getBG(resident, 9)); if (!cpYear.isCollapsed()) { JPanel pnlContent = new JPanel(new VerticalLayout()); for (LocalDate month = end; month.compareTo(start) > 0; month = month.minusMonths(1)) { pnlContent.add(createCP4(resident, month)); } cpYear.setContentPane(pnlContent); } cpYear.setHorizontalAlignment(SwingConstants.LEADING); cpYear.setOpaque(false); return cpYear; }
From source file:org.monome.pages.configuration.Configuration.java
public ArcConfiguration addArcConfiguration(int index, String prefix, String serial, int knobs, ArrayList<MIDIPageChangeRule> midiPageChangeRules) { ArcFrame arcFrame = new ArcFrame(index); try {//from w w w . j a v a 2s . c o m arcFrame.setSelected(true); } catch (PropertyVetoException e) { e.printStackTrace(); } MainGUI.getDesktopPane().add(arcFrame); arcFrame.moveToFront(); ArcConfiguration arc = ArcConfigurationFactory.addArcConfiguration(index, prefix, serial, knobs, arcFrame, midiPageChangeRules); this.initArcSerialOSC(arc); return arc; }
From source file:org.monome.pages.configuration.Configuration.java
/** * Called from GUI to add a new monome configuration. * /* ww w .j av a2 s.co m*/ * @param index the index of this monome configuration * @param prefix the prefix of the monome (ie. /40h) * @param serial the serial # of the monome * @param sizeX the width of the monome in buttons (ie 8) * @param sizeY the height of the monome in buttons (ie 8) * @param usePageChangeButton true if the page change button is active * @param useMIDIPageChanging true if midi page change rules should be used * @param midiPageChangeRules the set of midi page change rules * @return the MonomeConfiguration object */ public MonomeConfiguration addMonomeConfiguration(int index, String prefix, String serial, int sizeX, int sizeY, boolean usePageChangeButton, boolean useMIDIPageChanging, ArrayList<MIDIPageChangeRule> midiPageChangeRules) { MonomeFrame monomeFrame = new MonomeFrame(index); MainGUI.getDesktopPane().add(monomeFrame); try { monomeFrame.setSelected(true); } catch (PropertyVetoException e) { e.printStackTrace(); } MonomeConfiguration monome = MonomeConfigurationFactory.addMonomeConfiguration(index, prefix, serial, sizeX, sizeY, usePageChangeButton, useMIDIPageChanging, midiPageChangeRules, monomeFrame); this.initMonome(monome); return monome; }
From source file:org.monome.pages.configuration.Configuration.java
public MonomeConfiguration addMonomeConfigurationSerialOSC(int index, String prefix, String serial, int sizeX, int sizeY, boolean usePageChangeButton, boolean useMIDIPageChanging, ArrayList<MIDIPageChangeRule> midiPageChangeRules, int port, String hostName) { MonomeFrame monomeFrame = new MonomeFrame(index); MainGUI.getDesktopPane().add(monomeFrame); try {//from w ww . jav a 2 s . c o m monomeFrame.setSelected(true); } catch (PropertyVetoException e) { e.printStackTrace(); } MonomeConfiguration monome = MonomeConfigurationFactory.addMonomeConfiguration(index, prefix, serial, sizeX, sizeY, usePageChangeButton, useMIDIPageChanging, midiPageChangeRules, monomeFrame); monome.serialOSCPort = port; monome.serialOSCHostname = hostName; this.initMonomeSerialOSC(monome); return monome; }
From source file:org.monome.pages.configuration.Configuration.java
public ArcConfiguration addArcConfigurationSerialOSC(int index, String prefix, String serial, int knobs, int port, String hostName) { ArcFrame arcFrame = new ArcFrame(index); try {/*from w w w.j a v a 2s .c o m*/ arcFrame.setSelected(true); } catch (PropertyVetoException e) { e.printStackTrace(); } MainGUI.getDesktopPane().add(arcFrame); arcFrame.moveToFront(); ArrayList<MIDIPageChangeRule> midiPageChangeRules = new ArrayList<MIDIPageChangeRule>(); ArcConfiguration arc = ArcConfigurationFactory.addArcConfiguration(index, prefix, serial, knobs, arcFrame, midiPageChangeRules); arc.serialOSCPort = port; arc.serialOSCHostname = hostName; this.initArcSerialOSC(arc); return arc; }
From source file:op.care.values.PnlValues.java
private JPanel getMenu(final ResValue resValue) { final ResValueTypes vtype = resValue.getType(); JPanel pnlMenu = new JPanel(new VerticalLayout()); boolean doesNotBelongToResInfos = ResInfoTools.getInfosFor(resValue).isEmpty(); if (doesNotBelongToResInfos && OPDE.getAppInfo().isAllowedTo(InternalClassACL.UPDATE, internalClassID)) { /***/* w w w . j ava 2 s. com*/ * _____ _ _ _ * | ____|__| (_) |_ * | _| / _` | | __| * | |__| (_| | | |_ * |_____\__,_|_|\__| * */ final JButton btnEdit = GUITools.createHyperlinkButton("nursingrecords.vitalparameters.btnEdit.tooltip", SYSConst.icon22edit3, null); btnEdit.setAlignmentX(Component.RIGHT_ALIGNMENT); btnEdit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent actionEvent) { new DlgValue(resValue.clone(), DlgValue.MODE_EDIT, 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); final ResValue newValue = em.merge((ResValue) o); ResValue oldValue = em.merge(resValue); em.lock(oldValue, LockModeType.OPTIMISTIC); newValue.setReplacementFor(oldValue); for (SYSVAL2FILE oldAssignment : oldValue.getAttachedFilesConnections()) { em.remove(oldAssignment); } oldValue.getAttachedFilesConnections().clear(); for (SYSVAL2PROCESS oldAssignment : oldValue.getAttachedProcessConnections()) { em.remove(oldAssignment); } oldValue.getAttachedProcessConnections().clear(); oldValue.setEditedBy(em.merge(OPDE.getLogin().getUser())); oldValue.setEditDate(new Date()); oldValue.setReplacedBy(newValue); em.getTransaction().commit(); DateTime dt = new DateTime(newValue.getPit()); final String keyType = vtype.getID() + ".xtypes"; final String key = vtype.getID() + ".xtypes." + Integer.toString(dt.getYear()) + ".year"; synchronized (mapType2Values) { mapType2Values.get(key).remove(resValue); mapType2Values.get(key).add(oldValue); mapType2Values.get(key).add(newValue); Collections.sort(mapType2Values.get(key)); } createCP4Year(vtype, dt.getYear()); try { synchronized (cpMap) { cpMap.get(keyType).setCollapsed(false); cpMap.get(key).setCollapsed(false); } } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } 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(); } } } }); } }); btnEdit.setEnabled(!resValue.isObsolete()); pnlMenu.add(btnEdit); /*** * ____ _ _ * | _ \ ___| | ___| |_ ___ * | | | |/ _ \ |/ _ \ __/ _ \ * | |_| | __/ | __/ || __/ * |____/ \___|_|\___|\__\___| * */ final JButton btnDelete = GUITools.createHyperlinkButton( "nursingrecords.vitalparameters.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/><i>" + DateFormat.getDateTimeInstance().format(resValue.getPit()) + "</i><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(); ResValue myValue = em.merge(resValue); myValue.setDeletedBy(em.merge(OPDE.getLogin().getUser())); for (SYSVAL2FILE file : myValue.getAttachedFilesConnections()) { em.remove(file); } myValue.getAttachedFilesConnections().clear(); // Vorgangszuordnungen entfernen for (SYSVAL2PROCESS connObj : myValue.getAttachedProcessConnections()) { em.remove(connObj); } myValue.getAttachedProcessConnections().clear(); myValue.getAttachedProcesses().clear(); em.getTransaction().commit(); DateTime dt = new DateTime(myValue.getPit()); final String keyType = vtype.getID() + ".xtypes"; final String key = vtype.getID() + ".xtypes." + Integer.toString(dt.getYear()) + ".year"; synchronized (mapType2Values) { mapType2Values.get(key).remove(resValue); mapType2Values.get(key).add(myValue); Collections.sort(mapType2Values.get(key)); } createCP4Year(vtype, dt.getYear()); try { synchronized (cpMap) { cpMap.get(keyType).setCollapsed(false); cpMap.get(key).setCollapsed(false); } } catch (PropertyVetoException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } 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(); } } } }); } }); btnDelete.setEnabled(!resValue.isObsolete()); pnlMenu.add(btnDelete); 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) { new DlgFiles(resValue, new Closure() { @Override public void execute(Object o) { EntityManager em = OPDE.createEM(); final ResValue myValue = em.find(ResValue.class, resValue.getID()); em.close(); DateTime dt = new DateTime(myValue.getPit()); final String key = vtype.getID() + ".xtypes." + Integer.toString(dt.getYear()) + ".year"; synchronized (mapType2Values) { mapType2Values.get(key).remove(resValue); mapType2Values.get(key).add(myValue); Collections.sort(mapType2Values.get(key)); } buildPanel(); } }); } }); btnFiles.setEnabled(!resValue.isObsolete() && 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(resValue, 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); ResValue myValue = em.merge(resValue); em.lock(myValue, LockModeType.OPTIMISTIC_FORCE_INCREMENT); ArrayList<SYSVAL2PROCESS> attached = new ArrayList<SYSVAL2PROCESS>( resValue.getAttachedProcessConnections()); for (SYSVAL2PROCESS linkObject : attached) { if (unassigned.contains(linkObject.getQProcess())) { linkObject.getQProcess().getAttachedNReportConnections().remove(linkObject); linkObject.getResValue().getAttachedProcessConnections().remove(linkObject); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_REMOVE_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.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(myValue)) { QProcess myQProcess = em.merge(qProcess); SYSVAL2PROCESS myLinkObject = em .merge(new SYSVAL2PROCESS(myQProcess, myValue)); em.merge(new PReport( SYSTools.xx(PReportTools.PREPORT_TEXT_ASSIGN_ELEMENT) + ": " + myValue.getTitle() + " ID: " + myValue.getID(), PReportTools.PREPORT_TYPE_ASSIGN_ELEMENT, myQProcess)); qProcess.getAttachedResValueConnections().add(myLinkObject); myValue.getAttachedProcessConnections().add(myLinkObject); } } em.getTransaction().commit(); DateTime dt = new DateTime(myValue.getPit()); final String key = vtype.getID() + ".xtypes." + Integer.toString(dt.getYear()) + ".year"; synchronized (mapType2Values) { mapType2Values.get(key).remove(resValue); mapType2Values.get(key).add(myValue); Collections.sort(mapType2Values.get(key)); } createCP4Year(vtype, dt.getYear()); buildPanel(); //GUITools.flashBackground(contentmap.get(keyMonth), 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(); } } }); } }); btnProcess.setEnabled(!resValue.isObsolete()); pnlMenu.add(btnProcess); } return pnlMenu; }