org.w3c.dom.html.HTMLInputElement Java Examples

The following examples show how to use org.w3c.dom.html.HTMLInputElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void changed(ObservableValue<? extends Document> observableValue, Document oldDoc, Document newDoc)
{
    if (newDoc == null)
    {
        return;
    }
    NodeList elements = newDoc.getElementsByTagName("input");
    for (int i = 0; i < elements.getLength(); i++)
    {
        HTMLInputElementImpl element = (HTMLInputElementImpl) elements.item(i);
        String key = getInputKey(element);
        if (key == null || key.isEmpty())
        {
            continue;
        }
        setInputValue(element, character.getPreviewSheetVar(key));
        element.addEventListener("change", evt ->
        {
            HTMLInputElement input = (HTMLInputElement) evt.getCurrentTarget();
            character.addPreviewSheetVar(getInputKey(input), getInputValue(input));
        }, false);
    }
}
 
Example #2
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void changed(ObservableValue<? extends Document> observableValue, Document oldDoc, Document newDoc)
{
    if (newDoc == null)
    {
        return;
    }
    NodeList elements = newDoc.getElementsByTagName("input");
    for (int i = 0; i < elements.getLength(); i++)
    {
        HTMLInputElementImpl element = (HTMLInputElementImpl) elements.item(i);
        String key = getInputKey(element);
        if (key == null || key.isEmpty())
        {
            continue;
        }
        setInputValue(element, character.getPreviewSheetVar(key));
        element.addEventListener("change", evt ->
        {
            HTMLInputElement input = (HTMLInputElement) evt.getCurrentTarget();
            character.addPreviewSheetVar(getInputKey(input), getInputValue(input));
        }, false);
    }
}
 
Example #3
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String getInputValue(HTMLInputElement input)
{
    if (isCheckable(input))
    {
        return Boolean.toString(input.getChecked());
    } else
    {
        return input.getValue();
    }
}
 
Example #4
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setInputValue(HTMLInputElement input, String previewSheetVar)
{
    if (isCheckable(input))
    {
        input.setChecked(Boolean.parseBoolean(previewSheetVar));
    } else
    {
        input.setValue(previewSheetVar);
    }
}
 
Example #5
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private String getInputValue(HTMLInputElement input)
{
    if (isCheckable(input))
    {
        return Boolean.toString(input.getChecked());
    } else
    {
        return input.getValue();
    }
}
 
Example #6
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void setInputValue(HTMLInputElement input, String previewSheetVar)
{
    if (isCheckable(input))
    {
        input.setChecked(Boolean.parseBoolean(previewSheetVar));
    } else
    {
        input.setValue(previewSheetVar);
    }
}
 
Example #7
Source File: DetectForm.java    From JFX-Browser with MIT License 4 votes vote down vote up
public UserCredentials(HTMLInputElement username, HTMLInputElement password){
	this.username = username;
	this.password = password;
}
 
Example #8
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isCheckable(HTMLInputElement input)
{
    String type = input.getAttribute("type").toLowerCase();
    return "checkbox".equals(type) || "radio".equals(type);
}
 
Example #9
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private String getInputKey(HTMLInputElement input)
{
    return input.getAttribute("target_var");
}
 
Example #10
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private boolean isCheckable(HTMLInputElement input)
{
    String type = input.getAttribute("type").toLowerCase();
    return "checkbox".equals(type) || "radio".equals(type);
}
 
Example #11
Source File: PreviewVariablesHandler.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private String getInputKey(HTMLInputElement input)
{
    return input.getAttribute("target_var");
}