Added window with header information ...

This commit is contained in:
ebner 2013-06-24 11:51:28 +02:00
parent 7d44d54356
commit 52e59f48e8
2 changed files with 66 additions and 2 deletions

View File

@ -0,0 +1,62 @@
/**
*
* Copyright 2013 Paul Scherrer Institute. All rights reserved.
*
* This code is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This code is distributed in the hope that it will be useful, but without any
* warranty; without even the implied warranty of merchantability or fitness for
* a particular purpose. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
*/
package ch.psi.imagej.zeromq;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.GridLayout;
import java.util.Map;
import javax.swing.SwingConstants;
/**
* @author ebner
*
*/
@SuppressWarnings("serial")
public class HeaderInfo extends JFrame {
private JLabel lblHeader;
/**
* Create the panel.
*/
public HeaderInfo() {
getContentPane().setLayout(new GridLayout(0, 1, 0, 0));
lblHeader = new JLabel("Header ...");
lblHeader.setVerticalAlignment(SwingConstants.TOP);
getContentPane().add(lblHeader);
}
public void setText(Map<String,Object> m){
StringBuilder b = new StringBuilder();
b.append("<html>");
for(String k : m.keySet()){
b.append(k);
b.append(" ");
b.append(m.get(k));
b.append("<br/>");
}
b.append("</html>");
lblHeader.setText(b.toString());
this.pack();
}
}

View File

@ -68,7 +68,7 @@ public class ZeroMQViewer implements PlugIn {
private JComboBox<String> comboBoxMethod;
private ObjectMapper mapper = new ObjectMapper(new JsonFactory());
// private HeaderInfo hinfo = new HeaderInfo();
private HeaderInfo hinfo = new HeaderInfo();
public void run(String arg) {
IJ.showStatus("Running ZeroMQ Viewer");
@ -89,7 +89,7 @@ public class ZeroMQViewer implements PlugIn {
while (isPluginRunning) {
semaphore.acquire();
collect=true;
// hinfo.setVisible(true);
hinfo.setVisible(true);
try{
if(img!=null){
img.close();
@ -174,6 +174,8 @@ public class ZeroMQViewer implements PlugIn {
img.show();
}
img.setTitle(header);
hinfo.setText(m);
}
else{
logger.info("Header type is not supported ...");