fixes #22
Implemented LoggingLevelLabel as viewable component in the status bar. A click onto the label will open a popup menu that allows the user to set the logging level for the current process. The Version number of EvA2 has now increased to 3.0-rc1. Due to the major changes in the GUI and server implementation I think the version number 2.x should be dropped to reflect the size of changes.
This commit is contained in:
parent
b1553f3088
commit
146d25b628
33
pom.xml
33
pom.xml
@ -4,9 +4,17 @@
|
||||
<groupId>eva2</groupId>
|
||||
<artifactId>EvA2</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>3.0-rc1</version>
|
||||
<name>EvA2</name>
|
||||
<url>http://www.ra.cs.uni-tuebingen.de/software/EvA2/</url>
|
||||
<description>EvA2 (an Evolutionary Algorithms framework, revised version 2) is a comprehensive heuristic optimization framework with emphasis on Evolutionary Algorithms implemented in Java. It is a revised version of the JavaEvA optimization toolbox, which has been developed as a resumption of the former EvA software package.</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:https://rarepos.cs.uni-tuebingen.de/svn-path/JE2Base/trunk</connection>
|
||||
<developerConnection>scm:svn:https://rarepos.cs.uni-tuebingen.de/svn-path/JE2Base/trunk</developerConnection>
|
||||
<url>https://rarepos.cs.uni-tuebingen.de/svn-path/JE2Base/trunk</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@ -19,7 +27,14 @@
|
||||
<artifactId>javahelp</artifactId>
|
||||
<version>2.0.05</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-math3</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<directory>${project.basedir}/build</directory>
|
||||
<outputDirectory>${project.build.directory}/classes</outputDirectory>
|
||||
@ -32,6 +47,7 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<!-- Adds archive plugin to set archiving settings including main class -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@ -47,6 +63,21 @@
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<properties>
|
||||
<!-- Default file encoding is UTF-8 -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
</project>
|
||||
|
@ -18,4 +18,4 @@ ModulePackage = eva2.server.modules
|
||||
ModuleFilterClass = eva2.server.modules.AbstractModuleAdapter
|
||||
|
||||
# Full EvA2 version number
|
||||
EvA2Version = 2.050
|
||||
EvA2Version = 3.0-rc1
|
@ -11,7 +11,6 @@ import java.util.Properties;
|
||||
public class EvAInfo {
|
||||
public static final String productName = "EvA2";
|
||||
public static final String productLongName = "Evolutionary Algorithms Workbench 2";
|
||||
// public static final String fullVersion = "2.043"; // moved to EvA2.props!
|
||||
public static final String url = "http://www.cogsys.cs.uni-tuebingen.de/software/EvA2";
|
||||
|
||||
public static final String propertyFile = "META-INF/EvA2.props";
|
||||
|
@ -39,6 +39,7 @@ import java.util.logging.Logger;
|
||||
import javax.help.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.TitledBorder;
|
||||
import javax.swing.plaf.SeparatorUI;
|
||||
|
||||
|
||||
/**
|
||||
@ -459,13 +460,29 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
||||
|
||||
/* StatusBar of the main frame */
|
||||
statusBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||
statusBar.add(new JLabel("Progress"));
|
||||
JPanel statusBarControls = new JPanel();
|
||||
statusBarControls.setLayout(new BoxLayout(statusBarControls, BoxLayout.LINE_AXIS));
|
||||
|
||||
statusBarControls.add(Box.createHorizontalGlue());
|
||||
/* Logging settings drop down */
|
||||
LoggingLevelLabel loggingOption = new LoggingLevelLabel(LOGGER);
|
||||
|
||||
statusBarControls.add(loggingOption);
|
||||
|
||||
statusBarControls.add(Box.createHorizontalStrut(5));
|
||||
statusBarControls.add(new JSeparator(JSeparator.VERTICAL));
|
||||
statusBarControls.add(Box.createHorizontalStrut(5));
|
||||
|
||||
/* Create ProgressBar and add it to the status bar */
|
||||
statusBarControls.add(new JLabel("Progress"));
|
||||
statusBarControls.add(Box.createHorizontalStrut(5));
|
||||
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setValue(0);
|
||||
progressBar.setStringPainted(true);
|
||||
statusBar.add(progressBar);
|
||||
statusBarControls.add(progressBar);
|
||||
|
||||
statusBar.add(statusBarControls);
|
||||
|
||||
gbConstraints.gridx = 0;
|
||||
gbConstraints.gridy = 2;
|
||||
|
109
src/eva2/gui/LoggingLevelLabel.java
Normal file
109
src/eva2/gui/LoggingLevelLabel.java
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package eva2.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JSeparator;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author becker
|
||||
*/
|
||||
public final class LoggingLevelLabel extends JLabel {
|
||||
private JPopupMenu menu;
|
||||
private String[] options;
|
||||
private String selected;
|
||||
private Logger logger;
|
||||
|
||||
public LoggingLevelLabel(Logger logger) {
|
||||
options = new String[]{"Info", "Warning", "Severe", "Fine", "Finer", "Finest", "All"};
|
||||
|
||||
this.logger = logger;
|
||||
createPopupMenu();
|
||||
updateText();
|
||||
}
|
||||
|
||||
private void createPopupMenu() {
|
||||
this.menu = new JPopupMenu();
|
||||
addMouseListener(new MouseListener() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final MouseEvent ev) {
|
||||
menu.show(ev.getComponent(), ev.getX(), ev.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
});
|
||||
|
||||
for (String option : options) {
|
||||
JMenuItem menuItem = new JMenuItem(option);
|
||||
menuItem.addActionListener(new MenuActionListener());
|
||||
menu.add(menuItem);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateText() {
|
||||
/* Get the current logging Level */
|
||||
Level lvl = logger.getLevel();
|
||||
/* Level could be null, fetch parent level */
|
||||
if (lvl == null) {
|
||||
lvl = logger.getParent().getLevel();
|
||||
}
|
||||
/* Show the updated text */
|
||||
setText("<html><b>Level</b>: " + lvl.getName());
|
||||
}
|
||||
|
||||
private void setLoggerLevel(Level level) {
|
||||
logger.setLevel(level);
|
||||
logger.log(Level.INFO, "Logging Level changed to {0}", level.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class MenuActionListener implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent ev) {
|
||||
JMenuItem menuItem = (JMenuItem) ev.getSource();
|
||||
String levelName = menuItem.getText();
|
||||
|
||||
try {
|
||||
Level level = Level.parse(levelName.toUpperCase());
|
||||
LoggingLevelLabel.this.setLoggerLevel(level);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
logger.log(Level.INFO, "Could not determine new logging level!", ex);
|
||||
}
|
||||
|
||||
LoggingLevelLabel.this.updateText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user