Fixed current record could disappear after save.
This commit is contained in:
parent
12dbce8df1
commit
68eef9fc88
|
@ -887,11 +887,20 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
|||
* @param fireEvent
|
||||
*/
|
||||
public void dataRefreshAll (boolean fireEvent)
|
||||
{
|
||||
dataRefreshAll(fireEvent, false);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Refresh all data
|
||||
* @param fireEvent
|
||||
*/
|
||||
public void dataRefreshAll (boolean fireEvent, boolean retainedCurrentRow)
|
||||
{
|
||||
log.fine("#" + m_vo.TabNo);
|
||||
/** @todo does not work with alpha key */
|
||||
int keyNo = m_mTable.getKeyID(m_currentRow);
|
||||
m_mTable.dataRefreshAll(fireEvent);
|
||||
m_mTable.dataRefreshAll(fireEvent, retainedCurrentRow ? m_currentRow : -1);
|
||||
// Should use RowID - not working for tables with multiple keys
|
||||
if (keyNo != -1)
|
||||
{
|
||||
|
|
|
@ -593,6 +593,11 @@ public class GridTable extends AbstractTableModel
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!m_open)
|
||||
{
|
||||
m_open = true;
|
||||
}
|
||||
|
||||
// Start Loading
|
||||
m_loader = new Loader();
|
||||
m_rowCount = m_loader.open(maxRows);
|
||||
|
@ -618,7 +623,6 @@ public class GridTable extends AbstractTableModel
|
|||
}
|
||||
else
|
||||
m_loader.close();
|
||||
m_open = true;
|
||||
//
|
||||
m_changed = false;
|
||||
m_rowChanged = -1;
|
||||
|
@ -2505,6 +2509,7 @@ public class GridTable extends AbstractTableModel
|
|||
// Bug [ 1807947 ]
|
||||
|| ( columnName.equals("C_DocType_ID") && hasDocTypeTargetField )
|
||||
|| ( columnName.equals("Line") )
|
||||
|| ( columnName.equals("C_Location_ID"))
|
||||
)
|
||||
{
|
||||
rowData[i] = field.getDefault();
|
||||
|
@ -2744,6 +2749,22 @@ public class GridTable extends AbstractTableModel
|
|||
dataRefresh(row, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* get where clause for row
|
||||
* @param row
|
||||
* @return where clause
|
||||
*/
|
||||
public String getWhereClause(int row)
|
||||
{
|
||||
if (row < 0 || m_sort.size() == 0 || m_inserting)
|
||||
return null;
|
||||
|
||||
Object[] rowData = getDataAtRow(row);
|
||||
String where = getWhereClause(rowData);
|
||||
|
||||
return where;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh Row - ignore changes
|
||||
* @param row row
|
||||
|
@ -2819,12 +2840,43 @@ public class GridTable extends AbstractTableModel
|
|||
* @param fireStatusEvent
|
||||
*/
|
||||
public void dataRefreshAll(boolean fireStatusEvent)
|
||||
{
|
||||
dataRefreshAll(fireStatusEvent, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh all Rows - ignore changes
|
||||
* @param fireStatusEvent
|
||||
*/
|
||||
public void dataRefreshAll(boolean fireStatusEvent, int rowToRetained)
|
||||
{
|
||||
log.info("");
|
||||
m_inserting = false; // should not happen
|
||||
dataIgnore();
|
||||
String retainedWhere = null;
|
||||
if (rowToRetained >= 0)
|
||||
{
|
||||
retainedWhere = getWhereClause(rowToRetained);
|
||||
}
|
||||
close(false);
|
||||
open(m_maxRows);
|
||||
if (retainedWhere != null)
|
||||
{
|
||||
String whereClause = m_whereClause;
|
||||
if (m_whereClause == null || m_whereClause.trim().length() == 0)
|
||||
{
|
||||
m_whereClause = retainedWhere;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_whereClause = "(" + m_whereClause + ") OR (" + retainedWhere + ") ";
|
||||
}
|
||||
open(m_maxRows);
|
||||
m_whereClause = whereClause;
|
||||
}
|
||||
else
|
||||
{
|
||||
open(m_maxRows);
|
||||
}
|
||||
// Info
|
||||
m_rowData = null;
|
||||
m_changed = false;
|
||||
|
|
|
@ -1490,7 +1490,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
|||
*/
|
||||
public void onSave()
|
||||
{
|
||||
onSave(true);
|
||||
if(onSave(true))
|
||||
{
|
||||
String statusLine = statusBar.getStatusLine();
|
||||
curTab.dataRefreshAll(true, true);
|
||||
statusBar.setStatusLine(statusLine);
|
||||
}
|
||||
focusToActivePanel();
|
||||
}
|
||||
|
||||
|
@ -1549,7 +1554,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
|||
boolean retValue = onSave(true);
|
||||
if(retValue)
|
||||
{
|
||||
curTab.dataRefreshAll(true);
|
||||
curTab.dataRefreshAll(true, true);
|
||||
onNew();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ import org.zkoss.zul.Vbox;
|
|||
public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3262889055635240201L;
|
||||
|
||||
|
||||
private static final String POPUP_INFO_BACKGROUND_STYLE = "background-color: #262626; -moz-border-radius: 3px; -webkit-border-radius: 3px; border: 1px solid #262626; border-radius: 3px; ";
|
||||
private static final String POPUP_ERROR_BACKGROUND_STYLE = "background-color: #8B0000; -moz-border-radius: 3px; -webkit-border-radius: 3px; border: 1px solid #8B0000; border-radius: 3px; ";
|
||||
private static final String POPUP_POSITION_STYLE = "position: absolute; z-index: 99; display: block; visibility: visible;";
|
||||
|
@ -236,6 +236,14 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return current status line text
|
||||
*/
|
||||
public String getStatusLine() {
|
||||
return statusLine.getValue();
|
||||
}
|
||||
|
||||
private void createPopup() {
|
||||
popupContent = new Div();
|
||||
|
||||
|
|
Loading…
Reference in New Issue