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:
dennis.sheirer
2014-12-06 20:20:50 +00:00
parent fb630916a9
commit 0b535d8143
41 changed files with 65 additions and 47 deletions

View File

@@ -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 )

View File

@@ -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 );
}
}

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()
{