IDEMPIERE-2205 - Ask for secret input from within a process (#1501)
This commit is contained in:
parent
0173bbd296
commit
8a51fb8f4a
|
@ -81,6 +81,14 @@ public interface IProcessUI {
|
||||||
public void ask(String message, Callback<Boolean> callback);
|
public void ask(String message, Callback<Boolean> callback);
|
||||||
|
|
||||||
public void askForInput(String message, Callback<String> callback);
|
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)
|
* Prompt user for input with a configurable DisplayType (String, Number, TableDir or Search)
|
||||||
|
|
|
@ -1266,6 +1266,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
|
@Override
|
||||||
public void askForInput(final String message, final Callback<String> callback) {
|
public void askForInput(final String message, final Callback<String> callback) {
|
||||||
|
|
|
@ -674,4 +674,14 @@ public class WPaySelect extends PaySelect
|
||||||
}
|
}
|
||||||
}, new Event("onAskForInput"));
|
}, 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
|
} // VPaySelect
|
||||||
|
|
|
@ -27,6 +27,14 @@ import org.compiere.model.GridField;
|
||||||
*/
|
*/
|
||||||
public class WPasswordEditor extends WStringEditor
|
public class WPasswordEditor extends WStringEditor
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public WPasswordEditor()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
super.setTypePassword(true);
|
||||||
|
setChangeEventWhenEditing(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param gridField
|
* @param gridField
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.adempiere.webui.editor.WChosenboxListEditor;
|
||||||
import org.adempiere.webui.editor.WChosenboxSearchEditor;
|
import org.adempiere.webui.editor.WChosenboxSearchEditor;
|
||||||
import org.adempiere.webui.editor.WEditor;
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.adempiere.webui.editor.WNumberEditor;
|
import org.adempiere.webui.editor.WNumberEditor;
|
||||||
|
import org.adempiere.webui.editor.WPasswordEditor;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.editor.WStringEditor;
|
import org.adempiere.webui.editor.WStringEditor;
|
||||||
import org.adempiere.webui.editor.WTableDirEditor;
|
import org.adempiere.webui.editor.WTableDirEditor;
|
||||||
|
@ -405,6 +406,25 @@ public final class Dialog {
|
||||||
Messagebox.showDialog(message, dialogTitle,
|
Messagebox.showDialog(message, dialogTitle,
|
||||||
Messagebox.OK | Messagebox.INPUT, Messagebox.QUESTION, msgCallback, (msgCallback == null));
|
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.
|
* Confirmation dialog before deleting the records.
|
||||||
|
|
Loading…
Reference in New Issue