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


Java FocusWidget类代码示例

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


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

示例1: getFocusableChildren

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
/**
 * Lookup all nested children in widget and tries to search children which implement Focusable
 * interface.
 *
 * @param widget widget to lookup
 * @return list of {@link com.google.gwt.user.client.ui.Focusable} widgets or empty list if none
 *     was found
 * @see com.google.gwt.user.client.ui.Focusable
 */
public static List<FocusWidget> getFocusableChildren(Widget widget) {
  List<FocusWidget> focusable = new ArrayList<>();

  if (widget instanceof FocusWidget) {
    focusable.add((FocusWidget) widget);
  }

  if (widget instanceof HasWidgets) {
    for (Widget w : ((HasWidgets) widget)) {
      focusable.addAll(getFocusableChildren(w));
    }
  }

  return focusable;
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:UIUtil.java

示例2: MenuButton

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public MenuButton(SafeHtml content, ItemsProvider itemsProvider) {
  super();

  this.itemsProvider = itemsProvider;

  addStyleName(RESOURCES.css().menuButton());

  showMenuTimer =
      new Timer() {
        @Override
        public void run() {
          showMenu();
        }
      };

  final FocusWidget mainButton = new MainButton(content);
  final FocusWidget dropButton = new DropButton();

  add(mainButton);
  add(dropButton);

  attachMouseEventHandlers(mainButton);
  attachMouseEventHandlers(dropButton);
}
 
开发者ID:eclipse,项目名称:che,代码行数:25,代码来源:MenuButton.java

示例3: getFocusWidget

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public FocusWidget getFocusWidget() {
    return _rbs.get(0);
}
 
开发者ID:lsst,项目名称:firefly,代码行数:4,代码来源:RadioGroupInputField.java

示例4: addToolButton

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public Widget addToolButton(final GeneralCommand cmd, boolean alignRight) {
    final FocusWidget btn = new Button(cmd.getLabel());
    updateHighlighted(btn, cmd);
    btn.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent ev) {
            cmd.execute();
        }
    });

    cmd.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent pce) {
            if (pce.getPropertyName().equals(GeneralCommand.PROP_TITLE)) {
                if (btn instanceof HasText) {
                    ((HasText) btn).setText(String.valueOf(pce.getNewValue()));
                }
            } else if (pce.getPropertyName().equals(GeneralCommand.PROP_HIGHLIGHT)) {
                updateHighlighted(btn, cmd);
            }
        }
    });
    if (!StringUtils.isEmpty(cmd.getShortDesc())) {
        btn.setTitle(cmd.getShortDesc());
    }
    addToolButton(btn, alignRight);
    return btn;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:27,代码来源:TablePanel.java

示例5: setValueOfInputBox

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
private void setValueOfInputBox(FocusWidget inputBox, String value) {
	if(inputBox instanceof TextBox) {
		((TextBox) inputBox).setText(value);
	}
	else if(inputBox instanceof ListBox) {
		ListBox listBox = ((ListBox) inputBox);
		boolean done = false;
		for(int i=0 ; i < listBox.getItemCount() || done ; i++) {
			if(listBox.getValue(i).equals(value)) {
				listBox.setSelectedIndex(i);
				done = true;
			}
		}
		if(!done) {
			listBox.addItem(value);
			listBox.setSelectedIndex(listBox.getItemCount()-1);
		}
	}
}
 
开发者ID:fhcampuswien,项目名称:atom,代码行数:20,代码来源:InputDialogBox.java

示例6: prompt

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public static MessageBox prompt(String caption, String message, boolean asHTML, 
                                Widget widget, int buttons, MessageBoxListener listener) {
  final MessageBox mb = new MessageBox();
  mb.setText(caption);
  mb.setButtons(buttons, listener);
  mb._dockPanel.add(asHTML ? new HTML(message) : new Label(message), DockPanel.NORTH);
  mb._dockPanel.add(widget, DockPanel.CENTER);
  mb.center();
  if(widget instanceof FocusWidget) ((FocusWidget)widget).setFocus(true);
  return mb;
}
 
开发者ID:sanderberents,项目名称:gwtlib,代码行数:12,代码来源:MessageBox.java

示例7: setContentWidget

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
/**
 * Sets content widget.
 *
 * @param widget content widget
 */
