mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -05:00
Decoder icon updates. Changed from colorized icons to a standard set of decoder icons and will now color the text of the channel node to reflect the status (green - processing, red - no tuner, no color - disabled )
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
******************************************************************************/
|
||||
package controller;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -57,6 +58,11 @@ public class BaseNode extends DefaultMutableTreeNode
|
||||
return null;
|
||||
}
|
||||
|
||||
public Color getForegroundColor()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
if( getUserObject() != null )
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
******************************************************************************/
|
||||
package controller;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Image;
|
||||
import java.util.HashMap;
|
||||
@@ -25,6 +26,8 @@ import javax.swing.ImageIcon;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
|
||||
import controller.channel.ChannelNode;
|
||||
|
||||
public class ControllerTreeCellRenderer extends DefaultTreeCellRenderer
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -46,18 +49,17 @@ public class ControllerTreeCellRenderer extends DefaultTreeCellRenderer
|
||||
|
||||
if( value instanceof BaseNode )
|
||||
{
|
||||
ImageIcon icon = getIcon( (BaseNode)value );
|
||||
BaseNode node = (BaseNode)value;
|
||||
|
||||
if( icon != null )
|
||||
ImageIcon icon = getIcon( node );
|
||||
|
||||
setIcon( icon );
|
||||
|
||||
Color foreground = node.getForegroundColor();
|
||||
|
||||
if( foreground != null )
|
||||
{
|
||||
if( icon.getIconHeight() > 16 )
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
setIcon( icon );
|
||||
}
|
||||
setForeground( foreground );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
******************************************************************************/
|
||||
package controller.channel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
@@ -98,21 +99,27 @@ public class ChannelNode extends ConfigurableNode implements ChannelEventListene
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
Channel channel = getChannel();
|
||||
|
||||
sb.append( channel.getDecodeConfiguration().getDecoderType().getIconPrefix() );
|
||||
|
||||
if( channel.getEnabled() )
|
||||
return getChannel().getDecodeConfiguration().getDecoderType()
|
||||
.getIconFilename();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getForegroundColor()
|
||||
{
|
||||
if( getChannel().getEnabled() )
|
||||
{
|
||||
sb.append( channel.isProcessing() ? "_green" : "_red" );
|
||||
if( getChannel().isProcessing() )
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
}
|
||||
|
||||
sb.append( ".png" );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package controller.site;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
@@ -59,27 +60,27 @@ public class SiteNode extends ConfigurableNode
|
||||
|
||||
public String getIconPath()
|
||||
{
|
||||
String retVal = "images/site.png";
|
||||
|
||||
return "images/site.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getForegroundColor()
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
Enumeration<DefaultMutableTreeNode> nodes = children();
|
||||
|
||||
while( nodes.hasMoreElements() )
|
||||
{
|
||||
ChannelNode child = (ChannelNode)nodes.nextElement();
|
||||
|
||||
if( child.getIconPath().contains( "green.png" ) )
|
||||
|
||||
if( child.getForegroundColor() != null )
|
||||
{
|
||||
return "images/site_green.png";
|
||||
}
|
||||
else if( child.getIconPath().contains( "red.png" ) )
|
||||
{
|
||||
retVal = "images/site_red.png";
|
||||
return Color.BLUE;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package controller.system;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.Enumeration;
|
||||
@@ -29,6 +30,7 @@ import javax.swing.JSeparator;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import controller.ConfigurableNode;
|
||||
import controller.channel.ChannelNode;
|
||||
import controller.site.Site;
|
||||
import controller.site.SiteNode;
|
||||
|
||||
@@ -58,28 +60,28 @@ public class SystemNode extends ConfigurableNode
|
||||
@Override
|
||||
public String getIconPath()
|
||||
{
|
||||
String retVal = "images/system.png";
|
||||
|
||||
return "images/system.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getForegroundColor()
|
||||
{
|
||||
@SuppressWarnings( "unchecked" )
|
||||
Enumeration<DefaultMutableTreeNode> nodes = children();
|
||||
|
||||
while( nodes.hasMoreElements() )
|
||||
{
|
||||
SiteNode child = (SiteNode)nodes.nextElement();
|
||||
|
||||
if( child.getIconPath().contains( "green.png" ) )
|
||||
|
||||
if( child.getForegroundColor() != null )
|
||||
{
|
||||
return "images/system_green.png";
|
||||
}
|
||||
else if( child.getIconPath().contains( "red.png" ) )
|
||||
{
|
||||
retVal = "images/system_red.png";
|
||||
return Color.BLUE;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getEditor()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user