Skip to content

Commit

Permalink
Moved the background color chooser button to the right menu
Browse files Browse the repository at this point in the history
	Replaced icon from the table quick-view button with text

	Fixed rename in the Interactive Labeling Editor to work as described

	Added/updated node description for Interactive Labeling Editor and the new views
  • Loading branch information
AndreasBurger committed Oct 27, 2015
1 parent cc94d94 commit 34c63bf
Show file tree
Hide file tree
Showing 10 changed files with 375 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,8 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
Expand All @@ -66,12 +63,8 @@

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JToggleButton;
Expand All @@ -82,7 +75,6 @@
import org.knime.knip.core.ui.event.EventServiceClient;
import org.knime.knip.core.ui.event.KNIPEvent;
import org.knime.knip.core.ui.imgviewer.ImgViewer;
import org.knime.knip.core.ui.imgviewer.events.BackgroundColorChangedEvent;
import org.knime.knip.core.ui.imgviewer.events.PlaneSelectionEvent;
import org.knime.knip.core.ui.imgviewer.panels.TableOverviewPanel;
import org.knime.knip.core.ui.imgviewer.panels.ViewerControlEvent;
Expand Down Expand Up @@ -167,8 +159,7 @@ private JComponent createNavBar() {

Box firstPanel = new Box(BoxLayout.X_AXIS);

JButton overviewButton =
new JButton("Back to Table");
JButton overviewButton = new JButton("Back to Table");
overviewButton.setMnemonic(KeyEvent.VK_B);
firstPanel.add(overviewButton);
// overviewButtonPanel.add(Box.createHorizontalGlue());
Expand All @@ -185,18 +176,12 @@ public void actionPerformed(final ActionEvent e) {
});

firstPanel.add(Box.createHorizontalStrut(20));
JLabel expandLabel = new JLabel("Expand Table View ");
firstPanel.add(expandLabel);
// JLabel expandLabel = new JLabel("Expand Table View ");
// firstPanel.add(expandLabel);
Box quickViewButtonPanel = new Box(BoxLayout.X_AXIS);
// py quickViewButtonPanel.add(Box.createHorizontalGlue());
ImageIcon i = new ImageIcon(this.getClass().getResource("/icons/tableup.png"));
ImageIcon i2 = new ImageIcon(this.getClass().getResource("/icons/tabledown.png"));

m_bottomQuickViewButton =
new JToggleButton(new ImageIcon(i.getImage().getScaledInstance(32, 16, java.awt.Image.SCALE_SMOOTH)));
m_bottomQuickViewButton
.setSelectedIcon(new ImageIcon(i2.getImage().getScaledInstance(32, 16, java.awt.Image.SCALE_SMOOTH)));
m_bottomQuickViewButton.setMnemonic(KeyEvent.VK_Q);
m_bottomQuickViewButton = new JToggleButton("Expand Table View");

quickViewButtonPanel.add(m_bottomQuickViewButton);
// quickViewButtonPanel.add(Box.createHorizontalGlue());
Expand All @@ -206,30 +191,26 @@ public void actionPerformed(final ActionEvent e) {

Box colourButtonPanel = new Box(BoxLayout.X_AXIS);

JLabel colourLabel = new JLabel("Background Color ");
firstPanel.add(colourLabel);

JButton colourButton =
new JButton(new ColorIcon(m_bgColour));

colourButton.addActionListener(new ActionListener() {

@Override
public void actionPerformed(final ActionEvent e) {
Color c = JColorChooser.showDialog(m_cellPanel, "Select Background Color", m_bgColour);
if(c != null){
m_bgColour = c;
colourButton.setIcon(new ColorIcon(c));
broadcastEvent(new BackgroundColorChangedEvent(c));
}



}
});


colourButtonPanel.add(colourButton);
// JLabel colourLabel = new JLabel("Background Color ");
// firstPanel.add(colourLabel);

// JButton colourButton = new JButton(new ColorIcon(m_bgColour));
//
// colourButton.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(final ActionEvent e) {
// Color c = JColorChooser.showDialog(m_cellPanel, "Select Background Color", m_bgColour);
// if (c != null) {
// m_bgColour = c;
// colourButton.setIcon(new ColorIcon(c));
// broadcastEvent(new BackgroundColorChangedEvent(c));
// }
//
// }
// });
//
// colourButtonPanel.add(colourButton);
// quickViewButtonPanel.add(Box.createHorizontalGlue());
firstPanel.add(colourButtonPanel);

Expand Down Expand Up @@ -345,51 +326,18 @@ public void onPlaneSelectionChanged(final PlaneSelectionEvent e) {

@EventListener
public void onViewerImgChange(final ViewerScrollEvent e) {
if(m_eventService != null) {
if (m_eventService != null) {
m_eventService.publish(new ViewerScrollEvent(e));
}
}

@EventListener
public void onViewerOverviewToggle(final ViewerControlEvent e) {
if(m_eventService != null) {
if (m_eventService != null) {
m_eventService.publish(e);
}
}

private static class ColorIcon implements Icon
{
private final int size = 16;

private final Color color;

public ColorIcon( final Color color )
{
this.color = color;
}

@Override
public void paintIcon( final Component c, final Graphics g, final int x, final int y )
{
final Graphics2D g2d = ( Graphics2D ) g;
g2d.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
g2d.setColor( color );
g2d.fillOval( x, y, size, size );
}

@Override
public int getIconWidth()
{
return size;
}

@Override
public int getIconHeight()
{
return size;
}
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ public TableCellView[] createTableCellViews() {
*/
@Override
public String getDescription() {
return "";
return "A viewer shown when the user selects an interval of rows and columns in the viewer. " +
"This viewer combines all images and labelings in the selected interval to one image by rendering them next to each other. "
+ "Alternatively, the images and labelings can be layed over each other.";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public TableCellView[] createTableCellViews() {
*/
@Override
public String getDescription() {
return "";
return "An empty viewer that is shown when the input cell has no value to display.";
}

@Override
public String getName() {
return "? Missing Value ?";
return "Missing Value";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.knime.knip.core.ui.event.KNIPEvent;
import org.knime.knip.core.ui.imgviewer.events.ImgRedrawEvent;
import org.knime.knip.core.ui.imgviewer.events.PlaneSelectionEvent;
import org.knime.knip.core.ui.imgviewer.panels.BackgroundColorChooserPanel;
//import org.knime.knip.core.ui.imgviewer.events.ResetCacheEvent;
import org.knime.knip.core.ui.imgviewer.panels.CombinedRUControlPanel;
import org.knime.knip.core.ui.imgviewer.panels.CombinedRURenderEvent;
Expand Down Expand Up @@ -128,10 +129,19 @@ protected JComponent createMenu() {

menuPanel.add(Box.createVerticalStrut(5));

CombinedRUControlPanel c = new CombinedRUControlPanel();
CombinedRUControlPanel controlPanel = new CombinedRUControlPanel();

c.setEventService(getEventService());
menuPanel.add(c);
controlPanel.setEventService(getEventService());
menuPanel.add(controlPanel);

menuPanel.add(Box.createVerticalStrut(5));

BackgroundColorChooserPanel colourChooser = new BackgroundColorChooserPanel();

colourChooser.setEventService(getEventService());
menuPanel.add(colourChooser);

menuPanel.add(Box.createVerticalStrut(10));

m_tabbedMenu = new JTabbedPane();

Expand Down
Loading

0 comments on commit 34c63bf

Please sign in to comment.