Incremental commit. Reorganizing libpit implementations. Starting XML implementation.
This commit is contained in:
parent
63d47d8d9c
commit
482330d02a
@ -1,5 +1,6 @@
|
|||||||
package com.jdbernard.pit
|
package com.jdbernard.pit.file
|
||||||
|
|
||||||
|
import com.jdbernard.pit.*
|
||||||
import java.lang.IllegalArgumentException as IAE
|
import java.lang.IllegalArgumentException as IAE
|
||||||
|
|
||||||
public class FileIssue extends Issue {
|
public class FileIssue extends Issue {
|
@ -1,4 +1,6 @@
|
|||||||
package com.jdbernard.pit
|
package com.jdbernard.pit.file
|
||||||
|
|
||||||
|
import com.jdbernard.pit.*
|
||||||
|
|
||||||
class FileProject extends Project {
|
class FileProject extends Project {
|
||||||
|
|
8
libpit/src/com/jdbernard/pit/xml/XmlProject.groovy
Normal file
8
libpit/src/com/jdbernard/pit/xml/XmlProject.groovy
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.jdbernard.pit.xml
|
||||||
|
|
||||||
|
import com.jdbernard.pit.*
|
||||||
|
|
||||||
|
public class XmlProject extends Project {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -3,4 +3,4 @@
|
|||||||
app.archetype=default
|
app.archetype=default
|
||||||
app.griffon.version=0.9
|
app.griffon.version=0.9
|
||||||
app.name=pit-swing
|
app.name=pit-swing
|
||||||
app.version=0.1
|
app.version=2.5.1
|
||||||
|
@ -123,7 +123,7 @@ issuePopupMenu = popupMenu() {
|
|||||||
def newPriority = JOptionPane.showInputDialog(mainMVC.view.frame,
|
def newPriority = JOptionPane.showInputDialog(mainMVC.view.frame,
|
||||||
'New priority (0-9)', 'Change Priority...',
|
'New priority (0-9)', 'Change Priority...',
|
||||||
JOptionPane.QUESTION_MESSAGE)
|
JOptionPane.QUESTION_MESSAGE)
|
||||||
try { model.popupIsse.priority = newPriority.toInteger() }
|
try { model.popupIssue.priority = newPriority.toInteger() }
|
||||||
catch (NumberFormatException nfe) {
|
catch (NumberFormatException nfe) {
|
||||||
JOptionPane.showMessageDialog(mainMVC.view.frame,
|
JOptionPane.showMessageDialog(mainMVC.view.frame,
|
||||||
'The priority value must be an integer in [0-9].',
|
'The priority value must be an integer in [0-9].',
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.jdbernard.pit.swing
|
package com.jdbernard.pit.swing
|
||||||
|
|
||||||
|
import java.awt.Color
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
import java.awt.Dimension
|
import java.awt.Dimension
|
||||||
|
import java.awt.Font
|
||||||
import javax.swing.Icon
|
import javax.swing.Icon
|
||||||
import javax.swing.JLabel
|
import javax.swing.JLabel
|
||||||
import javax.swing.JTable
|
import javax.swing.JTable
|
||||||
@ -9,11 +11,40 @@ import javax.swing.table.DefaultTableCellRenderer
|
|||||||
|
|
||||||
public class IssueTableCellRenderer extends DefaultTableCellRenderer {
|
public class IssueTableCellRenderer extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
|
public static List textColors = [
|
||||||
|
Color.getHSBColor(0f, 1f, 0.8f), // 0 - Highest priority
|
||||||
|
Color.getHSBColor(0f, 1f, 0.6f), // 1 - High priority
|
||||||
|
Color.getHSBColor(0f, 1f, 0.4f),
|
||||||
|
Color.getHSBColor(0f, 1f, 0.2f), // 3 - Medium-high priority
|
||||||
|
Color.getHSBColor(0f, 0f, 0f),
|
||||||
|
Color.getHSBColor(0f, 0f, 0f), // 5 - Medium priority
|
||||||
|
Color.getHSBColor(0f, 0f, 0.1f),
|
||||||
|
Color.getHSBColor(0f, 0f, 0.2f), // 7 - Medium-low priority
|
||||||
|
Color.getHSBColor(0f, 0f, 0.4f),
|
||||||
|
Color.getHSBColor(0f, 0f, 0.6f), // 9 - Lowest priority
|
||||||
|
]
|
||||||
|
|
||||||
|
private Font boldFont
|
||||||
|
private Font plainFont
|
||||||
|
|
||||||
|
public IssueTableCellRenderer() {
|
||||||
|
super()
|
||||||
|
plainFont = getFont()
|
||||||
|
boldFont = plainFont.deriveFont(Font.BOLD)
|
||||||
|
}
|
||||||
|
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value,
|
public Component getTableCellRendererComponent(JTable table, Object value,
|
||||||
boolean isSelected, boolean hasFocus, int row, int col) {
|
boolean isSelected, boolean hasFocus, int row, int col) {
|
||||||
super.getTableCellRendererComponent(table, value, isSelected,
|
super.getTableCellRendererComponent(table, value, isSelected,
|
||||||
hasFocus, row, col)
|
hasFocus, row, col)
|
||||||
|
|
||||||
|
// set row color
|
||||||
|
int modelRow = table.convertRowIndexToModel(row)
|
||||||
|
int priority = table.model.getValueAt(modelRow, 2)[1..-4].toInteger()
|
||||||
|
if (priority <= 3) setFont(boldFont)
|
||||||
|
else setFont(plainFont)
|
||||||
|
setForeground(textColors[priority])
|
||||||
|
|
||||||
if (value instanceof String) {
|
if (value instanceof String) {
|
||||||
if (col > 2) {
|
if (col > 2) {
|
||||||
setHorizontalAlignment(JLabel.LEADING)
|
setHorizontalAlignment(JLabel.LEADING)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user