diff --git a/client/.classpath b/client/.classpath
index 860bc76c52..03a5b25706 100644
--- a/client/.classpath
+++ b/client/.classpath
@@ -7,6 +7,6 @@
-
+
diff --git a/client/src/org/compiere/grid/VTable.java b/client/src/org/compiere/grid/VTable.java
index 9783c57754..2993713d0d 100644
--- a/client/src/org/compiere/grid/VTable.java
+++ b/client/src/org/compiere/grid/VTable.java
@@ -18,11 +18,14 @@ package org.compiere.grid;
import java.awt.*;
import java.beans.*;
+
+import javax.swing.Action;
import javax.swing.table.*;
import org.compiere.grid.ed.*;
import org.compiere.model.*;
import org.compiere.swing.*;
import org.compiere.util.*;
+import org.jdesktop.swingx.action.BoundAction;
/**
* Table Grid based on CTable.
@@ -36,6 +39,8 @@ import org.compiere.util.*;
public final class VTable extends CTable
implements PropertyChangeListener
{
+ private final static String PACK_ALL_COMMAND = CColumnControlButton.COLUMN_CONTROL_MARKER + "packAll";
+
/**
* Default Constructor
*/
@@ -45,7 +50,27 @@ public final class VTable extends CTable
setAutoscrolls(true);
putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
new VTableExcelAdapter(this); // teo_sarca - FR [ 1753943 ]
+
+ getActionMap().put(PACK_ALL_COMMAND, createPackAllAction());
} // VTable
+
+
+ private Action createPackAllAction()
+ {
+ //TODO: localization
+ BoundAction action = new BoundAction("Size All Column", PACK_ALL_COMMAND);
+ action.setLongDescription("Size all column to fit content");
+ action.registerCallback(this, "packAll");
+ return action;
+ }
+
+ /**
+ * Size all column to fit content.
+ */
+ public void packAll()
+ {
+ autoSize(true);
+ }
/** Logger */
private static CLogger log = CLogger.getCLogger(VTable.class);
diff --git a/client/src/org/compiere/grid/ed/TableCellNone.java b/client/src/org/compiere/grid/ed/TableCellNone.java
deleted file mode 100644
index 8f017d6cd7..0000000000
--- a/client/src/org/compiere/grid/ed/TableCellNone.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/******************************************************************************
- * Product: Adempiere ERP & CRM Smart Business Solution *
- * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
- * This program is free software; you can redistribute it and/or modify it *
- * under the terms version 2 of the GNU General Public License as published *
- * by the Free Software Foundation. This program is distributed in the hope *
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
- * See the GNU General Public License for more details. *
- * You should have received a copy of the GNU General Public License along *
- * with this program; if not, write to the Free Software Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
- * For the text or an alternative of this public license, you may reach us *
- * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
- * or via info@compiere.org or http://www.compiere.org/license.html *
- *****************************************************************************/
-package org.compiere.grid.ed;
-
-import java.awt.*;
-import java.util.*;
-import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.table.*;
-import org.compiere.util.*;
-
-/**
- * No Table Edit/Renderer
- *
- * @author Jorg Janke
- * @version $Id: TableCellNone.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
- */
-public class TableCellNone
- implements TableCellRenderer, TableCellEditor
-{
- /**
- * Table Cell None constructor
- * @param ColumnName name
- */
- public TableCellNone (String ColumnName)
- {
- m_ColumnName = ColumnName;
- } // TableCellNone
-
- /** Column Name */
- private String m_ColumnName;
- /** Object */
- private Object m_value = null;
-
- /** Logger */
- private static CLogger log = CLogger.getCLogger (TableCellNone.class);
-
- /**
- * Get Table Cell Renderer Component
- * @param table
- * @param value
- * @param isSelected
- * @param hasFocus
- * @param row
- * @param col
- * @return null
- */
- public Component getTableCellRendererComponent (JTable table, Object value,
- boolean isSelected, boolean hasFocus, int row, int col)
- {
- log.finest(m_ColumnName + ": Value=" + value + ", row=" + row + ", col=" + col);
- m_value = value;
- return null;
- }
-
- /**
- * Get Table Cell Editor Component
- * @param table
- * @param value
- * @param isSelected
- * @param row
- * @param col
- * @return null
- */
- public Component getTableCellEditorComponent (JTable table, Object value,
- boolean isSelected, int row, int col)
- {
- log.finest(m_ColumnName + ": Value=" + value + ", row=" + row + ", col=" + col);
- m_value = value;
- return null;
- }
-
- /**
- * Get Cell Editor Value
- * @return null
- */
- public Object getCellEditorValue ()
- {
- log.finest(m_ColumnName + "=" + m_value);
- return m_value;
- }
-
- /**
- * Is Cell Editable
- * @param anEvent
- * @return false
- */
- public boolean isCellEditable (EventObject anEvent)
- {
- log.finest(m_ColumnName);
- return false;
- }
-
- /**
- * Should Select Cell
- * @param anEvent
- * @return false
- */
- public boolean shouldSelectCell (EventObject anEvent)
- {
- log.finest(m_ColumnName);
- return false;
- }
-
- /**
- * Stop Cell Editing
- * @return true
- */
- public boolean stopCellEditing ()
- {
- return true;
- }
-
- /**
- * Cancel Cell Editing
- */
- public void cancelCellEditing ()
- {
- }
-
-
- public void addCellEditorListener (CellEditorListener l)
- {
- }
-
- public void removeCellEditorListener (CellEditorListener l)
- {
- }
-
-} // TableCellNone
diff --git a/client/src/org/compiere/grid/ed/VHeaderRenderer.java b/client/src/org/compiere/grid/ed/VHeaderRenderer.java
index fa2016d91e..b0edc83293 100644
--- a/client/src/org/compiere/grid/ed/VHeaderRenderer.java
+++ b/client/src/org/compiere/grid/ed/VHeaderRenderer.java
@@ -77,7 +77,7 @@ public final class VHeaderRenderer implements TableCellRenderer
if (table instanceof CTable)
{
CTable cTable = (CTable)table;
- if (cTable.getSortColumn() == column)
+ if (cTable.getSortColumn() == table.convertColumnIndexToModel(column))
{
icon = cTable.isSortAscending()
? Env.getImageIcon2("uparrow")
diff --git a/client/src/org/compiere/grid/tree/VTreePanel.java b/client/src/org/compiere/grid/tree/VTreePanel.java
index ad055f6294..9e8df14e22 100644
--- a/client/src/org/compiere/grid/tree/VTreePanel.java
+++ b/client/src/org/compiere/grid/tree/VTreePanel.java
@@ -36,6 +36,8 @@ import org.compiere.apps.*;
import org.compiere.model.*;
import org.compiere.swing.*;
import org.compiere.util.*;
+import org.jdesktop.swingx.JXTaskPane;
+import org.jdesktop.swingx.JXTaskPaneContainer;
/**
* Tree Panel displays trees.
@@ -78,8 +80,7 @@ public final class VTreePanel extends CPanel
if (!hasBar)
{
bar.setPreferredSize(new Dimension(0,0));
- //centerSplitPane.setDividerLocation(0);
- centerSplitPane.setDividerLocation(1000);
+ centerSplitPane.setDividerLocation(0);
centerSplitPane.setDividerSize(0);
popMenuTree.remove(mBarAdd);
}
@@ -130,7 +131,8 @@ public final class VTreePanel extends CPanel
jt.removeAll();
toolbarMap = new HashMap();
Enumeration enTop =m_root.children();
- JToolBar jt = null;
+ JToolBar jt = null;
+ Map titleMap = new HashMap();
while (enTop.hasMoreElements())
{
MTreeNode ndTop = (MTreeNode)enTop.nextElement();
@@ -142,7 +144,7 @@ public final class VTreePanel extends CPanel
if (nd.isOnBar()) {
if (!labelDrawn) {
jt = new JToolBar(JToolBar.VERTICAL);
- addToBar(ndTop, jt, true);
+ titleMap.put(jt, ndTop.toString().trim());
labelDrawn=true;
toolbarMap.put(ndTop.getNode_ID(), jt);
}
@@ -160,15 +162,15 @@ public final class VTreePanel extends CPanel
jt2.setFloatable(false);
jt2.setRollover(true);
jt2.setBorder(BorderFactory.createEmptyBorder());
- CPanel barPart = new CPanel();
+
+ JXTaskPane barPart = new JXTaskPane();
+ barPart.setAnimated(true);
barPart.setLayout(new BorderLayout());
barPart.add(jt2, BorderLayout.NORTH);
- barPart.setBorder(new ShadowBorder());
+ barPart.setTitle(titleMap.get(jt2));
+
bar.add(barPart);
}
- if (toolbarMap.size()<=3){
- bar.setLayout(new GridLayout(0, 1));
- }
}
return true;
} // initTree
@@ -188,12 +190,10 @@ public final class VTreePanel extends CPanel
private JPopupMenu popMenuBar = new JPopupMenu();
private CMenuItem mFrom = new CMenuItem();
private CMenuItem mTo = new CMenuItem();
- private CPanel bar = new CPanel();
+ private JXTaskPaneContainer bar = new JXTaskPaneContainer();
private java.util.List toolbar;
private HashMap toolbarMap;
private int toolBarCols=3;
- //private int toolBarRows=2;
- //private JToolBar toolbar = new JToolBar(JToolBar.VERTICAL);
private CMenuItem mBarAdd = new CMenuItem();
private CMenuItem mBarRemove = new CMenuItem();
private BorderLayout southLayout = new BorderLayout();
@@ -251,8 +251,12 @@ public final class VTreePanel extends CPanel
treePane.getViewport().add(tree, null);
treePane.setBorder(new ShadowBorder());
tree.setBorder(BorderFactory.createEmptyBorder());
-// treePane.setPreferredSize(new Dimension(50,200));
-// tree.setPreferredSize(new Dimension(100,150));
+
+ CPanel treePart = new CPanel();
+ treePart.setLayout(new BorderLayout());
+ treePart.add(treePane, BorderLayout.CENTER);
+ treePart.setBorder(BorderFactory.createEmptyBorder());
+
//
treeExpand.setText(Msg.getMsg(Env.getCtx(), "ExpandTree"));
treeExpand.setActionCommand("Expand");
@@ -269,22 +273,18 @@ public final class VTreePanel extends CPanel
southPanel.add(treeExpand, BorderLayout.WEST);
southPanel.add(treeSearchLabel, BorderLayout.CENTER);
southPanel.add(treeSearch, BorderLayout.EAST);
- this.add(southPanel, BorderLayout.SOUTH);
+ treePart.add(southPanel, BorderLayout.SOUTH);
//
centerSplitPane.setOpaque(false);
- centerSplitPane.add(treePane, JSplitPane.LEFT); //fcsku 3.7.2007 switch menu/favorites
- centerSplitPane.add(bar, JSplitPane.RIGHT);
+ JScrollPane scrollPane = new JScrollPane();
+ scrollPane.getViewport().add(bar);
+ centerSplitPane.add(scrollPane, JSplitPane.LEFT); //hengsin, jxtaskpane
+ centerSplitPane.add(treePart, JSplitPane.RIGHT);
centerSplitPane.setBorder(BorderFactory.createEmptyBorder());
removeSplitPaneBorder();
this.add(centerSplitPane, BorderLayout.CENTER);
- GridLayout barLayout = new GridLayout(0, toolBarCols);
- bar.setMinimumSize(new Dimension (50,50));
- bar.setBorder(new ShadowBorder());
- bar.setLayout(barLayout);
-
-
//
mFrom.setText(Msg.getMsg(Env.getCtx(), "ItemMove"));
mFrom.setActionCommand("From");
@@ -916,17 +916,20 @@ public final class VTreePanel extends CPanel
if(ndTop.getNode_ID()==topParentId){
log.fine("add new category: " + ndTop);
parent = new JToolBar(JToolBar.VERTICAL);
- addToBar(ndTop, parent, true);
+
toolbarMap.put(ndTop.getNode_ID(), parent);
toolbar.add(parent);
parent.setOpaque(false);
parent.setFloatable(false);
parent.setRollover(true);
parent.setBorder(BorderFactory.createEmptyBorder());
- CPanel barPart = new CPanel();
+
+ JXTaskPane barPart = new JXTaskPane();
+ barPart.setTitle(ndTop.toString().trim());
+ barPart.setAnimated(true);
barPart.setLayout(new BorderLayout());
barPart.add(parent, BorderLayout.NORTH);
- barPart.setBorder(new ShadowBorder());
+
bar.add(barPart);
return parent;
}