IDEMPIERE-5219 Sales Order Window: initial focus not on header tab's field (#1222)

This commit is contained in:
hengsin 2022-03-03 23:30:35 +08:00 committed by GitHub
parent 7cabc12ebd
commit e3555e5fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 4 deletions

View File

@ -1416,7 +1416,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
} else {
if (activate) {
formContainer.setVisible(activate);
if (!isMobile())
if (!isMobile() && !isDetailPaneMode())
focusToFirstEditor();
}
}
@ -2331,4 +2331,9 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
}
public AbstractADWindowContent getADWindowContent()
{
return windowPanel;
}
}

View File

@ -1170,12 +1170,31 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/**
* restore focus to last known focus editor (if any)
* @return true if there's last focus editor
*/
public void focusToLastFocusEditor() {
public boolean focusToLastFocusEditor() {
return focusToLastFocusEditor(false);
}
/**
* restore focus to last known focus editor (if any)
* @param defer true to schedule for later/defer execution
* @return true if there's last focus editor
*/
public boolean focusToLastFocusEditor(boolean defer) {
if (lastFocusEditor != null && lastFocusEditor instanceof HtmlBasedComponent &&
lastFocusEditor.getPage() != null && LayoutUtils.isReallyVisible(lastFocusEditor))
lastFocusEditor.getPage() != null && LayoutUtils.isReallyVisible(lastFocusEditor)) {
if (defer) {
final HtmlBasedComponent editor = (HtmlBasedComponent) lastFocusEditor;
Executions.schedule(getComponent().getDesktop(), e -> editor.focus(), new Event("onScheduleFocusToLastFocusEditor"));
} else {
((HtmlBasedComponent)lastFocusEditor).focus();
}
return true;
} else {
return false;
}
}
/**
* Invoke when quick form is click

View File

@ -388,6 +388,10 @@ public class CompositeADTabbox extends AbstractADTabbox
if (tabPanel != headerTab && headerTab.getDetailPane() != null) {
if (b != null && b.booleanValue()) {
onActivateDetail(tabPanel);
if (headerTab instanceof ADTabpanel) {
if (!((ADTabpanel) headerTab).getADWindowContent().focusToLastFocusEditor(true))
((ADTabpanel) headerTab).getADWindowContent().focusToActivePanel();
}
}
}
}

View File

@ -189,4 +189,9 @@ public class ComboEditorBox extends Div {
}
}
@Override
public void focus() {
txt.focus();
}
}

View File

@ -162,4 +162,9 @@ public class EditorBox extends Div {
}
}
@Override
public void focus() {
txt.focus();
}
}

View File

@ -170,4 +170,9 @@ public class Urlbox extends Div
}
}
@Override
public void focus() {
txt.focus();
}
}