summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src/main/java/at
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-24 13:37:11 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-11-24 13:37:11 +0000
commitb93f035e2c9df0ad430300c4f755b775a4aa1ed3 (patch)
treeb62e5b8754ad8d929a27b46ae996bd6a0ad6e72f /BKUCommonGUI/src/main/java/at
parent2598b9b52673d42945cb94958deb4e89c6c85e88 (diff)
downloadmocca-b93f035e2c9df0ad430300c4f755b775a4aa1ed3.tar.gz
mocca-b93f035e2c9df0ad430300c4f755b775a4aa1ed3.tar.bz2
mocca-b93f035e2c9df0ad430300c4f755b775a4aa1ed3.zip
xhtml warning
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@192 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUCommonGUI/src/main/java/at')
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java3
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java15
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java72
3 files changed, 48 insertions, 42 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 7d912f11..d3cb76f2 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -62,11 +62,12 @@ public interface BKUGUIFacade {
public static final String MESSAGE_INSERTCARD = "message.insertcard";
public static final String MESSAGE_ENTERPIN = "message.enterpin";
public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
- public static final String MESSAGE_HASHDATA = "message.hashdata";
+// public static final String MESSAGE_HASHDATA = "message.hashdata";
public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
public static final String MESSAGE_RETRIES = "message.retries";
public static final String MESSAGE_OVERWRITE = "message.overwrite";
public static final String MESSAGE_HELP = "message.help";
+ public static final String WARNING_XHTML = "warning.xhtml";
public static final String LABEL_PIN = "label.pin";
public static final String LABEL_PINSIZE = "label.pinsize";
public static final String HELP_WELCOME = "help.welcome";
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 a190b9c0..c786a291 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
@@ -208,13 +208,16 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (background == null) {
background = getClass().getResource(DEFAULT_BACKGROUND);
}
- if ("file".equals(background.getProtocol())) {
- log.warn("file:// background images not permitted: " + background);
- background = getClass().getResource(DEFAULT_BACKGROUND);
+ if (background == null) {
+ contentPanel = new JPanel();
+ } else {
+ if ("file".equals(background.getProtocol())) {
+ log.warn("file:// background images not permitted: " + background);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ log.debug("loading background " + background);
+ contentPanel = new ImagePanel(background);
}
- log.debug("loading background " + background);
- contentPanel = new ImagePanel(background);
-
mainPanel = new JPanel();
mainPanel.setOpaque(false);
buttonPanel = new JPanel();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
index 777e8960..6c097b2a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -125,9 +125,7 @@ public class HashDataViewer extends JDialog
InputStreamReader isr = new InputStreamReader(hashDataInput.getHashDataInput(), cs);
Reader content = new BufferedReader(isr);
- JPanel hashDataPanel = createViewerPanel(
- messages.getString(BKUGUIFacade.MESSAGE_HASHDATA),
- content,
+ JPanel hashDataPanel = createViewerPanel(content,
hashDataInput.getMimeType(),
helpListener);
JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
@@ -169,29 +167,28 @@ public class HashDataViewer extends JDialog
* @param helpListener may be null
* @return
*/
- private JPanel createViewerPanel(String viewerLabelText,
- Reader content,
+ private JPanel createViewerPanel(Reader content,
String mimeType,
final ActionListener helpListener) {
- log.debug("viewer dialog: " + mimeType);
if (mimeType == null) {
mimeType = "text/plain";
- } else if ("application/xhtml+xml".equals(mimeType)) {
- mimeType = "text/html";
}
+ log.debug("viewer dialog: " + mimeType);
JEditorPane viewer = new JEditorPane();
+ viewer.setEditable(false);
+ viewer.setContentType(mimeType);
if ("text/plain".equals(mimeType)) {
viewer.setEditorKit(new StyledEditorKit());
viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
// } else if ("text/html".equals(mimeType)) {
// viewer.setEditorKit(new RestrictedHTMLEditorKit());
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ viewer.setContentType("text/html");
}
- viewer.setEditable(false);
- viewer.setContentType(mimeType);
-
+
EditorKit editorKit = viewer.getEditorKit();
Document document = editorKit.createDefaultDocument();
// document.putProperty("IgnoreCharsetDirective", new Boolean(true));
@@ -210,15 +207,23 @@ public class HashDataViewer extends JDialog
scrollPane.setAlignmentX(LEFT_ALIGNMENT);
viewer.setCaretPosition(0);
- JLabel viewerLabel = new JLabel();
- viewerLabel.setText(viewerLabelText);
- viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
- viewerLabel.setLabelFor(viewer);
-
JPanel viewerPanel = new JPanel();
GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel);
viewerPanel.setLayout(viewerPanelLayout);
+ GroupLayout.SequentialGroup infoHorizontal = viewerPanelLayout.createSequentialGroup();
+ GroupLayout.ParallelGroup infoVertical = viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+
+ if ("application/xhtml+xml".equals(mimeType)) {
+ JLabel viewerLabel = new JLabel();
+ viewerLabel.setText(messages.getString(BKUGUIFacade.WARNING_XHTML));
+ viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ viewerLabel.setLabelFor(viewer);
+
+ infoHorizontal.addComponent(viewerLabel);
+ infoVertical.addComponent(viewerLabel);
+ }
+
if (helpListener != null) {
JLabel helpLabel = new JLabel();
helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
@@ -232,27 +237,24 @@ public class HashDataViewer extends JDialog
}
});
helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
- } else {
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(scrollPane));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addComponent(viewerLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
+ infoHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ infoVertical
+ .addComponent(helpLabel);
}
+
+ viewerPanelLayout.setHorizontalGroup(
+ viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addComponent(scrollPane));
+ viewerPanelLayout.setVerticalGroup(
+ viewerPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(scrollPane));
+
return viewerPanel;
}