IDEMPIERE-2205 - Ask for secret input from within a process (#1501)
This commit is contained in:
parent
0173bbd296
commit
8a51fb8f4a
|
@ -82,6 +82,14 @@ public interface IProcessUI {
|
|||
|
||||
public void askForInput(String message, Callback<String> callback);
|
||||
|
||||
/**
|
||||
* Prompt for user secret input.
|
||||
*
|
||||
* @param title
|
||||
* @param callback
|
||||
*/
|
||||
public void askForSecretInput(String message, Callback<String> callback);
|
||||
|
||||
/**
|
||||
* Prompt user for input with a configurable DisplayType (String, Number, TableDir or Search)
|
||||
*
|
||||
|
|
|
@ -1267,6 +1267,16 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askForSecretInput(final String message, final Callback<String> callback) {
|
||||
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Dialog.askForSecretInput(m_WindowNo, message, callback);
|
||||
}
|
||||
}, new Event("onAskForInput"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askForInput(final String message, final Callback<String> callback) {
|
||||
Executions.schedule(getDesktop(), new EventListener<Event>() {
|
||||
|
|
|
@ -674,4 +674,14 @@ public class WPaySelect extends PaySelect
|
|||
}
|
||||
}, new Event("onAskForInput"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void askForSecretInput(final String message, final Callback<String> callback) {
|
||||
Executions.schedule(form.getDesktop(), new EventListener<Event>() {
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Dialog.askForSecretInput(m_WindowNo, message, callback);
|
||||
}
|
||||
}, new Event("onAskForInput"));
|
||||
}
|
||||
} // VPaySelect
|
||||
|
|
|
@ -27,6 +27,14 @@ import org.compiere.model.GridField;
|
|||
*/
|
||||
public class WPasswordEditor extends WStringEditor
|
||||
{
|
||||
|
||||
public WPasswordEditor()
|
||||
{
|
||||
super();
|
||||
super.setTypePassword(true);
|
||||
setChangeEventWhenEditing(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gridField
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.adempiere.webui.editor.WChosenboxListEditor;
|
|||
import org.adempiere.webui.editor.WChosenboxSearchEditor;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WNumberEditor;
|
||||
import org.adempiere.webui.editor.WPasswordEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
|
@ -406,6 +407,25 @@ public final class Dialog {
|
|||
Messagebox.OK | Messagebox.INPUT, Messagebox.QUESTION, msgCallback, (msgCallback == null));
|
||||
}
|
||||
|
||||
public static void askForSecretInput(int windowNo, String adMessage, final Callback<String> callback) {
|
||||
Callback<String> msgCallback = null;
|
||||
if (callback != null)
|
||||
{
|
||||
msgCallback = new Callback<String>() {
|
||||
@Override
|
||||
public void onCallback(String result) {
|
||||
callback.onCallback(result);
|
||||
}
|
||||
};
|
||||
}
|
||||
String dialogTitle = getDialogTitle("", windowNo);
|
||||
String message = constructMessage(adMessage, null);
|
||||
message = formatDialogMessage(message);
|
||||
|
||||
Messagebox.showDialog(message, dialogTitle,
|
||||
Messagebox.OK | Messagebox.INPUT, Messagebox.QUESTION, new WPasswordEditor(), msgCallback, (msgCallback == null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirmation dialog before deleting the records.
|
||||
* @param windowNo
|
||||
|
|
Loading…
Reference in New Issue