[Openproj-commitlog] openproj_ui/src/com/projity/dialog/assignment AssignmentEntryPane.java, 1.4, 1
Open Source desktop project management
Brought to you by:
akheirol
From: Anthony V. <av...@us...> - 2009-09-16 17:27:24
|
Update of /cvsroot/openproj/openproj_ui/src/com/projity/dialog/assignment In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv15499/src/com/projity/dialog/assignment Modified Files: AssignmentEntryPane.java Log Message: DEF169243 Hard to see what was selected when assigning resource to task - selected task has text in white if it is not assigned (just like in the main spreadsheet Index: AssignmentEntryPane.java =================================================================== RCS file: /cvsroot/openproj/openproj_ui/src/com/projity/dialog/assignment/AssignmentEntryPane.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- AssignmentEntryPane.java 27 Jul 2009 17:07:43 -0000 1.4 +++ AssignmentEntryPane.java 16 Sep 2009 17:27:14 -0000 1.5 @@ -1,51 +1,51 @@ /* -The contents of this file are subject to the Common Public Attribution License -Version 1.0 (the "License"); you may not use this file except in compliance with -the License. You may obtain a copy of the License at -http://www.projity.com/license . The License is based on the Mozilla Public -License Version 1.1 but Sections 14 and 15 have been added to cover use of -software over a computer network and provide for limited attribution for the -Original Developer. In addition, Exhibit A has been modified to be consistent +The contents of this file are subject to the Common Public Attribution License +Version 1.0 (the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at +http://www.projity.com/license . The License is based on the Mozilla Public +License Version 1.1 but Sections 14 and 15 have been added to cover use of +software over a computer network and provide for limited attribution for the +Original Developer. In addition, Exhibit A has been modified to be consistent with Exhibit B. -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the -specific language governing rights and limitations under the License. The -Original Code is OpenProj. The Original Developer is the Initial Developer and -is Projity, Inc. All portions of the code written by Projity are Copyright (c) +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the +specific language governing rights and limitations under the License. The +Original Code is OpenProj. The Original Developer is the Initial Developer and +is Projity, Inc. All portions of the code written by Projity are Copyright (c) 2006, 2007. All Rights Reserved. Contributors Projity, Inc. -Alternatively, the contents of this file may be used under the terms of the -Projity End-User License Agreeement (the Projity License), in which case the -provisions of the Projity License are applicable instead of those above. If you -wish to allow use of your version of this file only under the terms of the -Projity License and not to allow others to use your version of this file under -the CPAL, indicate your decision by deleting the provisions above and replace -them with the notice and other provisions required by the Projity License. If -you do not delete the provisions above, a recipient may use your version of this +Alternatively, the contents of this file may be used under the terms of the +Projity End-User License Agreeement (the Projity License), in which case the +provisions of the Projity License are applicable instead of those above. If you +wish to allow use of your version of this file only under the terms of the +Projity License and not to allow others to use your version of this file under +the CPAL, indicate your decision by deleting the provisions above and replace +them with the notice and other provisions required by the Projity License. If +you do not delete the provisions above, a recipient may use your version of this file under either the CPAL or the Projity License. -[NOTE: The text of this license may differ slightly from the text of the notices -in Exhibits A and B of the license at http://www.projity.com/license. You should +[NOTE: The text of this license may differ slightly from the text of the notices +in Exhibits A and B of the license at http://www.projity.com/license. You should use the latest text at http://www.projity.com/license for your modifications. You may not remove this license text from the source files.] -Attribution Information: Attribution Copyright Notice: Copyright © 2006, 2007 -Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj, -an open source solution from Projity. Attribution URL: http://www.projity.com -Graphic Image as provided in the Covered Code as file: openproj_logo.png with +Attribution Information: Attribution Copyright Notice: Copyright © 2006, 2007 +Projity, Inc. Attribution Phrase (not exceeding 10 words): Powered by OpenProj, +an open source solution from Projity. Attribution URL: http://www.projity.com +Graphic Image as provided in the Covered Code as file: openproj_logo.png with alternatives listed on http://www.projity.com/logo -Display of Attribution Information is required in Larger Works which are defined -in the CPAL as a work which combines Covered Code or portions thereof with code -not governed by the terms of the CPAL. However, in addition to the other notice -obligations, all copies of the Covered Code in Executable and Source Code form -distributed must, as a form of attribution of the original author, include on -each user interface screen the "OpenProj" logo visible to all users. The -OpenProj logo should be located horizontally aligned with the menu bar and left -justified on the top left of the screen adjacent to the File menu. The logo -must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it -must direct them back to http://www.projity.com. +Display of Attribution Information is required in Larger Works which are defined +in the CPAL as a work which combines Covered Code or portions thereof with code +not governed by the terms of the CPAL. However, in addition to the other notice +obligations, all copies of the Covered Code in Executable and Source Code form +distributed must, as a form of attribution of the original author, include on +each user interface screen the "OpenProj" logo visible to all users. The +OpenProj logo should be located horizontally aligned with the menu bar and left +justified on the top left of the screen adjacent to the File menu. The logo +must be at least 100 x 25 pixels. When users click on the "OpenProj" logo it +must direct them back to http://www.projity.com. */ package com.projity.dialog.assignment; @@ -105,10 +105,10 @@ public static final String spreadsheetCategory="assignmentEntrySpreadsheet"; protected NodeModelCache cache; private boolean replace; - + private static final int REQUEST_DEMAND_TYPE_COLUMN = 0; // hidden now private static final int UNITS_COLUMN = REQUEST_DEMAND_TYPE_COLUMN+1; - + class AssignmentSpreadSheet extends SpreadSheet { private static final long serialVersionUID = 1L; ResourceAssigner resourceAssigner; @@ -125,17 +125,17 @@ private AssignmentEntry getEntryInRow(int row) { Node node = ((SpreadSheetModel)getModel()).getNode(row).getNode(); - if (node != null && !node.isVirtual()) + if (node != null && !node.isVirtual()) return (AssignmentEntry)node.getImpl(); else return null; } - + public void setValueAt(Object aValue, int row, int column) { AssignmentEntry entry = getEntryInRow(row); if (entry == null) return; - + if (!entry.isAssigned()) { // assign it first, then set value if (resourceAssigner != null) { Field field = ((SpreadSheetModel)getModel()).getFieldInColumn(column+1); @@ -148,7 +148,7 @@ } super.setValueAt(aValue,row,column); } - + /** * Gets selected resources on spreadsheet. * @param assignedOnly - if true, only selected resources are returned @@ -168,7 +168,7 @@ public TableCellEditor getCellEditor(int row, int column) { TableCellEditor editor = null; AssignmentEntry entry = getEntryInRow(row); - + if (entry != null) { Field field = ((SpreadSheetModel)getModel()).getFieldInColumn(column+1); if (field == AssignmentEntry.getRateField()) { @@ -182,11 +182,11 @@ editor = super.getCellEditor(row, column); return editor; } - + public TableCellRenderer getCellRenderer(int row, int column) { TableCellRenderer renderer = null; AssignmentEntry entry = getEntryInRow(row); - + if (entry != null) { Field field = ((SpreadSheetModel)getModel()).getFieldInColumn(column+1); if (field == AssignmentEntry.getRateField()) { @@ -200,11 +200,11 @@ return renderer; } - + int getSelectedCount() { return NodeList.nodeListToImplList(getSelectedNodes()).size(); // doesn't count void nodes } - + /* (non-Javadoc) * @see javax.swing.JTable#prepareRenderer(javax.swing.table.TableCellRenderer, int, int) */ @@ -213,12 +213,12 @@ Component component = super.prepareRenderer(renderer, row, column); AssignmentEntry entry = getEntryInRow(row); component.setForeground(Colors.BLACK); - + if (entry != null) { if (entry.isAssigned()) { if (taskList.size() == entry.getAssignmentCount()) { // if all selected tasks are assigned to this resource, show it green //if (column == 0) - component.setBackground(Colors.PALE_GREEN); + component.setBackground(Colors.PALE_GREEN); } else { //if (column == 0) component.setBackground(Colors.PALE_YELLOW); @@ -228,13 +228,18 @@ ((JLabel)component).setText(Field.MULTIPLE_VALUES); } } - } + } + } else { + if(this.isRowSelected(row)){ + component.setForeground(Colors.WHITE); + } } + } return component; } - - + + public Component prepareEditor(TableCellEditor editor, int row, int column) { dialog.setEditorButtonsVisible(true); @@ -248,7 +253,7 @@ dialog.setEditorButtonsVisible(false); super.editingStopped(e); } - + public void doDoubleClick(int row, int col) { if (dialog instanceof AssignmentDialog) { ((AssignmentDialog)dialog).assign(); @@ -268,9 +273,9 @@ } protected Closure transformerClosure; - + /** - * + * */ public AssignmentEntryPane(CommonAssignmentDialog dialog, Project project, ResourceAssigner resourceAssigner, boolean replace,Closure transformerClosure) { super(); @@ -281,7 +286,7 @@ //setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); this.transformerClosure=transformerClosure; } - + private SpreadSheetFieldArray getFields() { return (SpreadSheetFieldArray) Dictionary.get(spreadsheetCategory,Messages.getString( replace ? "Spreadsheet.AssignmentEntry.replaceResources" @@ -291,11 +296,11 @@ if (project == null) return; ResourcePool pool = project.getResourcePool(); - + // if (assignmentModel==null){ pool.getResourceOutline().getHierarchy().removeHierarchyListener(this); pool.getResourceOutline().getHierarchy().addHierarchyListener(this); - + assignmentModel = NodeModelFactory.getInstance().replicate(pool.getResourceOutline(),new NodeFactoryTransformer()); assignmentModel.getHierarchy().setNbEndVoidNodes(0); // don't allow blank lines // } @@ -305,12 +310,12 @@ spreadSheet.setActions(new String[]{}); } - - + + cache=NodeModelCacheFactory.getInstance().createDefaultCache(assignmentModel,pool,NodeModelCache.ASSIGNMENT_TYPE,"AssignmentEntry",transformerClosure); SpreadSheetFieldArray fields=getFields(); spreadSheet.setCache(cache,fields,fields.getCellStyle(),fields.getActionList()); - + // set widths of these columns explicitly if (!replace) { //TODO width should come from definition in xml, not hard coded here // spreadSheet.getColumnModel().getColumn(REQUEST_DEMAND_TYPE_COLUMN).setPreferredWidth(50); @@ -320,26 +325,26 @@ JViewport viewport = createViewport(); viewport.setView(spreadSheet); setViewport(viewport); - + setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - + Dimension d=spreadSheet.getPreferredSize(); Dimension enclosing=new Dimension(); - + //big awful hack to remove GraphicConfiguration config=GraphicConfiguration.getInstance(); int rowHeaderWidth=config.getRowHeaderWidth() + spreadSheet.getRowMargin()*2; //should be rowHeader's one - + // TableColumnModel tm=spreadSheet.getColumnModel(); // int w=tm.getTotalColumnWidth(); - + enclosing.setSize(d.getWidth()/*+rowHeaderWidth*/,d.getHeight()); viewport.setPreferredSize(enclosing); - + //setBorder(new EmptyBorder(0,0,0,0)); updateTable(); } - + /** * @param project The project to set. */ @@ -347,7 +352,7 @@ this.project = project; init(); } - + /** * Functor to call setAssignmentsFromTaskList */ private class AssignmentEntrySetter implements Closure { @@ -355,7 +360,7 @@ AssignmentEntrySetter(List taskList) { this.taskList = taskList; } - + /* (non-Javadoc) * @see org.apache.commons.collections.Closure#execute(java.lang.Object) @@ -364,7 +369,7 @@ AssignmentEntry entry = (AssignmentEntry)(((Node)arg0).getImpl()); entry.setAssignmentsFromTaskList(taskList); } - + } /** @@ -373,7 +378,7 @@ */ void setSelectedTasks(List taskList) { this.taskList = taskList; updateTable(); - // disable ss if no tasks selected. + // disable ss if no tasks selected. boolean enabled = !taskList.isEmpty(); spreadSheet.setEnabled(enabled); spreadSheet.getRowHeader().setEnabled(enabled); @@ -384,7 +389,7 @@ return spreadSheet.getSelectedResources(assignedOnly); } - + int getSelectedCount(){ return spreadSheet.getSelectedCount(); } @@ -394,19 +399,19 @@ ((SpreadSheetModel)spreadSheet.getModel()).getCache().update(); ((SpreadSheetModel)spreadSheet.getModel()).fireTableDataChanged(); // redraw it } - - - - + + + + public AssignmentSpreadSheet getSpreadSheet() { return spreadSheet; } - + public void nodesChanged(HierarchyEvent e) { // TODO Auto-generated method stub - + } public void nodesInserted(HierarchyEvent e) { @@ -419,6 +424,6 @@ public void structureChanged(HierarchyEvent e) { // TODO Auto-generated method stub - + } } |