|
|
|
|
Re: Cell Combo,Checkbox editor [message #1702110 is a reply to message #1702109] |
Sun, 19 July 2015 20:32 |
cenk Mising name Messages: 159 Registered: July 2009 |
Senior Member |
|
|
Yes. I realized it after sent mail. But I cannot find a solution. My code is below.
package view.nattablebase.editable;
import java.io.Serializable;
import java.util.List;
import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.AbstractOverrider;
public class CellIndexOverrideLabelAccumulator<T> extends AbstractOverrider {
private ILayer dataProvider;
public CellIndexOverrideLabelAccumulator(ILayer dataProvider) {
this.dataProvider = dataProvider;
}
@Override
public void accumulateConfigLabels(LabelStack configLabels,
int columnPosition, int rowPosition) {
List<String> cellLabels = getConfigLabels(
rowPosition,
columnPosition);
if (cellLabels == null) {
return;
}
for (String configLabel : cellLabels) {
configLabels.addLabel(configLabel);
}
}
protected List<String> getConfigLabels(Integer row, int col) {
CellIndexOverrideKey key = new CellIndexOverrideKey(row, col);
return getOverrides(key);
}
public void registerOverride(Integer row, int col, String configLabel) {
registerOverrides(new CellIndexOverrideKey(row, col), configLabel);
}
}
class CellIndexOverrideKey implements Serializable {
private static final long serialVersionUID = 1L;
Integer cellIndex;
int col;
CellIndexOverrideKey(Integer cellIndex, int col) {
this.cellIndex = cellIndex;
this.col = col;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CellIndexOverrideKey other = (CellIndexOverrideKey) obj;
if (this.cellIndex == null) {
if (other.cellIndex != null)
return false;
} else if (!this.cellIndex.equals(other.cellIndex))
return false;
if (this.col != other.col)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.cellIndex == null) ? 0 : this.cellIndex.hashCode());
result = prime * result + this.col;
return result;
}
public String getComposite() {
return this.cellIndex + String.valueOf(this.col);
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03564 seconds