本文整理汇总了Java中com.extjs.gxt.ui.client.widget.menu.MenuItem.setText方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setText方法的具体用法?Java MenuItem.setText怎么用?Java MenuItem.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.extjs.gxt.ui.client.widget.menu.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLastLoginDateItem
import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入方法依赖的package包/类
/**
* Creates the last login info entry on the start menu.
* @param startMenu The start menu to add the entry to.
*/
private void createLastLoginDateItem(StartMenu startMenu)
{
// Show their last login date in the start menu,
// if they have one
Date lastLogin = staticLoginData.getLastLogin();
if (lastLogin != null)
{
// Build the menu item
MenuItem menuItem = new MenuItem();
menuItem.setStyleAttribute("fontWeight", "bold");
menuItem.setText("Last login: "
+ Utils.formatFriendlyDateTime
(lastLogin));
// The user shouldn't actually be clicking
// on this
menuItem.setEnabled(false);
startMenu.add(menuItem);
}
}
示例2: getMenuItem
import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入方法依赖的package包/类
public static Item getMenuItem(final CMDBDesktopMenuItem desktopItem) {
if (desktopItem.isSeparator()) {
return(new SeparatorMenuItem());
}
MenuItem item = new MenuItem();
item.setText(desktopItem.getText());
item.setIconStyle(desktopItem.getIconStyle());
String toolTip = desktopItem.getTooltip();
if (toolTip != null && toolTip.length() > 0) {
item.setToolTip(toolTip);
}
if (desktopItem.getWindowItem() != null) {
item.addSelectionListener(new SelectionListener<ComponentEvent>() {
@Override
public void componentSelected(ComponentEvent ce) {
Dispatcher.get().dispatch(new AppEvent<CMDBDesktopMenuItem>(CMDBEvents.DESKTOP_MENU_SELECTED, desktopItem));
}
});
if (desktopItem.getWindowItem().isOpenAtStartup()) {
Dispatcher.get().dispatch(new AppEvent<CMDBDesktopMenuItem>(CMDBEvents.DESKTOP_MENU_SELECTED, desktopItem));
}
}
// Check if submenus.
if (desktopItem.getMenuItem()!= null && desktopItem.getMenuItem().size() > 0) {
Menu subMenu = new Menu();
List items = desktopItem.getMenuItem();
for (CMDBDesktopMenuItem dItem : desktopItem.getMenuItem()) {
subMenu.add(getMenuItem(dItem));
}
item.setSubMenu(subMenu);
}
return(item);
}
示例3: doAssignmentTreeGrid
import com.extjs.gxt.ui.client.widget.menu.MenuItem; //导入方法依赖的package包/类
private TreeGrid<ModelData> doAssignmentTreeGrid(){
assignmentStore = new TreeStore<ModelData>();
ColumnConfig name = new ColumnConfig("name", "Name", 100);
name.setRenderer(new TreeGridCellRenderer<ModelData>());
ColumnConfig index = new ColumnConfig("assignmentIndex", "Index", 100);
index.setSortable(false);
index.setFixed(true);
index.setMenuDisabled(true);
ColumnConfig status = new ColumnConfig("status", "Status", 100);
ColumnModel cm = new ColumnModel(Arrays.asList(name, index, status));
assignmentTreeGrid = new TreeGrid<ModelData>(assignmentStore, cm);
assignmentTreeGrid.setBorders(true);
assignmentTreeGrid.setAutoExpandColumn("name");
assignmentTreeGrid.setTrackMouseOver(false);
assignmentTreeGrid.setLoadMask(true);
assignmentTreeGrid.setWidth(600);
assignmentTreeGrid.setHeight(580);
assignmentTreeGrid.setBorders(true);
assignmentTreeGrid.getView().setEmptyText("no data");
assignmentTreeGrid.setId("myAssignmentTreeGridid");
assignmentTreeGrid.getSelectionModel().addListener(Events.SelectionChange,
new Listener<SelectionChangedEvent<ModelData>>() {
public void handleEvent(SelectionChangedEvent<ModelData> be) {
if (be.getSelection().size() > 0) {
assignmentId = Integer.parseInt(assignmentTreeGrid.getSelectionModel().getSelectedItem().get("index").toString());
userDepartmentReportContentPanel.loadData(assignmentId, departmentId);
loadUserAssignmentCheckGrid();
assignmentDetailPanel.setData(assignmentId, departmentId);
} else {
//panel.clear();
}
}
});
Menu menu = new Menu();
MenuItem addUserToAssignmentMenuItem = new MenuItem();
addUserToAssignmentMenuItem.setText("Add/Remove User to Assignment");
addUserToAssignmentMenuItem.setIcon(Resources.ICONS.add16());
addUserToAssignmentMenuItem.addSelectionListener(new SelectionListener<MenuEvent>(){
@Override public void componentSelected(MenuEvent ce) {
addUserToAssignmentWindow();
}
});
menu.add(addUserToAssignmentMenuItem);
assignmentTreeGrid.setContextMenu(menu);
return assignmentTreeGrid;
}