IDEMPIERE-1242 NPE results in Calendar Year and Period window.

This commit is contained in:
Heng Sin Low 2013-08-05 17:12:56 +08:00
parent 7badfa1db9
commit 426909fd42
3 changed files with 24 additions and 4 deletions

View File

@ -2432,6 +2432,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
final IADTabpanel adtabPanel = findADTabpanel(wButton); final IADTabpanel adtabPanel = findADTabpanel(wButton);
boolean startWOasking = false; boolean startWOasking = false;
if (adtabPanel == null) {
return;
}
final int table_ID = adtabPanel.getGridTab().getAD_Table_ID(); final int table_ID = adtabPanel.getGridTab().getAD_Table_ID();
// Record_ID // Record_ID

View File

@ -792,7 +792,16 @@ public class CompositeADTabbox extends AbstractADTabbox
if (headerTab.getGridTab().isNew()) { if (headerTab.getGridTab().isNew()) {
tabPanel.resetDetailForNewParentRecord(); tabPanel.resetDetailForNewParentRecord();
} else { } else {
//maintain detail row position if possible
int currentRow = -1;
if (!tabPanel.getGridTab().isSortTab()) {
currentRow = tabPanel.getGridTab().getCurrentRow();
}
tabPanel.query(false, 0, 0); tabPanel.query(false, 0, 0);
if (currentRow >= 0 && currentRow != tabPanel.getGridTab().getCurrentRow()
&& currentRow < tabPanel.getGridTab().getRowCount()) {
tabPanel.getGridTab().setCurrentRow(currentRow, false);
}
} }
if (!tabPanel.isVisible()) { if (!tabPanel.isVisible()) {
tabPanel.setVisible(true); tabPanel.setVisible(true);

View File

@ -20,6 +20,7 @@ import java.util.Map.Entry;
import java.util.Properties; import java.util.Properties;
import org.adempiere.util.GridRowCtx; import org.adempiere.util.GridRowCtx;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.EditorBox; import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.component.NumberBox;
@ -118,7 +119,6 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
{ {
if (buttonListener != null) if (buttonListener != null)
{ {
((WButtonEditor)editor).removeActionListener(buttonListener);
((WButtonEditor)editor).addActionListener(buttonListener); ((WButtonEditor)editor).addActionListener(buttonListener);
} }
else else
@ -285,7 +285,11 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
entry.getKey().removePropertyChangeListener(entry.getValue()); entry.getKey().removePropertyChangeListener(entry.getValue());
entry.getValue().removeValuechangeListener(dataBinder); entry.getValue().removeValuechangeListener(dataBinder);
div.appendChild(component); if (component.getParent() == null || component.getParent() != div)
div.appendChild(component);
else if (!component.isVisible()) {
component.setVisible(true);
}
} }
} }
@ -495,9 +499,13 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex); org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex);
if (column.isVisible()) { if (column.isVisible()) {
Cell div = (Cell) currentRow.getChildren().get(colIndex); Cell div = (Cell) currentRow.getChildren().get(colIndex);
div.getChildren().clear();
WEditor editor = getEditorCell(gridPanelFields[i]); WEditor editor = getEditorCell(gridPanelFields[i]);
if (div.getChildren().isEmpty() || !(div.getChildren().get(0) instanceof Button))
div.getChildren().clear();
else if (!div.getChildren().isEmpty()) {
div.getChildren().get(0).setVisible(false);
}
div.appendChild(editor.getComponent()); div.appendChild(editor.getComponent());
WEditorPopupMenu popupMenu = editor.getPopupMenu(); WEditorPopupMenu popupMenu = editor.getPopupMenu();