From d8901c075f9deb663e0edd640672ed620ffb4610 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 19 Nov 2008 16:14:57 +0000 Subject: GUI bugfixes and cleanup git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@181 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 103 +++++++++------------ 1 file changed, 43 insertions(+), 60 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java') diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index 38247174..a190b9c0 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -26,6 +26,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -554,44 +556,37 @@ public class BKUGUIImpl implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - GroupLayout.SequentialGroup pinHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(pinsizeLabel)); - - GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel); if (!renderHeaderPanel) { - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel) //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + infoHorizontal .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - mainHorizontal - .addGroup(infoHorizontal) - .addGroup(pinHorizontal); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel) .addComponent(helpLabel); - mainVertical - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else { - mainHorizontal - .addGroup(pinHorizontal); - } - - mainVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); + infoVertical + .addComponent(helpLabel); + } - mainPanelLayout.setHorizontalGroup(mainHorizontal); - mainPanelLayout.setVerticalGroup(mainVertical); + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) + .addComponent(pinsizeLabel)))); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); @@ -1048,31 +1043,6 @@ public class BKUGUIImpl implements BKUGUIFacade { } } - /** - * Opens HashDataViewer on mouse clicked event - */ -// public class HashDataMouseListener extends MouseAdapter { -// -// private HashDataInput hashData; -// -// public void setHashData(HashDataInput hashData) { -// this.hashData = hashData; -// } -// -// @Override -// public void mouseClicked(MouseEvent e) { -// ActionListener saveListener = new ActionListener() { -// -// @Override -// public void actionPerformed(ActionEvent e) { -// showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null); -// } -// }; -// showHashDataViewer(hashData, saveListener, "save"); -// super.mouseClicked(e); -// } -// } - /** * has to be called from event dispatcher thread * @param hashDataText @@ -1113,10 +1083,23 @@ public class BKUGUIImpl implements BKUGUIFacade { refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()})); HashDataTableModel tableModel = new HashDataTableModel(signedReferences); - JTable hashDataTable = new JTable(tableModel); -// hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer()); + final JTable hashDataTable = new JTable(tableModel); + hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer()); hashDataTable.setTableHeader(null); + // not possible to add mouse listener to TableCellRenderer + hashDataTable.addMouseMotionListener(new MouseMotionAdapter() { + + @Override + public void mouseMoved(MouseEvent e) { + if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { + hashDataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + hashDataTable.setCursor(Cursor.getDefaultCursor()); + } + } + }); + hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hashDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { -- cgit v1.2.3