HG corrupted local copy, lost 22 changesets

This commit is contained in:
Jonathan Bernard
2010-02-26 13:21:24 -06:00
parent 39d98f7dde
commit 4179b993f4
80 changed files with 769 additions and 111 deletions

BIN
pit-swing/CHANGE ME Normal file

Binary file not shown.

View File

@ -1,4 +1,4 @@
#Sat Feb 13 08:41:16 CST 2010
app.version=1.1.8
app.version=2.0.1
app.griffon.version=0.2.1
app.name=pit-swing

View File

@ -8,7 +8,6 @@ class PITController {
def view
void mvcGroupInit(Map args) {
model.rootProject = new FileProject(new File('.'))
}
/*

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

View File

@ -1,12 +1,14 @@
package com.jdbernard.pit.swing
import com.jdbernard.pit.Category
import com.jdbernard.pit.Status
import com.jdbernard.pit.Filter
import com.jdbernard.pit.Issue
import com.jdbernard.pit.Project
import com.jdbernard.pit.FileProject
import groovy.beans.Bindable
import java.awt.GridBagConstraints as GBC
import java.awt.Font
import java.awt.Point
import java.awt.event.MouseEvent
import javax.swing.DefaultComboBoxModel
@ -33,8 +35,11 @@ projectListModels = [:]
// map of category -> list icon
categoryIcons = [:]
statusIcons = [:]
// filter for projects and issues
filter = new Filter(categories: [])
filter = new Filter(categories: [],
status: [Status.NEW, Status.VALIDATION_REQUIRED])
popupProject = null
selectedProject = model.rootProject
@ -47,6 +52,10 @@ Category.values().each {
filter.categories.add(it)
}
Status.values().each {
statusIcons[(it)] = imageIcon("/${it.name().toLowerCase()}.png")
}
/* ***************
* event methods
* ***************/
@ -111,23 +120,32 @@ newIssueDialog = dialog(title: 'New Task...', modal: true, pack: true,//size: [3
fill: GBC.HORIZONTAL),
model: new DefaultComboBoxModel(Category.values()))
label('Priority (0-9, 0 is highest priority):',
label('Status:',
constraints: gbc(gridx: 0, gridy: 3, insets: [5, 5, 0, 0],
fill: GBC.HORIZONTAL))
statusComboBox = comboBox(
constraints: gbc(gridx: 1, gridy: 3, insets: [5, 5, 0, 5],
fill: GBC.HORIZONTAL),
model: new DefaultComboBoxModel(Status.values()))
label('Priority (0-9, 0 is highest priority):',
constraints: gbc(gridx: 0, gridy: 4, insets: [5, 5, 0, 0],
fill: GBC.HORIZONTAL))
prioritySpinner = spinner(
constraints: gbc( gridx: 1, gridy: 3, insets: [5, 5, 0, 5],
constraints: gbc( gridx: 1, gridy: 4, insets: [5, 5, 0, 5],
fill: GBC.HORIZONTAL),
model: spinnerNumberModel(maximum: 9, minimum: 0))
button('Cancel', actionPerformed: { newIssueDialog.visible = false },
constraints: gbc(gridx: 0, gridy: 4, insets: [5, 5, 5, 5],
constraints: gbc(gridx: 0, gridy: 5, insets: [5, 5, 5, 5],
anchor: GBC.EAST))
button('Create Issue',
constraints: gbc(gridx: 1, gridy: 4, insets: [5, 5, 5, 5],
constraints: gbc(gridx: 1, gridy: 5, insets: [5, 5, 5, 5],
anchor: GBC.WEST),
actionPerformed: {
def issue = selectedProject.createNewIssue(
category: categoryComboBox.selectedItem,
status: statusComboBox.selectedItem,
priority: prioritySpinner.value,
text: titleTextField.text)
projectListModels[(selectedProject.name)] = null
@ -160,7 +178,13 @@ projectPopupMenu = popupMenu() {
issuePopupMenu = popupMenu() {
menuItem('New Issue...',
actionPerformed: { newIssueDialog.visible = true })
actionPerformed: {
titleTextField.text = ""
categoryComboBox.selectedIndex = 0
statusComboBox.selectedIndex = 0
prioritySpinner.setValue(5)
newIssueDialog.visible = true
})
menuItem('Delete Issue',
actionPerformed: {
@ -180,6 +204,20 @@ issuePopupMenu = popupMenu() {
if (!popupIssue) return
popupIssue.category = category
issueList.invalidate()
issueList.repaint()
})
}
}
menu('Change Status') {
Status.values().each { status ->
menuItem(status.toString(),
icon: statusIcons[(status)],
actionPerformed: {
if (!popupIssue) return
popupIssue.status = status
issueList.invalidate()
issueList.repaint()
})
}
}
@ -198,12 +236,13 @@ issuePopupMenu = popupMenu() {
return
}
issueList.invalidate()
issueList.repaint()
})
}
frame = application(title:'Personal Issue Tracker',
locationRelativeTo: null,
minimumSize: [600, 400],
minimumSize: [800, 500],
//size:[320,480],
pack:true,
//location:[50,50],
@ -231,21 +270,42 @@ frame = application(title:'Personal Issue Tracker',
}
menu('View') {
Category.values().each {
checkBoxMenuItem(it.toString(),
selected: filter.categories.contains(it),
actionPerformed: { evt ->
def cat = Category.toCategory(evt.source.text)
if (filter.categories.contains(cat)) {
filter.categories.remove(cat)
evt.source.selected = false
} else {
filter.categories.add(cat)
evt.source.selected = true
}
projectListModels.clear()
displayProject(selectedProject)
})
menu('Category') {
Category.values().each {
checkBoxMenuItem(it.toString(),
selected: filter.categories.contains(it),
actionPerformed: { evt ->
def cat = Category.toCategory(evt.source.text)
if (filter.categories.contains(cat)) {
filter.categories.remove(cat)
evt.source.selected = false
} else {
filter.categories.add(cat)
evt.source.selected = true
}
projectListModels.clear()
displayProject(selectedProject)
})
}
}
menu('Status') {
Status.values().each {
checkBoxMenuItem(it.toString(),
selected: filter.status.contains(it),
actionPerformed: { evt ->
def st = Status.toStatus(evt.source.text[0..5])
if (filter.status.contains(st)) {
filter.status.remove(st)
evt.source.selected = false
} else {
filter.status.add(st)
evt.source.selected = true
}
projectListModels.clear()
displayProject(selectedProject)
})
}
}
}
@ -266,7 +326,10 @@ frame = application(title:'Personal Issue Tracker',
if (model.rootProject) {
projectTree.rootVisible = model.rootProject.issues.size()
new DefaultTreeModel(makeNodes(model.rootProject))
} else new DefaultTreeModel()
} else {
projectTree.rootVisible = false
new DefaultTreeModel(new DefaultMutableTreeNode())
}
}),
valueChanged: { evt ->
selectedProject = evt?.newLeadSelectionPath?.lastPathComponent?.userObject ?: model.rootProject
@ -280,6 +343,8 @@ frame = application(title:'Personal Issue Tracker',
evt.x, evt.y)
}
})
projectTree.model = new DefaultTreeModel(new DefaultMutableTreeNode())
projectTree.rootVisible = false
projectTree.selectionModel.selectionMode =
TreeSelectionModel.SINGLE_TREE_SELECTION
@ -292,7 +357,8 @@ frame = application(title:'Personal Issue Tracker',
scrollPane(constraints: "top") {
issueList = list(
cellRenderer: new IssueListCellRenderer(
issueIcons: categoryIcons),
categoryIcons: categoryIcons,
statusIcons: statusIcons),
selectionMode: ListSelectionModel.SINGLE_SELECTION,
valueChanged: { displayIssue(issueList.selectedValue) },
mouseClicked: { evt ->
@ -306,7 +372,19 @@ frame = application(title:'Personal Issue Tracker',
})
}
scrollPane(constraints: "bottom") {
issueTextArea = textArea()
issueTextArea = textArea(
font: new Font(Font.MONOSPACED, Font.PLAIN, 12),
focusGained: {},
focusLost: {
if (!issueList?.selectedValue) return
if (issueTextArea.text != issueList.selectedValue.text)
issueList.selectedValue.text = issueTextArea.text
},
mouseExited: {
if (!issueList?.selectedValue) return
if (issueTextArea.text != issueList.selectedValue.text)
issueList.selectedValue.text = issueTextArea.text
})
}
}
}

