aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2014-01-06 10:51:06 +0100
committerJiri Vanek <[email protected]>2014-01-06 10:51:06 +0100
commitf9288c313418e0684e955b152ed14b2a92e3fc95 (patch)
tree919c0e7af267d8162ff7e94b7996745c341ef7a3
parent3261e3454f94f66082d97c2ba8a10cbe603dcc01 (diff)
Copy all button in console controls sorts by date by default.
-rw-r--r--ChangeLog19
-rw-r--r--netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java23
-rw-r--r--netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java16
3 files changed, 44 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 219cd9b..9e210d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,22 @@
-2011-10-17 Jiri Vanek <[email protected]>
+2014-01-06 Jiri Vanek <[email protected]>
+
+ Copy all button in console controls sorts by date by default.
+ * netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java: added
+ (sortCopyAll) checkbox. Logic from (copyPlainActionPerformed) and
+ (copyRichActionPerformed) extracted to new (fillClipBoard) which also
+ used correct call of ConsoleOutputPaneModel.importList based on
+ (sortCopyAll) value.
+ * netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java:
+ added abstraction for (importList) to allow sorting via parameter
+
+2014-01-06 Jiri Vanek <[email protected]>
- Removed depndence on sun.misc.BASE64Decoder
+ Removed dependence on sun.misc.BASE64Decoder
* configure.ac: removed check for sun.misc.BASE64Decoder
* netx/net/sourceforge/jnlp/PluginBridge.java : sun.misc.BASE64Decoder
- import repalced by net.sourceforge.jnlp.util.replacements.BASE64Decoder
+ import replaced by net.sourceforge.jnlp.util.replacements.BASE64Decoder
* netx/net/sourceforge/jnlp/util/replacements/BASE64Decoder.java: new
- file, in-tre copy from jdk7
+ file, in-tree copy from jdk7
* netx/net/sourceforge/jnlp/util/replacements/CharacterDecoder.java: likewise
* tests/netx/unit/net/sourceforge/jnlp/util/replacements/BASE64DecoderTest.java:
new tests for new files
diff --git a/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java b/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java
index fe55d8e..52daba9 100644
--- a/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java
+++ b/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPane.java
@@ -242,6 +242,7 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
jPanel2 = new javax.swing.JPanel();
showHeaders = new javax.swing.JCheckBox();
showUser = new javax.swing.JCheckBox();
+ sortCopyAll = new javax.swing.JCheckBox();
showOrigin = new javax.swing.JCheckBox();
showLevel = new javax.swing.JCheckBox();
showDate = new javax.swing.JCheckBox();
@@ -286,6 +287,10 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
jEditorPane1 = new javax.swing.JTextPane();
showHide = new javax.swing.JButton();
+ sortCopyAll.setSelected(true);
+ sortCopyAll.setText("sort copy all by date");
+ sortCopyAll.setToolTipText("The sort by date is a bit more time consuming, but most natural for posting purposes");
+
showHeaders.setSelected(true);
showHeaders.setText("Show headers:");
showHeaders.addActionListener(getDefaultActionSingleton());
@@ -487,6 +492,7 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
addComponent(next).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE).
addComponent(wordWrap).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
addComponent(highLight).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
+ addComponent(sortCopyAll).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
addComponent(copyRich).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
addComponent(copyPlain)).addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup().
addComponent(searchLabel).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).
@@ -568,6 +574,7 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).
addComponent(previous).
addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).
+ addComponent(sortCopyAll).
addComponent(copyPlain).
addComponent(copyRich).
addComponent(highLight).
@@ -782,13 +789,20 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
}
private void copyPlainActionPerformed(java.awt.event.ActionEvent evt) {
- StringSelection stringSelection = new StringSelection(model.importList(false, 0));
- Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
- clpbrd.setContents(stringSelection, null);
+ fillClipBoard(false, sortCopyAll.isSelected());
}
private void copyRichActionPerformed(java.awt.event.ActionEvent evt) {
- StringSelection stringSelection = new StringSelection(model.importList(true, 0));
+ fillClipBoard(true, sortCopyAll.isSelected());
+ }
+
+ private void fillClipBoard(boolean mark, boolean forceSort){
+ StringSelection stringSelection ;
+ if (forceSort){
+ stringSelection = new StringSelection(model.importList(mark, 0, 4/*date*/));
+ } else {
+ stringSelection = new StringSelection(model.importList(mark, 0));
+ }
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
clpbrd.setContents(stringSelection, null);
}
@@ -879,6 +893,7 @@ public class ConsoleOutputPane extends javax.swing.JPanel implements Observer {
private javax.swing.JCheckBox showThread1;
private javax.swing.JCheckBox showThread2;
private javax.swing.JCheckBox showUser;
+ private javax.swing.JCheckBox sortCopyAll;
private javax.swing.JComboBox sortBy;
private javax.swing.JLabel sortByLabel;
private javax.swing.JLabel statistics;
diff --git a/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java b/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java
index 79b132b..912d220 100644
--- a/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java
+++ b/netx/net/sourceforge/jnlp/util/logging/ConsoleOutputPaneModel.java
@@ -125,8 +125,12 @@ public class ConsoleOutputPaneModel {
String importList(int start) {
return importList(highLight, start);
}
-
+
String importList(boolean mark, int start) {
+ return importList(mark, start, sortBy);
+ }
+
+ String importList(boolean mark, int start, int sortByLocal) {
int added = start;
StringBuilder sb = new StringBuilder();
if (mark) {
@@ -139,9 +143,9 @@ public class ConsoleOutputPaneModel {
List<MessageWithHeader> sortedList;
if (start == 0) {
- sortedList = preSort(dataProvider.getData());
+ sortedList = preSort(dataProvider.getData(), sortByLocal);
} else {
- sortedList = preSort(Collections.synchronizedList(dataProvider.getData().subList(start, dataProvider.getData().size())));
+ sortedList = preSort(Collections.synchronizedList(dataProvider.getData().subList(start, dataProvider.getData().size())), sortByLocal);
}
lastUpdateIndex = dataProvider.getData().size();
@@ -226,9 +230,9 @@ public class ConsoleOutputPaneModel {
return sb.toString();
}
- List<MessageWithHeader> preSort(List<MessageWithHeader> data) {
+ List<MessageWithHeader> preSort(List<MessageWithHeader> data, int sortByLocal) {
List<MessageWithHeader> sortedData;
- if (sortBy == 0) {
+ if (sortByLocal == 0) {
if (revertSort) {
sortedData = Collections.synchronizedList(new ArrayList<MessageWithHeader>(data));
Collections.reverse(sortedData);
@@ -237,7 +241,7 @@ public class ConsoleOutputPaneModel {
}
} else {
sortedData = Collections.synchronizedList(new ArrayList<MessageWithHeader>(data));
- switch (sortBy) {
+ switch (sortByLocal) {
case 1:
Collections.sort(sortedData, new CatchedMessageWithHeaderComparator() {
@Override