当前位置: 首页>>代码示例>>Java>>正文


Java InputProps类代码示例

本文整理汇总了Java中gwt.react.client.proptypes.html.InputProps的典型用法代码示例。如果您正苦于以下问题:Java InputProps类的具体用法?Java InputProps怎么用?Java InputProps使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InputProps类属于gwt.react.client.proptypes.html包,在下文中一共展示了InputProps类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: render

import gwt.react.client.proptypes.html.InputProps; //导入依赖的package包/类
@Override
protected ReactElement<?, ?> render() {
	Array<String> testLiItems = JsArray.create("Item1", "Item2", "Item3");

	return
		div(null,
			label(new LabelProps()
					.HtmlFor("checkField"),
					"Click me "
			),
			input(new InputProps()
					.id("checkField")
					.type(InputType.checkbox)
					.checked(state.checked)
					.onClick(this::onClicked)
			),
			//The following doesn't work with Preact 7.2.0 without a patch (included in gwt-react), due to iFrame JS loading issues
			ul(null,
					castAsReactElement(testLiItems.map(i -> li(null, i)))
			)
	);
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:23,代码来源:StatefulExample2.java

示例2: render

import gwt.react.client.proptypes.html.InputProps; //导入依赖的package包/类
public ReactElement<?, ?> render() {
    return
        li(new HtmlProps()
                .className(Classnames.get("completed", props.todo.completed, "editing", props.isEditing)),
            div(new HtmlProps().className("view"),
                input(new InputProps()
                        .className("toggle")
                        .type(InputType.checkbox).checked(props.todo.completed)
                        .onChange((event) -> props.doAction.accept(TodoList.Action.TOGGLE, props.todo))),
                label(new LabelProps()
                        .OnDoubleClick(this::handleEdit), props.todo.title),
                button(new BtnProps()
                        .className("destroy")
                        .onClick((event) -> props.doAction.accept(TodoList.Action.DESTROY, props.todo)))
            ),
            input(new InputProps()
                    .ref("editField")
                    .className("edit")
                    .defaultValue(state.editText)
                    .onBlur(this::submitTodo)
                    .onChange(this::handleChange)
                    .onKeyDown(this::handleKeyDown))
        );
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:25,代码来源:TodoItem.java

示例3: render

import gwt.react.client.proptypes.html.InputProps; //导入依赖的package包/类
public ReactElement<?, ?> render() {
    return
        div(null,
            button(new BtnProps()
                .title("Some title")
                .onClick((e) -> setState(State.make("Updated Value"))),
                getDescription()),

            input(new InputProps()
                .placeHolder("What needs to be done?")
                .value(state.aStateVar)
                .onChange(this::doChange))
        );
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:15,代码来源:StatefulExample.java

示例4: render

import gwt.react.client.proptypes.html.InputProps; //导入依赖的package包/类
public ReactElement<?, ?> render() {
    ReactElement<?, ?> footer = null;
    ReactElement<?, ?> main = null;
    Array<TodoModel.Todo> todos = App.model.todos;
    String nowShowing = props.getRouterParams().nowShowing;

    Array<TodoModel.Todo> shownTodos = todos.filter((todo, index, theArray) -> {
        if (nowShowing == null) {
            return true;
        }else if (nowShowing.equals(NOW_SHOWING_ACTIVE_TODOS)){
            return !todo.completed;
        }else {
            return todo.completed;
        }
    });

    Array<ReactElement<?, ?>> todoItems = shownTodos.map((todo, index, theArray) -> {
        TodoItem.TodoItemProps todoProps = new TodoItem.TodoItemProps();

        todoProps.key = todo.id;
        todoProps.todo = todo;
        todoProps.doAction = this::handleDoAction;
        todoProps.doSave = this::handleSave;
        todoProps.isEditing = Objects.equals(state.editingId, todo.id);

        return React.createElement(TodoItem.class, todoProps);
    });

    Integer activeTodoCount = todos.reduce((accum, currentValue, index, theArray) ->
            currentValue.completed ? accum : accum + 1, 0);

    int completedCount = todos.getLength() - activeTodoCount;

    if (activeTodoCount > 0 || completedCount > 0) {
        Footer.FooterProps footerProps = new Footer.FooterProps();
        footerProps.count = activeTodoCount;
        footerProps.completedCount = completedCount;
        footerProps.nowShowing = props.getRouterParams().nowShowing;
        footerProps.onClearCompleted = this::handleClearCompleted;

        footer = React.createElement(Footer.component, footerProps);
    }

    if (todos.getLength() > 0) {
        main = section(new HtmlProps()
                        .className("header"),
                    input(new InputProps()
                            .className("toggle-all")
                            .type(InputType.checkbox)
                            .onChange(this::handleToggleAll)),
                    ul(new HtmlProps()
                            .className("todo-list"),
                        castAsReactElement(todoItems)
                    )
                );
    }

    return
        div(null,
            header(new HtmlProps()
                            .className("header"),
                    h1(null, "todos"),
                    input(new InputProps()
                            .className("new-todo")
                            .placeHolder("What needs to be done?")
                            .value(state.newTodo)
                            .onKeyDown(this::handleNewTodoKeyDown)
                            .onChange(this::handleChange)
                            .autoFocus(true))
            ),
            main,
            footer
        );
}
 
开发者ID:GWTReact,项目名称:gwt-react-examples,代码行数:75,代码来源:TodoList.java


注:本文中的gwt.react.client.proptypes.html.InputProps类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。