Author: tchemit Date: 2008-02-07 13:24:16 +0000 (Thu, 07 Feb 2008) New Revision: 715 Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUIRefreshHelper.java trunk/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/tab/JApplicationDetailTab.jaxx Log: mise en place lise attachments dans l'ui Modified: trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUIRefreshHelper.java =================================================================== --- trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUIRefreshHelper.java 2008-02-07 12:55:43 UTC (rev 714) +++ trunk/simexplorer-is-swing/src/java/fr/cemagref/simexplorer/is/ui/swing/SimExplorerUIRefreshHelper.java 2008-02-07 13:24:16 UTC (rev 715) @@ -321,17 +321,29 @@ JList listAttachments = ui.getDetailAttachments(); DefaultListModel listModel = (DefaultListModel) listAttachments.getModel(); listModel.setSize(0); - if (!attachments.isEmpty()) { - ui.getDetailAttachmentsHeader().setText(_("simexplorer.node.attachments")); + listModel.trimToSize(); + if (attachments.isEmpty()) { + ui.getDetailAttachmentsHeader().setText(_("simexplorer.node.noattachments")); + Dimension dimHead = ui.getDetailHeaderAttachmentsPanel().getPreferredSize(); + ui.getScrollAttachments().setPreferredSize(new Dimension((int) dimHead.getWidth(), (int) (dimHead.getHeight()+3))); + listAttachments.setVisible(false); + } else { + ui.getDetailAttachmentsHeader().setText(_("simexplorer.node.attachments", attachments.size())); for (Attachment attachment : attachments) { listModel.addElement(attachment); } listAttachments.setSelectedIndex(0); + nbRows = listModel.getSize(); + if (nbRows > 10) { + nbRows = 10; + } + Dimension dimHead = ui.getDetailHeaderAttachmentsPanel().getPreferredSize(); + listAttachments.setVisible(true); + ui.getScrollAttachments().setPreferredSize(new Dimension((int) dimHead.getWidth(), (int) (dimHead.getHeight() + 4 + (nbRows * (4 + listAttachments.getFont().getSize()))))); } table.invalidate(); listAttachments.invalidate(); - ui.getScrollPane().repaint(); ui.repaint(); } Modified: trunk/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/tab/JApplicationDetailTab.jaxx =================================================================== --- trunk/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/tab/JApplicationDetailTab.jaxx 2008-02-07 12:55:43 UTC (rev 714) +++ trunk/simexplorer-is-swing/src/uimodel/fr/cemagref/simexplorer/is/ui/swing/tab/JApplicationDetailTab.jaxx 2008-02-07 13:24:16 UTC (rev 715) @@ -16,7 +16,6 @@ </row> <row> <cell fill='vertical'> - <!--JPanel border='{javax.swing.border.LineBorder.createBlackLineBorder()}'--> <JPanel id='detailHeaderPanel' background='{Color.WHITE}' border='{javax.swing.border.LineBorder.createBlackLineBorder()}'> <JLabel id='detailHeader' text='{_("simexplorer.node.nodetail")}'/> </JPanel> @@ -24,7 +23,7 @@ </row> <row> <cell fill='vertical'> - <JPanel id='detailHeaderAttachmentsPanel'> + <JPanel id='detailHeaderAttachmentsPanel' background='{Color.WHITE}' border='{javax.swing.border.LineBorder.createBlackLineBorder()}'> <JLabel id='detailAttachmentsHeader' text='{_("simexplorer.node.noattachments")}'/> </JPanel> </cell> @@ -35,63 +34,63 @@ <JScrollPane columnHeaderView='{toolbar}'> <JTree id="navigationTree" model='{new javax.swing.tree.DefaultTreeModel(null)}'/> </JScrollPane> - <JScrollPane id="scrollPane" columnHeaderView='{detailHeaderPanel}'> - <!--JScrollPane id="scrollPane" verticalScrollBarPolicy="vertical_scrollbar_never" columnHeaderView='{detailHeaderPanel}'--> - <Table id='detail' insets='2,2,2,1'> - <row fill='vertical'> - <cell anchor='west'> - <JLabel text='{_("simexplorer.common.type")}'/> - </cell> - <cell weightx="1" anchor='east'> - <JLabel id='detailType'/> - </cell> - </row> - <row> - <cell anchor='west'> - <JLabel text='{_("simexplorer.common.version")}'/> - </cell> - <cell weightx="1" anchor='east'> - <JComboBox id='detailVersions' model='{new DefaultComboBoxModel()}'/> - </cell> - </row> - <row fill='vertical'> - <cell anchor='west'> - <JLabel text='{_("simexplorer.common.description")}'/> - </cell> - <cell weightx="1" anchor='east'> - <JLabel id='detailDescription'/> - </cell> - </row> - <row fill='vertical'> - <cell anchor='west'> - <JLabel text='{_("simexplorer.common.creationDate")}'/> - </cell> - <cell anchor='east'> - <JLabel id='detailCreationDate'/> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal'> - <JScrollPane id='scrollTable'> - <JTable id="detailTable" model='{new fr.cemagref.simexplorer.is.ui.swing.model.JDetailTableModel()}' focusable='false' enabled='false'/> - </JScrollPane> - </cell> - </row> - <row> - <cell columns='2' fill='horizontal'> - <JScrollPane id='scrollAttachments' columnHeaderView='{detailHeaderAttachmentsPanel}'> - <JList id="detailAttachments" model='{new DefaultListModel()}' /> - </JScrollPane> - </cell> - </row> - <row weighty="1" weightx="2" > - <cell fill='both' columns='2'> - <JPanel> - <JLabel text=''/> - </JPanel> - </cell> - </row> - </Table> + <JScrollPane id="scrollPane" columnHeaderView='{detailHeaderPanel}'> + <Table id='detail' insets='2,2,2,1'> + <row fill='vertical'> + <cell anchor='west'> + <JLabel text='{_("simexplorer.common.type")}'/> + </cell> + <cell weightx="1" anchor='east'> + <JLabel id='detailType'/> + </cell> + </row> + <row> + <cell anchor='west'> + <JLabel text='{_("simexplorer.common.version")}'/> + </cell> + <cell weightx="1" anchor='east'> + <JComboBox id='detailVersions' model='{new DefaultComboBoxModel()}'/> + </cell> + </row> + <row fill='vertical'> + <cell anchor='west'> + <JLabel text='{_("simexplorer.common.description")}'/> + </cell> + <cell weightx="1" anchor='east'> + <JLabel id='detailDescription'/> + </cell> + </row> + <row fill='vertical'> + <cell anchor='west'> + <JLabel text='{_("simexplorer.common.creationDate")}'/> + </cell> + <cell anchor='east'> + <JLabel id='detailCreationDate'/> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal'> + <JScrollPane id='scrollTable'> + <JTable id="detailTable" model='{new fr.cemagref.simexplorer.is.ui.swing.model.JDetailTableModel()}' + focusable='false' enabled='false'/> + </JScrollPane> + </cell> + </row> + <row> + <cell columns='2' fill='horizontal'> + <JScrollPane id='scrollAttachments'columnHeaderView='{detailHeaderAttachmentsPanel}'> + <JList id="detailAttachments" model='{new DefaultListModel()}'/> + </JScrollPane> + </cell> + </row> + <row weighty="1" weightx="2"> + <cell fill='both' columns='2'> + <JPanel> + <JLabel text=''/> + </JPanel> + </cell> + </row> + </Table> </JScrollPane> </JSplitPane> </cell>