-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
103 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/nccgroup/loggerplusplus/util/userinterface/renderer/TagRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.nccgroup.loggerplusplus.util.userinterface.renderer; | ||
|
||
import com.nccgroup.loggerplusplus.filter.tag.Tag; | ||
import org.jdesktop.swingx.HorizontalLayout; | ||
|
||
import javax.swing.*; | ||
import javax.swing.table.TableCellRenderer; | ||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.Enumeration; | ||
|
||
/** | ||
* Created by corey on 22/08/17. | ||
*/ | ||
public class TagRenderer implements TableCellRenderer { | ||
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { | ||
JPanel tagWrapper = new JPanel(); | ||
tagWrapper.setLayout(new HorizontalLayout(2)); | ||
tagWrapper.setBorder(BorderFactory.createEmptyBorder(2,2,2,2)); | ||
|
||
if(value instanceof Collection){ | ||
for (Object o : ((Collection<Tag>) value).toArray()) { | ||
JButton c = new JButton(((Tag) o).getName()); | ||
c.putClientProperty("JButton.buttonType", "roundRect"); | ||
c.setMargin(new Insets(7,4,7,4)); | ||
c.setBackground(((Tag) o).getBackgroundColor()); | ||
c.setForeground(((Tag) o).getForegroundColor()); | ||
tagWrapper.add(c); | ||
} | ||
} | ||
|
||
return tagWrapper; | ||
} | ||
} |