Binary file not shown.

BIN
pit-swing/lib/pit-2.0.1.jar Normal file

Binary file not shown.

View File

@ -0,0 +1,60 @@
package com.jdbernard.pit.swing
import java.awt.Component
import java.awt.Graphics
import javax.swing.Icon
/**
* This class provides a composite icon. A composite icon
* draws its parts one on the other, all aligned to the
* left top corner. The size of the compsite icon is the
* max size of its parts.
*
*/
public class CompositeIcon implements Icon {
List<Icon> icons
/**
* Construct a composite icon.
*
* @param i The parts.
*/
public CompositeIcon(List<Icon> i) { icons = i; }
/**
* Draw the icon at the specified location. Icon implementations
* may use the Component argument to get properties useful for
* painting, e.g. the foreground or background color.
*
* @param c The component to take attributes from.
* @param g The graphics port to draw into.
* @param x The x drawing coordinate.
* @param y The y drawing coordinate.
*/
public void paintIcon(Component c, Graphics g, int x, int y) {
icons.each { it.paintIcon(c, g, x, y) }
}
/**
* Returns the icon's width.
*
* @return an int specifying the fixed width of the icon.
*/
public int getIconWidth() {
int width = 0;
icons.each { width = Math.max(width, it.iconWidth) }
return width;
}
/**
* Returns the icon's height.
*
* @return an int specifying the fixed height of the icon.
*/
public int getIconHeight() {
int height = 0;
icons.each { height = Math.max(height, it.iconHeight) }
return height;
}
}

View File

@ -1,5 +1,7 @@
package com.jdbernard.pit.swing
import com.jdbernard.pit.Category
import com.jdbernard.pit.Status
import java.awt.Component
import javax.swing.Icon
import javax.swing.JList
@ -7,14 +9,23 @@ import javax.swing.DefaultListCellRenderer
public class IssueListCellRenderer extends DefaultListCellRenderer {
Map<Category, Icon> issueIcons
Map<Category, Icon> categoryIcons
Map<Status, Icon> statusIcons
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean selected, boolean hasFocus) {
def component = super.getListCellRendererComponent(list, value, index,
selected, hasFocus)
if (issueIcons[(value.category)])
component.setIcon(issueIcons[(value.category)])
def icon
if (categoryIcons[(value.category)]) {
icon = categoryIcons[(value.category)]
if (statusIcons[(value.status)])
icon = new CompositeIcon([icon, statusIcons[(value.status)]])
}
if (icon) setIcon(icon)
component.text = "<html><tt>${value.id} (${value.priority}): </tt>" +
"${value.title}</html>"
return component

0
pit-swing/stacktrace.log Normal file
View File