- web picker field requestFocus() support

- desktop tree table style support
This commit is contained in:
Alexander Budarov 2012-02-13 11:43:30 +00:00
parent 5a0f15e6b5
commit f0334ca9c8
3 changed files with 28 additions and 6 deletions

View File

@ -72,7 +72,7 @@ public abstract class DesktopAbstractTable<C extends JTable>
protected boolean sortable = true;
protected TableSettings tableSettings;
private boolean editable;
private StyleProvider styleProvider;
protected StyleProvider styleProvider;
private Action itemClickAction;
private Action enterPressAction;
@ -1001,12 +1001,24 @@ public abstract class DesktopAbstractTable<C extends JTable>
* Uses delegate renderer to create cell component.
* Then applies desktop styles to cell component.
*/
private class StylingCellRenderer implements TableCellRenderer {
protected class StylingCellRenderer implements TableCellRenderer {
private TableCellRenderer delegate;
public StylingCellRenderer(TableCellRenderer delegate) {
this.delegate = delegate;
}
public StylingCellRenderer() {
}
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
int row, int column) {
TableCellRenderer renderer = table.getDefaultRenderer(value != null ? value.getClass() : Object.class);
TableCellRenderer renderer = delegate;
if (renderer == null) {
renderer = table.getDefaultRenderer(value != null ? value.getClass() : Object.class);
}
java.awt.Component component = renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String style = getStylename(table, row, column);

View File

@ -39,10 +39,14 @@ public class DesktopTreeTable
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
TableCellRenderer cellRenderer = cellRenderers.get(column);
if (cellRenderer != null)
if (cellRenderer != null) {
return cellRenderer;
else
} else if (styleProvider != null) {
TableCellRenderer defaultRenderer = super.getCellRenderer(row, column);
return new StylingCellRenderer(defaultRenderer);
} else {
return super.getCellRenderer(row, column);
}
}
@Override

View File

@ -8,7 +8,9 @@ package com.haulmont.cuba.web.toolkit.ui;
import com.vaadin.data.Property;
import com.vaadin.event.FieldEvents;
import com.vaadin.ui.*;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.TextField;
import java.util.ArrayList;
@ -140,5 +142,9 @@ public class PickerField extends CustomField {
field.setPropertyDataSource(newDataSource);
}
@Override
public void focus() {
field.focus();
}
}