private void initGUI() { toolBar = new ToolBar(); TextButton userButton = new TextButton("Profile"); forumButton = new TextButton("Forum"); TextButton chatButton = new TextButton("Chat"); lecturesButton = new TextButton("Lectures", ELearningController.ICONS.lectures()); showProfileItem = new MenuItem("Show profile"); changePasswordItem = new MenuItem("Change Password"); viewLogsItem = new MenuItem("View logs"); logoutItem = new MenuItem("Logout"); userMenu = new Menu(); Menu lecturesMenu = new Menu(); userLecturesItem = new MenuItem("My Lectures"); unenrolledLecturesItem = new MenuItem("Unenrolled Lectures"); unenrolledLecturesItem.setSubMenu(new GridMenu(userLecturesView)); logoutItem.setIcon(ELearningController.ICONS.logout()); userMenu.add(showProfileItem); userMenu.add(viewLogsItem); userMenu.add(changePasswordItem); userMenu.add(logoutItem); lecturesMenu.add(userLecturesItem); lecturesMenu.add(unenrolledLecturesItem); lecturesButton.setMenu(lecturesMenu); lecturesButton.setWidth(100); userButton.setWidth(100); userButton.setIcon(ELearningController.ICONS.profile()); userButton.setMenu(userMenu); forumButton.setWidth(80); forumButton.setIcon(ELearningController.ICONS.forum()); chatButton.setWidth(80); chatButton.setIcon(ELearningController.ICONS.chat()); toolBar.setHorizontalSpacing(5); toolBar.add(lecturesButton); toolBar.add(userButton); toolBar.add(forumButton); toolBar.add(chatButton); if (addSettingsButton) { settingsButton = new TextButton("", ELearningController.ICONS.settings()); toolBar.add(settingsButton); } toolBar.setWidth(455); }
public ArchiveView(final ArchiveHandler archiveHandler, ListStore<Device> deviceStore) { this.archiveHandler = archiveHandler; deviceStore.addStoreHandlers(deviceStoreHandlers); this.deviceStore = deviceStore; DeviceProperties deviceProperties = GWT.create(DeviceProperties.class); deviceCombo = new ComboBox<Device>(deviceStore, deviceProperties.label()); // Element that displays the current track color styleButtonTrackColor = new TextButton(); styleButtonTrackColor .getElement() .getStyle() .setProperty("backgroundColor", "#".concat(style.DEFAULT_COLOR)); styleButtonTrackColor.getElement().getStyle().setCursor(Style.Cursor.TEXT); // Menu with the small palette smallColorMenu = new ExtColorMenu(ArchiveStyle.COLORS, ArchiveStyle.COLORS); smallColorMenu.setColor(ArchiveStyle.DEFAULT_COLOR); smallColorMenu .getPalette() .addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { style.setTrackColor(event.getValue()); smallColorMenu.hide(true); fullColorMenu.getPalette().setValue("", false); styleButtonTrackColor .getElement() .getStyle() .setProperty("backgroundColor", "#".concat(style.getTrackColor())); } }); // Menu with the complete palette fullColorMenu = new ColorMenu(); fullColorMenu .getPalette() .addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { style.setTrackColor(event.getValue()); fullColorMenu.hide(true); smallColorMenu.getPalette().setValue("", false); styleButtonTrackColor .getElement() .getStyle() .setProperty("backgroundColor", "#".concat(style.getTrackColor())); } }); // Markers routeMarkersType = new Menu(); for (Object[] obj : new Object[][] { {i18n.noMarkers(), null}, {i18n.standardMarkers(), PositionIconType.iconArchive}, {i18n.reducedMarkers(), PositionIconType.dotArchive} }) { CheckMenuItem item = new CheckMenuItem((String) obj[0]); final PositionIconType iconType = (PositionIconType) obj[1]; item.setGroup("markers"); item.setChecked( iconType == ApplicationContext.getInstance().getUserSettings().getArchiveMarkerType()); if (item.isChecked()) { style.setIconType(iconType); } item.addSelectionHandler( new SelectionHandler<Item>() { @Override public void onSelection(SelectionEvent<Item> event) { style.setIconType(iconType); archiveHandler.onChangeArchiveMarkerType(iconType); } }); routeMarkersType.add(item); } devicesTabs = new TabPanel(GWT.<TabPanel.TabPanelAppearance>create(BlueTabPanelBottomAppearance.class)); archivePanels = new HashMap<Long, ArchivePanel>(); uiBinder.createAndBindUi(this); markersMenu.setText(i18n.overlayType(UserSettings.OverlayType.MARKERS)); // Initialize with current time long min = 60 * 1000; Date now = new Date(); Date to = new Date(((now.getTime() + 15 * min) / (15 * min)) * 15 * min); Date from = new Date(to.getTime() - 60 * min); fromDate.setValue(from); fromTime.setValue(from); toDate.setValue(to); toTime.setValue(to); }
/** * Class constructor * * @param binder */ @Inject public CurriculumNodeTreeView(final Binder binder) { // tree comes pre sorted from server tree = new Tree<CurriculumNodeProxy, String>( store, new ValueProvider<CurriculumNodeProxy, String>() { @Override public String getValue(CurriculumNodeProxy object) { return object.getName(); } @Override public void setValue(CurriculumNodeProxy object, String value) {} @Override public String getPath() { return "name"; } }); tree.setIconProvider( new IconProvider<CurriculumNodeProxy>() { @Override public ImageResource getIcon(CurriculumNodeProxy model) { CurriculumNodeTypeIcon icon = new CurriculumNodeTypeIcon(model.getType()); return icon.getImageResource(); } }); // checkbox tree configuration tree.setCheckable(true); tree.setCheckNodes(CheckNodes.BOTH); tree.setCheckStyle(CheckCascade.NONE); tree.setAutoLoad(true); // expanding context menu in tree, events should be handled in presenter // (UI-Handler Class) Menu contextMenu = new Menu(); MenuItem expandAll = new MenuItem(COCerResources.TEXT.expandAll()); expandAll.setIcon(COCerResources.IMAGES.arrow_out()); expandAll.addSelectionHandler( new SelectionHandler<Item>() { @Override public void onSelection(SelectionEvent<Item> event) { if (tree.getSelectionModel().getSelectedItem().equals(store.getRootItems().get(0))) { tree.expandAll(); } else { for (CurriculumNodeProxy node : tree.getSelectionModel().getSelectedItems()) { tree.setExpanded(node, true, true); } } } }); contextMenu.add(expandAll); MenuItem collapseAll = new MenuItem(COCerResources.TEXT.collapseAll()); collapseAll.setIcon(COCerResources.IMAGES.arrow_in()); collapseAll.addSelectionHandler( new SelectionHandler<Item>() { @Override public void onSelection(SelectionEvent<Item> event) { if (tree.getSelectionModel().getSelectedItem().equals(store.getRootItems().get(0))) { tree.collapseAll(); } else { for (CurriculumNodeProxy node : tree.getSelectionModel().getSelectedItems()) { tree.setExpanded(node, false, true); } } } }); contextMenu.add(collapseAll); tree.setContextMenu(contextMenu); widget = binder.createAndBindUi(this); panel.add(tree); }