use of org.w3c.dom.html.HTMLInputElement in project intellij-plugins by StepicOrg.
the class StudyBrowserWindow method loadContent.
void loadContent(@NotNull String template, @NotNull Map<String, Object> params) {
String content = getContent(template, params);
Platform.runLater(() -> {
Document document = engine.getDocument();
if (document != null) {
HTMLFormElement form = (HTMLFormElement) document.getElementById("answer_form");
if (form != null) {
HTMLInputElement action = (HTMLInputElement) form.getElements().namedItem("action");
action.setValue("save_reply");
FormListener.handle(project, this, form);
}
}
engine.loadContent(content);
});
}
use of org.w3c.dom.html.HTMLInputElement in project intellij-plugins by StepicOrg.
the class Elements method getInputValue.
@NotNull
String getInputValue(@NotNull String name) {
Node item = elements.namedItem(name);
String value = null;
if (item instanceof HTMLInputElement) {
value = ((HTMLInputElement) item).getValue();
} else if (item instanceof HTMLTextAreaElement) {
value = ((HTMLTextAreaElement) item).getValue();
}
return value != null ? value : "";
}
use of org.w3c.dom.html.HTMLInputElement in project intellij-plugins by StepicOrg.
the class StepDescriptionUtils method disableAllInputs.
private static void disableAllInputs(@NotNull Elements elements) {
for (Node node : elements) {
if (node instanceof HTMLInputElement) {
HTMLInputElement element = (HTMLInputElement) node;
element.setDisabled(true);
} else if (node instanceof HTMLTextAreaElement) {
HTMLTextAreaElement element = (HTMLTextAreaElement) node;
element.setDisabled(true);
}
}
}
use of org.w3c.dom.html.HTMLInputElement in project intellij-plugins by StepicOrg.
the class StepDescriptionUtils method forEachInputElement.
private static void forEachInputElement(@NotNull Elements elements, Consumer<HTMLInputElement> consumer) {
for (Node node : elements) {
if (node instanceof HTMLInputElement) {
HTMLInputElement element = (HTMLInputElement) node;
consumer.accept(element);
element.setDisabled(true);
}
}
}
use of org.w3c.dom.html.HTMLInputElement in project intellij-plugins by StepicOrg.
the class StepDescriptionUtils method getBlanks.
private static List<String> getBlanks(@NotNull Elements elements) {
List<String> blanks = new ArrayList<>();
for (Node node : elements) {
if (node instanceof HTMLInputElement) {
HTMLInputElement element = (HTMLInputElement) node;
String type = element.getType();
if ("text".equals(type)) {
blanks.add(element.getValue());
}
element.setDisabled(true);
} else if (node instanceof HTMLSelectElement) {
HTMLSelectElement element = (HTMLSelectElement) node;
blanks.add(element.getValue());
element.setDisabled(true);
}
}
return blanks;
}
Aggregations