Java Code Examples for org.apache.wicket.ajax.AjaxRequestTarget#focusComponent()

The following examples show how to use org.apache.wicket.ajax.AjaxRequestTarget#focusComponent() . 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: SelectDialogPanel.java    From Orienteer with Apache License 2.0 6 votes vote down vote up
private Command<ODocument> createSelectAndSearchCommand(OrienteerDataTable<ODocument, String> table, OClassSearchPanel searchPanel) {
	return new AbstractCheckBoxEnabledCommand<ODocument>(new ResourceModel("command.selectAndSearchMode"), table) {
		@Override
		protected void onInitialize() {
			super.onInitialize();
			setBootstrapType(BootstrapType.SUCCESS);
			setIcon(FAIconType.hand_o_right);
			setAutoNotify(false);
		}

		@Override
		protected void performMultiAction(AjaxRequestTarget target, List<ODocument> objects) {
			if (onSelect(target, objects, true)) {
				TextField<String> field = searchPanel.getQueryField();
				resetSelection();
				target.add(getTable());
				target.focusComponent(field);
				target.appendJavaScript(String.format("$('#%s').select()", field.getMarkupId()));
			}
		}
	};
}
 
Example 2
Source File: StatementEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
protected void actionEdit(AjaxRequestTarget aTarget) {
    // Edit mode works on a model of a shallow copy of the original statement. Any floating
    // changes to the statement are either persisted by saving or undone by canceling. In
    // conjunction with onchange AjaxFormComponentUpdatingBehaviours, this makes sure that
    // floating changes are persisted in the UI, meaning other statements can be added or
    // deleted while changes to this statement in the UI are not being reset.
    KBStatement shallowCopy = new KBStatement(statement.getObject());
    IModel<KBStatement> shallowCopyModel = Model.of(shallowCopy);

    EditMode editMode = new EditMode(CONTENT_MARKUP_ID, shallowCopyModel, false);
    content = content.replaceWith(editMode);
    aTarget.focusComponent(editMode.getFocusComponent());
    aTarget.add(this);
}
 
Example 3
Source File: QualifierEditor.java    From inception with Apache License 2.0 5 votes vote down vote up
private void actionEdit(AjaxRequestTarget aTarget) {
    KBQualifier shallowCopy = new KBQualifier(qualifier.getObject());
    IModel<KBQualifier> shallowCopyModel = Model.of(shallowCopy);

    EditMode editMode = new EditMode(CONTENT_MARKUP_ID, shallowCopyModel, false);
    content = content.replaceWith(editMode);
    aTarget.focusComponent(editMode.getFocusComponent());
    aTarget.add(this);
}
 
Example 4
Source File: RevisionSelector.java    From onedev with MIT License 5 votes vote down vote up
private void onSelectTab(AjaxRequestTarget target) {
	refs = findRefs();
	revField.setModel(Model.of(""));
	revInput = null;
	target.add(revField);
	newItemsView(target);
	String script = String.format("onedev.server.revisionSelector.bindInputKeys('%s');", getMarkupId(true));
	target.appendJavaScript(script);
	target.focusComponent(revField);
}
 
Example 5
Source File: FeatureEditorListPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
/**
 * Part of <i>forward annotation</i> mode: move focus to the hidden forward annotation input
 * field or to the free text component at the end of the rendering process
 * 
 * @param aResetSelectedTag
 *            whether to clear {@code selectedTag} if the forward features has a tagset. Has
 *            no effect if the forward feature is a free text feature.
 */
public void focusForwardAnnotationComponent(AjaxRequestTarget aTarget,
        boolean aResetSelectedTag)
{
    AnnotatorState state = getModelObject();
    if (!state.isForwardAnnotation()) {
        return;
    }
    
    List<AnnotationFeature> features = getEnabledAndVisibleFeatures(
            getModelObject().getDefaultAnnotationLayer());
    if (features.size() != 1) {
        // should not come here in the first place (controlled during
        // forward annotation process)
        return;
    }
    
    AnnotationFeature feature = features.get(0);
    
    // Check if this is a free text annotation or a tagset is attached. Use the hidden
    // forwardAnnotationText element only for tagset based forward annotations
    if (feature.getTagset() == null) {
        getFirstFeatureEditor()
                .ifPresent(_editor -> autoFocus(aTarget, _editor.getFocusComponent()));
    }
    else {
        AnnotationDetailEditorPanel editorPanel = findParent(AnnotationDetailEditorPanel.class);
        aTarget.focusComponent(editorPanel.getForwardAnnotationTextField());
        if (aResetSelectedTag) {
            editorPanel.setForwardAnnotationKeySequence("", "resetting on forward");
        }
    }
}
 
Example 6
Source File: FeatureEditorListPanel.java    From webanno with Apache License 2.0 5 votes vote down vote up
public void autoFocus(AjaxRequestTarget aTarget, Component aComponent)
{
    // Check if any of the features suppresses auto-focus...
    for (FeatureState fstate : getModelObject().getFeatureStates()) {
        AnnotationFeature feature = fstate.getFeature();
        FeatureSupport<?> fs = featureSupportRegistry.getFeatureSupport(feature);
        if (fs.suppressAutoFocus(feature)) {
            return;
        }
    }
    
    aTarget.focusComponent(aComponent);
}
 
Example 7
Source File: TaskButton.java    From onedev with MIT License 4 votes vote down vote up
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
	super.onSubmit(target, form);
	target.focusComponent(null);
	submitTask(target);
}
 
Example 8
Source File: EmbeddedCollectionFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    target.focusComponent(fieldFilter);
}
 
Example 9
Source File: LinkEqualsFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    if (classFormComponent.isEnabled()) {
        target.focusComponent(classFormComponent);
    } else target.focusComponent(docFormComponent);
}
 
Example 10
Source File: CollectionInputPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
public void focus(AjaxRequestTarget target) {
    target.focusComponent(inputComponent);
}
 
Example 11
Source File: EqualsFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    target.focusComponent(formComponent);
}
 
Example 12
Source File: CollectionLinkFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    if (classesFormComponent.isEnabled()) {
        target.focusComponent(classesFormComponent);
    } else target.focusComponent(docsFormComponent);
}
 
Example 13
Source File: RangeFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    target.focusComponent(startComponent);
}
 
Example 14
Source File: ClassInCollectionFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    target.focusComponent(formComponent);
}
 
Example 15
Source File: InstanceOfClassFilterPanel.java    From Orienteer with Apache License 2.0 4 votes vote down vote up
@Override
public void focus(AjaxRequestTarget target) {
    target.focusComponent(formComponent);
}