Skip to content

Commit

Permalink
#6 : GridFieldBridge.setValue in GenericDataLoader.readData
Browse files Browse the repository at this point in the history
  • Loading branch information
homebeaver committed Mar 13, 2020
1 parent 7e96751 commit b78b9f1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private Object[] readData(ResultSet rs, int row) throws SQLException {
columnName = field.getColumnName(); // ? oder getIdentifier()
displayType = field.getDisplayType(); // aka AD_Reference_ID
if(row==0) {
LOG.config(f+"/"+size+": "+field); //SeqNoGrid="+field.getSeqNoGrid());
LOG.config(f+"/"+size+": "+columnName); //SeqNoGrid="+field.getSeqNoGrid());
}
// Integer, ID, Lookup (UpdatedBy is a numeric column)
if (displayType == DisplayType.Integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ Object getObject(String columnName, Object value) { // eine interimsLösung
// in den props steht aber #AD_Client_ID=11 - als interimsLösung gut genug
if(v!=null) value = v;
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// das kommt bei Minitable aka InfoPanel vor
//e.printStackTrace();
return value;
} catch (InstantiationException e) {
// TODO Auto-generated catch block
Expand Down Expand Up @@ -88,7 +88,7 @@ Object getObject(String columnName, Object value) { // eine interimsLösung
return value;
}

@Override
@Override // method in DefaultTableRenderer
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
// LOG.config(table
Expand All @@ -98,7 +98,10 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
if(table instanceof MuliRowPanel) {
GenericDataModel dataModel = (GenericDataModel)table.getModel();
if(dataModel.isCellEditable(row, column)) {
// TODO dann sollten sie einen Editor haben
// TODO dann sollten sie einen Editor haben, wie bekomme ich den hier?
// if(value instanceof X_AD_Org) {
LOG.config("Editable X_AD_Org column="+column + " row="+row + " value:"+value);
// }
} else {
value = getObject(dataModel.getColumnName(column), value);
component = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Object getValue() {
}

void setValue(Object newValue, boolean inserting) {
field.setValue(newValue, inserting);
if(field!=null) field.setValue(newValue, inserting);
}

public int getAD_Column_ID() {
Expand Down Expand Up @@ -112,6 +112,7 @@ public String getColumnName() {
}

public String getDescription() {
if(field==null) return (String)getIdentifier();
return field.getDescription();
}

Expand Down Expand Up @@ -239,12 +240,13 @@ public MImage getImage() {
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("GridFieldBridge[");
// stringBuilder.append("Value=").append(getValue());
if(field==null) {
stringBuilder.append("ColumnName=").append(getColumnName());
stringBuilder.append(", DisplayType=").append(getDisplayType());
stringBuilder.append("] ");
} else {
stringBuilder.append("Field_IDe=").append(getAD_Field_ID());
stringBuilder.append("Field_ID=").append(getAD_Field_ID());
stringBuilder.append(", isDisplayed=").append(isDisplayed());
stringBuilder.append(", isDisplayedGrid=").append(isDisplayedGrid());
stringBuilder.append("] ");
Expand Down
17 changes: 12 additions & 5 deletions swingx-client/src/main/java/com/klst/gossip/GridFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,18 @@ public void addColumnModelListener(TableColumnModelListener x) {

// wg. implements TableColumnModel

// @Override
// public void addColumn(TableColumn aColumn) {
// LOG.config("TableColumn "+aColumn);
// super.addColumn(aColumn);
// }
@Override
public void addColumn(TableColumn aColumn) {
LOG.config("TableColumn "+aColumn);
if (aColumn instanceof GridFieldBridge) {
TableColumnExt eColumn = (TableColumnExt)aColumn;
GridFieldBridge gColumn = (GridFieldBridge)aColumn;
eColumn.setToolTipText(gColumn.getDescription()); // TODO funktioniert nicht
super.addColumn(eColumn);
return;
}
super.addColumn(aColumn);
}

// @Override
// public void removeColumn(TableColumn column) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ LEFT OUTER JOIN (SELECT mpp.M_Product_ID, mpp.M_PriceList_Version_id, mpp.IsActi
*/
// 101 ist pr.M_PriceList_Version_ID dh M_ProductPrice.M_PriceList_Version_id für GardenWorld
addColumn("101 as M_PriceList_Version_ID", Msg.translate(Env.getCtx(), "PriceList_Version"), DisplayType.ID);
// die nachfolgende Zeile fürrt zu exception, aber Info Produkt lädt dadurch !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
addColumn("101_as_M_PriceList_Version_ID", Msg.translate(Env.getCtx(), "PriceList_Version"), DisplayType.ID);
// addColumn("M_PriceList_Version_ID", Msg.translate(Env.getCtx(), "PriceList_Version"), DisplayType.ID);
// bomPriceList ist sql-Function: bompricelist(numeric, numeric)
addColumn("bomPriceList(M_Product_ID, 101) AS PriceList", Msg.translate(Env.getCtx(), "PriceList"), DisplayType.Amount);

Expand Down

0 comments on commit b78b9f1

Please sign in to comment.