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
|
* @param fireEvent
|
||||||
*/
|
*/
|
||||||
public void dataRefreshAll (boolean 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);
|
log.fine("#" + m_vo.TabNo);
|
||||||
/** @todo does not work with alpha key */
|
/** @todo does not work with alpha key */
|
||||||
int keyNo = m_mTable.getKeyID(m_currentRow);
|
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
|
// Should use RowID - not working for tables with multiple keys
|
||||||
if (keyNo != -1)
|
if (keyNo != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -593,6 +593,11 @@ public class GridTable extends AbstractTableModel
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_open)
|
||||||
|
{
|
||||||
|
m_open = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Start Loading
|
// Start Loading
|
||||||
m_loader = new Loader();
|
m_loader = new Loader();
|
||||||
m_rowCount = m_loader.open(maxRows);
|
m_rowCount = m_loader.open(maxRows);
|
||||||
|
@ -618,7 +623,6 @@ public class GridTable extends AbstractTableModel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_loader.close();
|
m_loader.close();
|
||||||
m_open = true;
|
|
||||||
//
|
//
|
||||||
m_changed = false;
|
m_changed = false;
|
||||||
m_rowChanged = -1;
|
m_rowChanged = -1;
|
||||||
|
@ -2505,6 +2509,7 @@ public class GridTable extends AbstractTableModel
|
||||||
// Bug [ 1807947 ]
|
// Bug [ 1807947 ]
|
||||||
|| ( columnName.equals("C_DocType_ID") && hasDocTypeTargetField )
|
|| ( columnName.equals("C_DocType_ID") && hasDocTypeTargetField )
|
||||||
|| ( columnName.equals("Line") )
|
|| ( columnName.equals("Line") )
|
||||||
|
|| ( columnName.equals("C_Location_ID"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
rowData[i] = field.getDefault();
|
rowData[i] = field.getDefault();
|
||||||
|
@ -2744,6 +2749,22 @@ public class GridTable extends AbstractTableModel
|
||||||
dataRefresh(row, true);
|
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
|
* Refresh Row - ignore changes
|
||||||
* @param row row
|
* @param row row
|
||||||
|
@ -2819,12 +2840,43 @@ public class GridTable extends AbstractTableModel
|
||||||
* @param fireStatusEvent
|
* @param fireStatusEvent
|
||||||
*/
|
*/
|
||||||
public void dataRefreshAll(boolean 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("");
|
log.info("");
|
||||||
m_inserting = false; // should not happen
|
m_inserting = false; // should not happen
|
||||||
dataIgnore();
|
dataIgnore();
|
||||||
|
String retainedWhere = null;
|
||||||
|
if (rowToRetained >= 0)
|
||||||
|
{
|
||||||
|
retainedWhere = getWhereClause(rowToRetained);
|
||||||
|
}
|
||||||
close(false);
|
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
|
// Info
|
||||||
m_rowData = null;
|
m_rowData = null;
|
||||||
m_changed = false;
|
m_changed = false;
|
||||||
|
|
|
@ -1490,7 +1490,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
*/
|
*/
|
||||||
public void onSave()
|
public void onSave()
|
||||||
{
|
{
|
||||||
onSave(true);
|
if(onSave(true))
|
||||||
|
{
|
||||||
|
String statusLine = statusBar.getStatusLine();
|
||||||
|
curTab.dataRefreshAll(true, true);
|
||||||
|
statusBar.setStatusLine(statusLine);
|
||||||
|
}
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,7 +1554,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
boolean retValue = onSave(true);
|
boolean retValue = onSave(true);
|
||||||
if(retValue)
|
if(retValue)
|
||||||
{
|
{
|
||||||
curTab.dataRefreshAll(true);
|
curTab.dataRefreshAll(true, true);
|
||||||
onNew();
|
onNew();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,10 @@ import org.zkoss.zul.Vbox;
|
||||||
public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
public class StatusBarPanel extends Panel implements EventListener, IStatusBar
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3262889055635240201L;
|
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_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_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;";
|
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() {
|
private void createPopup() {
|
||||||
popupContent = new Div();
|
popupContent = new Div();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue