Merge 1c913e23f51a

This commit is contained in:
Heng Sin Low 2013-03-22 15:56:57 +08:00
commit c4dcf71ca4
4 changed files with 34 additions and 6 deletions

View File

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import org.adempiere.exceptions.DBException;
import org.compiere.model.MColumn;
@ -48,6 +49,9 @@ public class UUIDGenerator extends SvrProcess {
private String tableName;
/** Logger */
private static CLogger log = CLogger.getCLogger(UUIDGenerator.class);
/**
* @see org.compiere.process.SvrProcess#prepare()
*/
@ -94,7 +98,7 @@ public class UUIDGenerator extends SvrProcess {
String columnName = PO.getUUIDColumnName(cTableName);
int AD_Column_ID = DB.getSQLValue(null, "SELECT AD_Column_ID FROM AD_Column Where AD_Table_ID = ? AND ColumnName = ?", AD_Table_ID, columnName);
if (AD_Column_ID <= 0) {
System.out.println("Adding UUID to " + cTableName);
if (log.isLoggable(Level.INFO)) log.info("Adding UUID to " + cTableName);
count++;
//create column
MColumn mColumn = new MColumn(getCtx(), 0, null);
@ -142,6 +146,10 @@ public class UUIDGenerator extends SvrProcess {
} else {
compositeKeys = Arrays.asList(table.getKeyColumns());
}
if ((compositeKeys == null || compositeKeys.size() == 0) && keyColumn == null) {
log.warning("Cannot update orphan table " + table.getTableName() + " (not ID neither parents)");
return;
}
if (compositeKeys == null) {
sql.append(keyColumn);
} else {

View File

@ -291,7 +291,7 @@ public class PrintData implements Serializable
*/
public int getRowIndex()
{
return m_matrix.getRowCount();
return m_matrix.getRowIndex();
} // getRowIndex
/**

View File

@ -54,6 +54,7 @@ import org.adempiere.webui.window.FDialog;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MColumn;
import org.compiere.model.MFactAcct;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.model.X_C_AcctSchema_Element;
import org.compiere.report.core.RModel;
@ -95,12 +96,12 @@ import org.zkoss.zul.South;
public class WAcctViewer extends Window implements EventListener<Event>
{
private static final String TITLE = "Posting";
/**
*
*/
private static final long serialVersionUID = -223185724918504685L;
private static final long serialVersionUID = 3440375640756094077L;
private static final String TITLE = "Posting";
private static final int PAGE_SIZE = 1000;
@ -522,6 +523,7 @@ public class WAcctViewer extends Window implements EventListener<Event>
resultCenter.appendChild(table);
table.setHflex("1");
table.setVflex("1");
table.addEventListener(Events.ON_DOUBLE_CLICK, this);
pagingPanel = new South();
resultPanel.appendChild(pagingPanel);
@ -758,6 +760,9 @@ public class WAcctViewer extends Window implements EventListener<Event>
ListModelTable model = new ListModelTable(list);
table.setModel(model);
}
else if (Events.ON_DOUBLE_CLICK.equals(e.getName()) && source instanceof Listbox && source == table) {
actionZoomFactAcct();
}
} // onEvent
private void actionExport() {
@ -1309,6 +1314,20 @@ public class WAcctViewer extends Window implements EventListener<Event>
}
//
private void actionZoomFactAcct() {
int selected = table.getSelectedIndex();
if(selected == -1) return;
int factAcctIdColumn = m_rmodel.getColumnIndex("Fact_Acct_ID");
ListModelTable model = (ListModelTable) table.getListModel();
Integer faint = (Integer) model.getDataAt(selected, factAcctIdColumn);
if (faint != null) {
int fact_acct_ID = faint.intValue();
AEnv.zoom(MFactAcct.Table_ID, fact_acct_ID);
}
}
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);

View File

@ -561,6 +561,7 @@ public class WAcctViewerData
rm.addColumn(new RColumn(ctx, "AD_Table_ID", DisplayType.TableDir));
rm.addColumn(new RColumn(ctx, "Record_ID", DisplayType.ID));
rm.addColumn(new RColumn(ctx, "Fact_Acct_ID", DisplayType.ID));
if (displayDocumentInfo)
{
rm.addColumn(new RColumn(ctx, "Description", DisplayType.String));