* Add window menu to FormFrame

* Turn off focus border when cell editor is combobox
* Ensure cell editor and renderer use the same font
* Table header should use default look and feel renderer if possble
* VString - Update standard font and obscure font when setfount is called
This commit is contained in:
Heng Sin Low 2006-11-23 02:18:47 +00:00
parent df3b68dedd
commit 8ede88a395
5 changed files with 56 additions and 7 deletions

View File

@ -136,6 +136,11 @@ public class FormFrame extends CFrame
mTools.addSeparator(); mTools.addSeparator();
AEnv.addMenuItem("Preference", null, null, mTools, this); AEnv.addMenuItem("Preference", null, null, mTools, this);
} }
// Window
AMenu aMenu = (AMenu)Env.getWindow(0);
JMenu mWindow = new WindowMenu(aMenu.getWindowManager(), this);
menuBar.add(mWindow);
// Help // Help
JMenu mHelp = AEnv.getMenu("Help"); JMenu mHelp = AEnv.getMenu("Help");

View File

@ -130,7 +130,16 @@ public final class VCellEditor extends AbstractCellEditor
// Other UI // Other UI
m_editor.setFont(table.getFont()); m_editor.setFont(table.getFont());
m_editor.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); if ( m_editor instanceof VLookup) {
VLookup lookup = (VLookup)m_editor;
if (lookup.getComponents()[0] instanceof JComboBox) {
lookup.setBorder(BorderFactory.createEmptyBorder());
} else {
lookup.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
}
} else {
m_editor.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
}
// //
return (Component)m_editor; return (Component)m_editor;
} // getTableCellEditorComponent } // getTableCellEditorComponent

View File

@ -109,7 +109,8 @@ public final class VCellRenderer extends DefaultTableCellRenderer
else else
{ // returns JLabel { // returns JLabel
c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
c.setFont(AdempierePLAF.getFont_Field()); //c.setFont(AdempierePLAF.getFont_Field());
c.setFont(table.getFont());
} }
// Background & Foreground // Background & Foreground

View File

@ -30,6 +30,13 @@ import org.compiere.util.*;
*/ */
public final class VHeaderRenderer implements TableCellRenderer public final class VHeaderRenderer implements TableCellRenderer
{ {
public VHeaderRenderer()
{
m_button = new CButton();
m_button.setMargin(new Insets(0,0,0,0));
m_button.putClientProperty("Plastic.is3D", Boolean.FALSE);
}
/** /**
* Constructor * Constructor
* @param displayType * @param displayType
@ -39,16 +46,17 @@ public final class VHeaderRenderer implements TableCellRenderer
super(); super();
// Alignment // Alignment
if (DisplayType.isNumeric(displayType)) if (DisplayType.isNumeric(displayType))
m_button.setHorizontalAlignment(JLabel.RIGHT); m_alignment = JLabel.RIGHT;
else if (displayType == DisplayType.YesNo) else if (displayType == DisplayType.YesNo)
m_button.setHorizontalAlignment(JLabel.CENTER); m_alignment = JLabel.CENTER;
else else
m_button.setHorizontalAlignment(JLabel.LEFT); m_alignment = JLabel.LEFT;
m_button.setMargin(new Insets(0,0,0,0));
} // VHeaderRenderer } // VHeaderRenderer
// for 3D effect in Windows // for 3D effect in Windows
private CButton m_button = new CButton(); private CButton m_button;
private int m_alignment;
/** /**
* Get TableCell RendererComponent * Get TableCell RendererComponent
@ -65,6 +73,25 @@ public final class VHeaderRenderer implements TableCellRenderer
{ {
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString()); // Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
// indicator for invisible column // indicator for invisible column
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
Component headerComponent = headerRenderer == null ? null :
headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (headerComponent != null && headerComponent instanceof JComponent) {
if (headerComponent instanceof JLabel ) {
JLabel label = (JLabel)headerComponent;
label.setHorizontalAlignment(m_alignment);
if (value == null)
label.setPreferredSize(new Dimension(0,0));
else
label.setText(value.toString());
return label;
}
m_button.setBorder(((JComponent)headerComponent).getBorder());
} else {
m_button.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
}
if (value == null) if (value == null)
{ {
m_button.setPreferredSize(new Dimension(0,0)); m_button.setPreferredSize(new Dimension(0,0));

View File

@ -317,6 +317,13 @@ public final class VString extends CTextField
m_infocus = false; m_infocus = false;
setText(getText()); // obscure setText(getText()); // obscure
} // focus Lost } // focus Lost
@Override
public void setFont(Font f) {
super.setFont(f);
m_stdFont = f;
m_obscureFont = new Font("SansSerif", Font.ITALIC, m_stdFont.getSize());
}
} // VString } // VString