public final void setContentWidget(Widget widget) {
  container.add(widget);
  for (FocusWidget focusWidget : UIUtil.getFocusableChildren(widget)) {
    focusWidget.addBlurHandler(blurHandler);
  }

  focusView();
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:BaseView.java

示例8: attachMouseEventHandlers

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
private void attachMouseEventHandlers(FocusWidget widget) {
  widget.addMouseOutHandler(event -> showMenuTimer.cancel());
  widget.addMouseUpHandler(event -> showMenuTimer.cancel());
  widget.addMouseDownHandler(
      event -> {
        if (event.getNativeButton() == BUTTON_LEFT) {
          showMenuTimer.schedule(1000);
        } else {
          showMenuTimer.cancel();
        }
      });
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:MenuButton.java

示例9: setShowing

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
/**
 * Updates the View to reflect the showing state of the popup.
 *
 * @param showing true if showing, false if not.
 */
protected void setShowing(boolean showing) {
  // set for each focusable widget blur handler to have ability to store last focused element
  for (FocusWidget focusWidget : UIUtil.getFocusableChildren(content)) {
    focusWidget.addBlurHandler(blurHandler);
  }

  if (showing) {
    contentContainer.addStyleName(css.contentVisible());
  } else {
    contentContainer.removeStyleName(css.contentVisible());
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:View.java

示例10: setFocusOnChildOf

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
/**
 * Sets focus on the first focusable child if such exists.
 *
 * @return <code>true</code> if the focus was set
 */
private boolean setFocusOnChildOf(Widget widget) {
  List<FocusWidget> focusableChildren = UIUtil.getFocusableChildren(widget);
  for (FocusWidget focusableWidget : focusableChildren) {
    if (focusableWidget.isVisible()) {
      focusableWidget.setFocus(true);
      return true;
    }
  }
  return false;
}
 
开发者ID:eclipse,项目名称:che,代码行数:16,代码来源:View.java

示例11: setFocus

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public void setFocus(final String id) {
    DeferredCommand.addCommand(new Command(){
        public void execute() {
            InputField f = getField(id);
            if (f != null) {
                FocusWidget fw = f.getFocusWidget();
                if (fw != null) {
                    fw.setFocus(true);
                }
            }
        }
    });
}
 
开发者ID:lsst,项目名称:firefly,代码行数:14,代码来源:Form.java

示例12: handleEvent

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
protected void handleEvent(WebEvent ev) {
    List<String> sources = getQuerySources();

    if (sources == null || sources.size() == 0) return;

    if (addedMap == null) {
        addedMap = new HashMap<String, Boolean>(sources.size());
        for(String s : sources) {
            addedMap.put(s, false);
        }
    }

    TablePanel table;
    if (ev.getData() instanceof TablePanel) {
        table = (TablePanel) ev.getData();
    } else {
        table = getEventHub().getActiveTable();
    }
    String tblName = table.getName();
    if (sources.contains(tblName)) {
        boolean isAdded = addedMap.get(tblName);
        if (!isAdded) {
            FocusWidget b = makeButton(table);
            table.addToolButton(b, false);
            addedMap.put(tblName, true);
        }
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:29,代码来源:BaseTableButtonSetter.java

示例13: updateHighlighted

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public static void updateHighlighted(FocusWidget b, GeneralCommand cmd) {
    if (cmd.isHighlighted()) {
        b.removeStyleName("button");
        b.removeStyleName("normal-text");
        b.addStyleName("button-highlight");
        b.addStyleName("highlight-text");
    } else {
        b.removeStyleName("button-highlight");
        b.removeStyleName("highlight-text");
        b.addStyleName("button");
        b.addStyleName("normal-text");
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:14,代码来源:TablePanel.java

示例14: StringListPanel

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
public StringListPanel(String title, List<String> fieldNames, FocusWidget w, boolean autoSort) {
  widget = w;
  if (title != null) {
    titlePanel = new HorizontalPanel();
    SmallHeading titleLabel = new SmallHeading(title);
    titlePanel.add(titleLabel);
    add(titlePanel);
  }

  t = new StringListTable(fieldNames, autoSort);
  add(t);

  buttonPanel = new HorizontalPanel();
  buttonPanel.setStyleName(Gerrit.RESOURCES.css().stringListPanelButtons());
  deleteButton = new Button(Gerrit.C.stringListPanelDelete());
  deleteButton.setEnabled(false);
  deleteButton.addClickHandler(
      new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          widget.setEnabled(true);
          t.deleteChecked();
        }
      });
  buttonPanel.add(deleteButton);
  add(buttonPanel);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:28,代码来源:StringListPanel.java

示例15: on

import com.google.gwt.user.client.ui.FocusWidget; //导入依赖的package包/类
private void on(GwtEvent<?> e) {
  if (widget.isEnabled()
      || !(e.getSource() instanceof FocusWidget)
      || !((FocusWidget) e.getSource()).isEnabled()) {
    if (e.getSource() instanceof ValueBoxBase) {
      final TextBoxBase box = ((TextBoxBase) e.getSource());
      Scheduler.get()
          .scheduleDeferred(
              new ScheduledCommand() {
                @Override
                public void execute() {
                  if (box.getValue().trim().equals(originalValue)) {
                    widget.setEnabled(false);
                  }
                }
              });
    }
    return;
  }

  if (e.getSource() instanceof TextBoxBase) {
    onTextBoxBase((TextBoxBase) e.getSource());
  } else {
    // For many widgets, we can assume that a change is an edit. If
    // a widget does not work that way, it should be special cased
    // above.
    widget.setEnabled(true);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:OnEditEnabler.java


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