IDEMPIERE-3454:add method to traverse throw editor collection of tab

This commit is contained in:
hieplq 2017-08-13 18:52:40 +07:00
parent 19aea1d6a2
commit 2fec8919bc
3 changed files with 35 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import org.adempiere.base.Core;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.Callback;
import org.adempiere.webui.AdempiereIdGenerator;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.ClientInfo;
@ -1786,4 +1787,10 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
super.onPageDetached(page);
}
@Override
public void editorTraverse(Callback<WEditor> editorTaverseCallback) {
editorTraverse(editorTaverseCallback, editors);
}
}

View File

@ -24,6 +24,7 @@ import javax.swing.table.AbstractTableModel;
import org.adempiere.base.Core;
import org.adempiere.model.MTabCustomization;
import org.adempiere.util.Callback;
import org.adempiere.util.GridRowCtx;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Checkbox;
@ -1189,4 +1190,10 @@ public class GridView extends Vbox implements EventListener<Event>, IdSpace, IFi
paging.setDetailed(true);
}
}
@Override
public void editorTraverse(Callback<WEditor> editorTaverseCallback) {
editorTraverse(editorTaverseCallback, renderer.getEditors());
}
}

View File

@ -13,6 +13,9 @@
*****************************************************************************/
package org.adempiere.webui.adwindow;
import java.util.Collection;
import org.adempiere.util.Callback;
import org.adempiere.webui.editor.WEditor;
/**
@ -31,4 +34,22 @@ public interface IFieldEditorContainer {
* @param ref
*/
public void focusToNextEditor(WEditor ref);
/**
* helper method to loop thru editor collection of panel <br/>
* can use on callout to check relative editor
* @param editorTaverseCallback
*/
public void editorTraverse (Callback<WEditor> editorTaverseCallback);
/**
* default implement for {@link #editorTraverse(Callback)}
* @param editorTaverseCallback
* @param editors
*/
default void editorTraverse (Callback<WEditor> editorTaverseCallback, Collection<WEditor> editors) {
for (WEditor editor : editors) {
editorTaverseCallback.onCallback(editor);
}
}
}