* 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:
parent
df3b68dedd
commit
8ede88a395
|
@ -137,6 +137,11 @@ public class FormFrame extends CFrame
|
|||
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
|
||||
JMenu mHelp = AEnv.getMenu("Help");
|
||||
menuBar.add(mHelp);
|
||||
|
|
|
@ -130,7 +130,16 @@ public final class VCellEditor extends AbstractCellEditor
|
|||
|
||||
// Other UI
|
||||
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;
|
||||
} // getTableCellEditorComponent
|
||||
|
|
|
@ -109,7 +109,8 @@ public final class VCellRenderer extends DefaultTableCellRenderer
|
|||
else
|
||||
{ // returns JLabel
|
||||
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
|
||||
|
|
|
@ -30,6 +30,13 @@ import org.compiere.util.*;
|
|||
*/
|
||||
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
|
||||
* @param displayType
|
||||
|
@ -39,16 +46,17 @@ public final class VHeaderRenderer implements TableCellRenderer
|
|||
super();
|
||||
// Alignment
|
||||
if (DisplayType.isNumeric(displayType))
|
||||
m_button.setHorizontalAlignment(JLabel.RIGHT);
|
||||
m_alignment = JLabel.RIGHT;
|
||||
else if (displayType == DisplayType.YesNo)
|
||||
m_button.setHorizontalAlignment(JLabel.CENTER);
|
||||
m_alignment = JLabel.CENTER;
|
||||
else
|
||||
m_button.setHorizontalAlignment(JLabel.LEFT);
|
||||
m_button.setMargin(new Insets(0,0,0,0));
|
||||
m_alignment = JLabel.LEFT;
|
||||
} // VHeaderRenderer
|
||||
|
||||
// for 3D effect in Windows
|
||||
private CButton m_button = new CButton();
|
||||
private CButton m_button;
|
||||
|
||||
private int m_alignment;
|
||||
|
||||
/**
|
||||
* Get TableCell RendererComponent
|
||||
|
@ -65,6 +73,25 @@ public final class VHeaderRenderer implements TableCellRenderer
|
|||
{
|
||||
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
|
||||
// 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)
|
||||
{
|
||||
m_button.setPreferredSize(new Dimension(0,0));
|
||||
|
|
|
@ -318,6 +318,13 @@ public final class VString extends CTextField
|
|||
setText(getText()); // obscure
|
||||
} // 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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue