Author: vsalaun Date: 2011-06-06 11:18:53 +0200 (Mon, 06 Jun 2011) New Revision: 3155 Url: http://chorem.org/repositories/revision/lima/3155 Log: #345 report a nouveau (formulaire entrybook) Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/RetainedEarningsEntryBookForm.jaxx 2011-06-06 09:18:53 UTC (rev 3155) @@ -0,0 +1,120 @@ +<JDialog modal="true" + defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}" + onWindowClosing="performCancel();"> + + <org.chorem.lima.entity.EntryBook id="entryBook" javaBean="null" /> + <Boolean id="addState" javaBean='true'/> + + <script> + <![CDATA[ + + import org.chorem.lima.ui.combobox.EntryBookComboBoxModel; + import org.chorem.lima.ui.combobox.EntryBookRenderer; + import org.chorem.lima.entity.EntryBook; + + getRootPane().setDefaultButton(okButton); + + /** + * Sets null to EntryBook and closes JDialog + */ + protected void performCancel() { + setEntryBook(null); + dispose(); + } + + /** + * Sets the right EntryBook to use and its values + */ + protected void performNew() { + if (selectedEntryBook.isSelected()) { + entryBookComboBox.setEnabled(true); + entryBookLabelField.setEditable(false); + entryBookCodeField.setEditable(false); + if (getEntryBookComboBox().getSelectedItem() != null) { + getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode().trim()); + getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel().trim()); + } else { + setEntryBook(null); + } + } else { + entryBookComboBox.setEnabled(false); + entryBookLabelField.setEditable(true); + entryBookCodeField.setEditable(true); + getEntryBook().setCode(getEntryBookCodeField().getText()); + getEntryBook().setLabel(getEntryBookLabelField().getText()); + } + } + + void $afterCompleteSetup() { + performNew(); + } + ]]> + </script> + + <Table> + <row> + <cell anchor="west"> + <JRadioButton + id="selectedEntryBook" + text="lima.common.entrybook" + selected="true" + buttonGroup="EntryBookGroup" + onActionPerformed="performNew()"/> + </cell> + </row> + <row> + <cell> + <JLabel id="entryBookSelectorLabel" text="lima.common.entrybook"/> + </cell> + <cell> + <org.chorem.lima.ui.combobox.EntryBookComboBoxModel id="modelEntryBookComboBox"/> + <JComboBox id="entryBookComboBox" + model="{getModelEntryBookComboBox()}" + renderer="{new org.chorem.lima.ui.combobox.EntryBookRenderer()}" + editable="false" + onItemStateChanged="getEntryBook().setCode(((EntryBook)getEntryBookComboBox().getSelectedItem()).getCode()); getEntryBook().setLabel(((EntryBook)getEntryBookComboBox().getSelectedItem()).getLabel())"/> + </cell> + </row> + <row> + <cell anchor="west"> + <JRadioButton + id="newEntryBook" + text="lima.home.entrybooks.create" + selected="false" + buttonGroup="EntryBookGroup" + onActionPerformed="performNew()"/> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.common.code"/> + </cell> + <cell> + <JTextField id="entryBookCodeField" text="{getEntryBook().getCode()}"/> + <javax.swing.text.Document javaBean="getEntryBookCodeField().getDocument()" + onInsertUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' + onRemoveUpdate='getEntryBook().setCode(getEntryBookCodeField().getText())' /> + </cell> + </row> + <row> + <cell> + <JLabel text="lima.common.label"/> + </cell> + <cell> + <JTextField id="entryBookLabelField" editable='{isAddState()}' text="{getEntryBook().getLabel()}"/> + <javax.swing.text.Document javaBean="getEntryBookLabelField().getDocument()" + onInsertUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' + onRemoveUpdate='getEntryBook().setLabel(getEntryBookLabelField().getText())' /> + </cell> + </row> + <row> + <cell> + <JButton id="cancelButton" text="lima.common.cancel" onActionPerformed="performCancel()"/> + </cell> + <cell> + <JButton id="okButton" text="lima.common.ok" onActionPerformed="dispose()"/> + </cell> + + </row> + </Table> +</JDialog> \ No newline at end of file