本文整理汇总了Java中com.google.gwt.user.client.ui.Focusable类的典型用法代码示例。如果您正苦于以下问题:Java Focusable类的具体用法?Java Focusable怎么用?Java Focusable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Focusable类属于com.google.gwt.user.client.ui包,在下文中一共展示了Focusable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
private boolean focus(int row, int col) {
if (!getRowFormatter().isVisible(row) || col >= getCellCount(row)) return false;
Widget w = super.getWidget(row, col);
if (w == null || !w.isVisible()) return false;
if (w instanceof SmartTableCell) {
return ((SmartTableCell)w).focus();
} else if (w instanceof HasFocus) {
return ((HasFocus)w).focus();
} else if (w instanceof Focusable) {
((Focusable)w).setFocus(true);
if (w instanceof TextBoxBase)
((TextBoxBase)w).selectAll();
return true;
}
return false;
}
示例2: activateWidget
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
@Override
public void activateWidget(WidgetToShow widgetToActivate) {
final Tab tab = widgets2Tabs.get(widgetToActivate);
if (tab != null) {
selectTab(tab);
}
IsWidget widget = widgetToActivate.getWidget();
widgetsPanel.showWidget(widget.asWidget());
if (widget instanceof Focusable) {
((Focusable) widget).setFocus(true);
}
// add 'active' attribute for active widget for testing purpose
for (WidgetToShow widgetToShow : widgets2Tabs.keySet()) {
widgetToShow.getWidget().asWidget().getElement().removeAttribute("active");
}
widget.asWidget().getElement().setAttribute("active", "");
}
示例3: ready
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
private void ready () {
btnUpdate.getElement().setInnerSafeHtml(
WizardDialog.WizardDialogTemplates.INSTANCE
.nextButton("Update"));
// enable properties
btnUpdate.setEnabled(true);
if (propertyWidgets != null) {
for (Widget widget : propertyWidgets) {
if (widget instanceof Focusable) {
((Focusable) widget).setFocus(true);
break;
}
}
}
}
示例4: setFocus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
protected boolean setFocus(final HasWidgets container,
Boolean found) {
for (final Widget w : container) {
if (w instanceof CloseButton) {
continue;
} else if (w instanceof Focusable) {
((Focusable) w).setFocus(true);
found = true;
} else if (w instanceof HasWidgets) {
found = setFocus(((HasWidgets) w),
found);
}
if (Boolean.TRUE.equals(found)) {
break;
}
}
return found;
}
示例5: setEditor
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
public void setEditor(Widget aEditor) {
editor = aEditor;
if (editor == null || ((editor instanceof HasValue<?>) && (editor instanceof HasText))) {
valueHost = (HasValue<C>) editor;
} else {
throw new IllegalArgumentException("Editor must implement interfaces HasValue<?> and HasText");
}
if (editor instanceof Focusable) {
focusHost = (Focusable) editor;
focusHost.setTabIndex(1);
}
if (editor != null){
CommonResources.INSTANCE.commons().ensureInjected();
editor.getElement().addClassName(CommonResources.INSTANCE.commons().borderSized());
}
}
示例6: AutoSizingBase
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
public AutoSizingBase(T box, S shadow) {
this.box = box;
this.shadow = shadow;
box.addKeyDownHandler(this);
box.addKeyUpHandler(this);
box.addValueChangeHandler(this);
div.setStyleName("gwt-traction-input-autosize");
shadow.setStyleName("gwt-traction-input-shadow");
// make sure the shadow isn't in the tab order
if (shadow instanceof Focusable) {
// we can't use -1 because FocusWidget.onAttach looks for
// that and sets it to 0. any negative value will remove
// it from the tab order.
((Focusable) shadow).setTabIndex(-2);
}
// note this has to be in a FlowPanel to work
div.add(box);
div.add(shadow);
initWidget(div);
}
示例7: setEditor
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
public void setEditor( T editor, boolean fShowCancel )
{
m_table.clear();
m_editor = editor;
if( m_editor != null )
{
m_table.setWidget( 0, 0, m_editor );
if( m_editor instanceof HasKeyUpHandlers )
((HasKeyUpHandlers) m_editor).addKeyUpHandler( this );
if( m_editor instanceof Focusable )
((Focusable) m_editor).setFocus( true );
}
m_table.setWidget( 0, 1, m_okBut );
if( fShowCancel )
m_table.setWidget( 0, 2, m_cancelBut );
}
示例8: requestFocus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
private static void requestFocus(final Focusable widget) {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
@Override
public void execute() {
widget.setFocus(true);
}
});
}
示例9: setFocus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
private void setFocus( final Widget w ){
if( w instanceof Focusable ) {
Scheduler.get().scheduleDeferred( new ScheduledCommand(){
public void execute(){
((Focusable) w).setFocus(true);
}
});
} else {
Window.alert("Trying to set focus to an unfocusable Widget!");
}
}
示例10: show
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
/**
* Displays the {@link Window} popup. The popup will animate into view.
*
* @param selectAndFocusElement an {@link Focusable} to select and focus on when the panel is
* shown. If null, no element will be given focus
*/
public void show(@Nullable final Focusable selectAndFocusElement) {
setBlocked(false);
if (isShowing) {
setFocusOn(
selectAndFocusElement); // the window is displayed but focus for the element may be lost
return;
}
isShowing = true;
// Attach the popup to the body.
final JsElement popup = view.popup.getElement().cast();
if (popup.getParentElement() == null) {
// Hide the popup so it can enter its initial state without flickering.
popup.getStyle().setVisibility("hidden");
RootLayoutPanel.get().add(view);
}
// The popup may have been hidden before this timer executes.
if (isShowing) {
popup.getStyle().removeProperty("visibility");
// Start the animation after the element is attached.
Scheduler.get()
.scheduleDeferred(
new ScheduledCommand() {
@Override
public void execute() {
// The popup may have been hidden before this timer executes.
view.setShowing(true);
setFocusOn(selectAndFocusElement);
}
});
}
}
示例11: focus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
public boolean focus() {
Widget w = getWidget();
if (w instanceof UniTimeWidget<?>)
w = ((UniTimeWidget<?>)w).getWidget();
if (w instanceof Focusable) {
((Focusable)w).setFocus(true);
if (w instanceof TextBox)
((TextBox)w).selectAll();
return true;
}
return false;
}
示例12: getTabIndex
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
@Override
public int getTabIndex() {
if (decorated instanceof Focusable) {
return ((Focusable) decorated).getTabIndex();
} else
return -1;
}
示例13: focus
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
private void focus(FocusGVO focusGVO, UIObject sender, String appId, String windowId, String eventSessionId) {
String componentId = focusGVO.getComponentId();
List<UIObject> uiObjects = getUIObjects(componentId, appId, windowId, eventSessionId);
if (uiObjects == null) {
return;
}
for (UIObject uiObject : uiObjects) {
if (uiObject instanceof Widget) {
makeParentVisible((Widget) uiObject);
}
if (uiObject instanceof Focusable) {
((Focusable) uiObject).setFocus(true);
}
}
}
示例14: execute
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
public void execute(BuiltInFunctionGVO builtInFunction) {
if (builtInFunction instanceof FocusGVO) {
FocusGVO focus = (FocusGVO) builtInFunction;
BuiltInComponentGVO builtInComponentGVO = focus.getBuiltInComponentGVO();
String component = builtInComponentGVO.getComponentIdUUID();
List<UIObject> uiObjects = null;
if (component != null) {
uiObjects = getUIObjects(component, focus);
} else {
uiObjects = RendererHelper.getNamedComponent(builtInComponentGVO.getComponentName());
}
if (uiObjects != null) {
for (UIObject uiObject : uiObjects) {
if (uiObject instanceof Widget) {
Widget w = (Widget) uiObject;
makeParentsVisible(w);
// TO BE REMOVED
// if (w.getParent() != null) {
// Widget parent = w.getParent();
// makeParentsVisible(parent);
// }
}
if (uiObject instanceof Focusable) {
((Focusable) uiObject).setFocus(true);
}
}
}
}
FunctionsExecutor.setProcessedBuiltIn(true);
}
示例15: getTabIndex
import com.google.gwt.user.client.ui.Focusable; //导入依赖的package包/类
@Override
public final int getTabIndex() {
if (this.contents.getWidget() instanceof Focusable) {
return ((Focusable) this.contents.getWidget()).getTabIndex();
}
return 0;
}