protected void onRender(Element parent, int index) { super.onRender(parent, index); startDate = new DateWidget(); endDate = new DateWidget(); button = new Button("查询"); datePanel.add(new Label("开始日期")); datePanel.add(startDate); Label space = new Label(); space.setWidth(50); datePanel.add(space); datePanel.add(new Label("结束日期")); datePanel.add(endDate); space = new Label(); space.setWidth(10); datePanel.add(space); datePanel.add(button); add(datePanel); html = new HtmlContainer(); html.setHeight("100%"); html.setWidth("100%"); add(html); button.addListener( Events.Select, new Listener<ComponentEvent>() { public void handleEvent(ComponentEvent be) { Map<String, String> params = new HashMap<String, String>(); if (startDate.getValue() != null && endDate.getValue() != null && startDate.getValue().after(endDate.getValue())) { MessageBox.alert("ERROR", "Invalid date inputted!", null); return; } DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd"); params.put("STARTDATE", format.format(startDate.getValue())); params.put("ENDDATE", format.format(endDate.getValue())); new ReportService() .generateReport( "UserRankReport", params, new ReportService.Listener() { @Override public void onSuccess(String content) { content = content.substring(content.indexOf("<html>")); html.setHtml(content); } }); } }); }
public TeachersUI() { setScrollMode(Scroll.AUTO); setId("centerPanelBackground"); addStyleName("uiContainer"); setHeaderVisible(false); image = Resources.ICONS.image(); add(image.createImage()); String text = "<br><center><font color='orange' size='5px'>Teachers</font></center>"; text += "<h2>Teachers directions here </h2> "; label = new Label(); label.setText(text); add(label); videoPanel = new ContentPanel(); videoPanel.setId("jwplayer"); videoPanel.setHeaderVisible(false); videoPanel.setBodyBorder(false); add(videoPanel); Timer timer = new Timer() { @Override public void run() { loadVideoPlayer(); } }; timer.schedule(50); }
public void populateMainPanel() { this.setHeaderVisible(false); theHeading = new Label("Create New Topic and Message"); theHeading.setStyleName("formHeading"); groupDiscussionsContainer.getGroupDiscussionMainPanel().removeAll(); this.add(theHeading, new MarginData(5, 0, 0, 5)); formPanel.setBodyBorder(false); formPanel.setHeaderVisible(false); formPanel.setWidth("100%"); formPanel.setLabelAlign(LabelAlign.TOP); name = new TextField<String>(); name.setFieldLabel("Topic name"); description = new HtmlEditor() { protected void afterRender() { resize(0, 0); super.afterRender(); }; }; description.setFieldLabel("Message"); formPanel.add(name, new FormData("100%")); formPanel.add(description, new FormData("100%")); saveButton = new Button("Save"); formPanel.setButtonAlign(HorizontalAlignment.CENTER); formPanel.addButton(saveButton); this.add(formPanel, new MarginData(5, 5, 65, 0)); groupDiscussionsContainer.getGroupDiscussionMainPanel().add(this); groupDiscussionsContainer.getGroupDiscussionMainPanel().getBottomComponent().hide(); groupDiscussionsContainer .getGroupDiscussionMainPanel() .setHeight(MainPanel.getInstance().getHeight()); // groupDiscussionsContainer.getGroupDiscussionMainPanel().layout(true); addDefaultListeners(); resize(0, 0); }
@Override public void addComponent() { VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(10); FieldSet fieldSet = new FieldSet(); fieldSet.setHeading("Share Project to Users"); fieldSet.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); this.projectNameLabel = new Label(); this.projectNameLabel.setStyleAttribute("font-size", "13"); this.ownerLabel = new Label(); this.ownerLabel.setStyleAttribute("font-size", "13"); this.organizationLabel = new Label(); this.organizationLabel.setStyleAttribute("font-size", "13"); fieldSet.add(this.projectNameLabel, new MarginData(10)); fieldSet.add(ownerLabel, new MarginData(10)); fieldSet.add(organizationLabel, new MarginData(10)); verticalPanel.add(fieldSet); // LayoutContainer labelListContainer = new LayoutContainer(new BorderLayout()); labelListContainer.setHeight(20); labelListContainer.setStyleAttribute("background-color", "white"); labelListContainer.setWidth(GPProjectManagementWidget.COMPONENT_WIDTH - 25); Label organizationUserLabel = new Label("Organization Users:"); organizationUserLabel.setStyleAttribute("font-size", "13"); organizationUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(organizationUserLabel, new BorderLayoutData(Style.LayoutRegion.WEST)); Label projectSharedUserLabel = new Label("Project Shared Users:"); projectSharedUserLabel.setStyleAttribute("font-size", "13"); projectSharedUserLabel.setStyleAttribute("font-weight", "bold"); labelListContainer.add(projectSharedUserLabel, new BorderLayoutData(Style.LayoutRegion.EAST)); verticalPanel.add(labelListContainer); // final DualListField<GPSimpleUser> lists = new DualListField<GPSimpleUser>(); lists.setMode(Mode.INSERT); lists.setHeight("" + GPProjectManagementWidget.COMPONENT_HEIGHT / 1.75); lists.setStyleAttribute("margin-left", "11px"); lists.setHideLabel(Boolean.TRUE); ListField<GPSimpleUser> from = lists.getFromList(); from.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.fromStore = new ListStore<GPSimpleUser>(); from.setStore(this.fromStore); ListField<GPSimpleUser> to = lists.getToList(); to.setDisplayField(GPSimpleUserKeyValue.NAME.toString()); this.toStore = new ListStore<GPSimpleUser>(); to.setStore(this.toStore); Button cancelButton = new Button( "GoTo Search Project", BasicWidgetResources.ICONS.gear(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { ShareProjectPanel.this.reset(); projectManagementWidget.showSearchProjectPanel(); } }); super.addButton(cancelButton); saveButton = new Button( "Save", BasicWidgetResources.ICONS.save(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { toStore.commitChanges(); List<Long> accountIDsProject = Lists.newArrayListWithCapacity(toStore.getModels().size()); IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name()); boolean test = false; for (GPSimpleUser user : toStore.getModels()) { if (user.getId().equals(accountDetail.getId())) { test = true; } accountIDsProject.add(user.getId()); } final boolean isShared = test; ShareProjectPanel.this.reset(); LayerRemote.Util.getInstance() .shareProjectToUsers( project.getId(), accountIDsProject, new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { System.out.println("Error on saving user to share project"); } @Override public void onSuccess(Boolean result) { // System.out.println("Project is Shared: // " + isShared); if (project.isDefaultProject()) { GPClientProject projInSession = Registry.get(UserSessionEnum.CURRENT_PROJECT_ON_TREE.name()); if (isShared) { projInSession.setShared(Boolean.TRUE); } else { projInSession.setShared(Boolean.FALSE); } } project.setShared(Boolean.TRUE); loadData(project); } }); } }); super.addButton(saveButton); super.add(verticalPanel); super.add(lists, new FormData("98%")); LayoutContainer filterContainer = new LayoutContainer(new BorderLayout()); this.fromFilter = this.createServerFilter(this.fromFilter, fromStore, "Organization Users"); filterContainer.add(this.fromFilter, new BorderLayoutData(Style.LayoutRegion.WEST)); this.toFilter = this.createServerFilter(this.toFilter, toStore, "Sharing User List"); filterContainer.add(this.toFilter, new BorderLayoutData(Style.LayoutRegion.EAST)); filterContainer.setStyleAttribute("margin", "11px"); super.add(filterContainer); }
@Override public void addComponent() { this.dimensionRadioGroup = new RadioGroup(); this.dimensionRadioGroup.setFieldLabel( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_dimensionRadioLabelText()); fixedDimensionRadio.setBoxLabel( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_fixedDimensionRadioLabelText()); fixedDimensionRadio.setHideLabel(Boolean.TRUE); this.dimensionRadioGroup.add(fixedDimensionRadio); variableDimensionRadio.setBoxLabel( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_variableDimensionRadioLabelText()); variableDimensionRadio.setHideLabel(Boolean.TRUE); this.dimensionRadioGroup.add(variableDimensionRadio); this.fixedDimensionContainer.setVisible(Boolean.FALSE); this.variableDimensionContainer.setVisible(Boolean.FALSE); this.fixedDimensionRadio.addListener( Events.Change, new Listener<FieldEvent>() { @Override public void handleEvent(FieldEvent fe) { if (fixedDimensionRadio.getValue()) { fixedDimensionContainer.setVisible(Boolean.TRUE); variableDimensionContainer.setVisible(Boolean.FALSE); } } }); this.variableDimensionRadio.addListener( Events.Change, new Listener<FieldEvent>() { @Override public void handleEvent(FieldEvent fe) { if (variableDimensionRadio.getValue()) { variableDimensionContainer.setVisible(Boolean.TRUE); fixedDimensionContainer.setVisible(Boolean.FALSE); } } }); this.startStore = new ListStore<DimensionData>(); this.startDimensionComboBox = new ComboBox<DimensionData>(); this.startDimensionComboBox.setFieldLabel( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_startDimensionComboLabelText()); this.startDimensionComboBox.setStore(this.startStore); this.startDimensionComboBox.setDisplayField(DimensionData.DIMENSION_KEY); this.startDimensionComboBox.setEditable(Boolean.FALSE); this.startDimensionComboBox.addSelectionChangedListener( new SelectionChangedListener<DimensionData>() { @Override public void selectionChanged(SelectionChangedEvent<DimensionData> se) { if (se.getSelectedItem() != null) { endStore.removeAll(); int indexStart = startStore.getModels().indexOf(se.getSelectedItem()) + 1; // System.out.println("Sublist start: " + indexStart); // System.out.println("Sublist end: " + // (startStore.getModels().size() - 1)); if (indexStart < startStore.getModels().size()) { endDimensionComboBox.enable(); endStore.add( startStore .getModels() .subList( startStore.indexOf(se.getSelectedItem()) + 1, startStore.getModels().size())); } else { endDimensionComboBox.disable(); } } } }); this.endStore = new ListStore<DimensionData>(); this.endDimensionComboBox = new ComboBox<DimensionData>(); this.endDimensionComboBox.setFieldLabel( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_endDimensionComboLabelText()); this.endDimensionComboBox.setStore(this.endStore); this.endDimensionComboBox.setDisplayField(DimensionData.DIMENSION_KEY); this.endDimensionComboBox.disable(); this.endDimensionComboBox.setEditable(Boolean.FALSE); dimensionSizeLabel = new Label(); dimensionSizeLabel.setStyleAttribute("font-size", "12px"); this.startFilterNumberField = new NumberField(); this.startFilterNumberField.setFireChangeEventOnSetValue(Boolean.TRUE); this.startFilterNumberField.addListener( Events.Change, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { if (checkStartFieldValue()) { int fromFilter = startFilterNumberField.getValue().intValue(); int position = startStore.getModels().size() - fromFilter - 1; String tooltip = (String) startStore.getModels().get(position).get(DimensionData.DIMENSION_KEY); // startStore.getModels().size() - fromFilter - 1).get( startFilterNumberField.setToolTip(tooltip); startTimeLabel.setHtml(tooltip); slider.setValue(position); } else { startTimeLabel.setHtml(""); startFilterNumberField.setToolTip(""); } } }); startTimeLabel = new Label(); startTimeLabel.setStyleAttribute("font-size", "1.3em"); this.startFilterNumberField.setSize(50, 30); this.endFilterNumberField = new NumberField(); this.endFilterNumberField.setFireChangeEventOnSetValue(Boolean.TRUE); endTimeLabel = new Label(); endTimeLabel.setStyleAttribute("font-size", "1.3em"); this.endFilterNumberField.addListener( Events.Change, new Listener<BaseEvent>() { @Override public void handleEvent(BaseEvent be) { if (checkEndFieldValue()) { int endFilter = endFilterNumberField.getValue().intValue(); String tooltip = (String) startStore.getModels().get(endFilter).get(DimensionData.DIMENSION_KEY); // startStore.getModels().size() - endFilter - 1). endFilterNumberField.setToolTip(tooltip); endTimeLabel.setHtml(tooltip); } else { endTimeLabel.setHtml(""); endFilterNumberField.setToolTip(""); } } }); this.endFilterNumberField.setSize(50, 30); FormPanel panel = new FormPanel(); panel.setHeaderVisible(Boolean.FALSE); panel.setFrame(Boolean.TRUE); panel.setBorders(Boolean.FALSE); panel.setHeight(WIDGET_HEIGHT - 67); panel.add(this.dimensionRadioGroup); panel.setStyleAttribute("background-color", "white"); this.variableDimensionContainer.add(dimensionSizeLabel, new FormData("100%")); Portal portal = new Portal(3); portal.setBorders(false); portal.setColumnWidth(0, .20); portal.setColumnWidth(1, .60); portal.setColumnWidth(2, .20); Portlet portlet = new Portlet(); portlet.setLayout(new FitLayout()); portlet.setHeaderVisible(false); portlet.setSize(50, 30); portlet.add(this.startFilterNumberField); portal.add(portlet, 0); portlet = new Portlet(new CenterLayout()); portlet.setHeaderVisible(false); portlet.setSize(100, 30); this.rangeCheckBox = new CheckBox(); rangeCheckBox.setValue(true); rangeCheckBox.setBoxLabel("range"); portlet.add(rangeCheckBox); portlet.setBorders(false); portal.add(portlet, 1); portlet = new Portlet(); portlet.setHeaderVisible(false); portlet.setSize(50, 30); portlet.add(this.endFilterNumberField); portal.add(portlet, 2); this.variableDimensionContainer.add(portal, new FormData("99%")); // this.slider = new Slider() { @Override public void setValue(int value) { super.setValue(value); super.setMessage("" + (startStore.getModels().size() - value)); } }; slider.setIncrement(1); this.variableDimensionContainer.add(slider, new FormData("98%")); this.fixedDimensionContainer.add(this.startDimensionComboBox); this.fixedDimensionContainer.add(this.endDimensionComboBox); panel.add(this.fixedDimensionContainer, new FormData("100%")); panel.add(this.variableDimensionContainer, new FormData("100%")); super.add(panel); this.playSelectioListener = new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { // System.out.println("Play button status: "); if (!playButton.isPressed()) { playButton.setText(ButtonsConstants.INSTANCE.playText()); playButton.setIcon(AbstractImagePrototype.create(LayerResources.ICONS.playTime())); animationTimer.cancel(); } else { Number startValueNumber = startFilterNumberField.getValue(); if (startValueNumber == null) { GeoPlatformMessage.alertMessage( LayerModuleConstants.INSTANCE .LayerTimeFilterWidget_timeFilterWarningTitleText(), LayerModuleConstants.INSTANCE .LayerTimeFilterWidget_timeFilterWarningBodyText()); } else { slider.setValue(startStore.getModels().size() - startValueNumber.intValue() - 1); playButton.setIcon(AbstractImagePrototype.create(LayerResources.ICONS.pauseTime())); playButton.setText(ButtonsConstants.INSTANCE.pauseText()); playTimeFilter(); } } } }; playButton.addSelectionListener(playSelectioListener); playButton.setHeight(30); super.addButton(playButton); Button apply = new Button(ButtonsConstants.INSTANCE.applyText()); this.applyFilterSelectionListener = new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { GPLayerTreeModel layerSelected = (GPLayerTreeModel) treePanel.getSelectionModel().getSelectedItem(); IMementoSave mementoSave = MementoModuleInjector.MainInjector.getInstance().getMementoSave(); AbstractMementoOriginalProperties memento = mementoSave.copyOriginalProperties(layerSelected); String layerName; if (layerSelected.getAlias() != null && layerSelected.getAlias().indexOf(LAYER_TIME_DELIMITER) != -1) { layerName = layerSelected .getAlias() .substring(0, layerSelected.getAlias().indexOf(LAYER_TIME_DELIMITER)); } else { layerName = layerSelected.getLabel(); } if (fixedDimensionRadio.getValue()) { String timeFilter = (String) startDimensionComboBox.getValue().get(DimensionData.DIMENSION_KEY); if (endDimensionComboBox.getValue() != null) { timeFilter += "/" + (String) endDimensionComboBox.getValue().get(DimensionData.DIMENSION_KEY); } layerSelected.setTimeFilter(timeFilter); layerSelected.setVariableTimeFilter(null); layerSelected.setAlias( layerName + LAYER_TIME_DELIMITER + layerSelected.getTimeFilter() + "]"); WidgetPropertiesHandlerManager.fireEvent(labelEvent); } else { if ((rangeCheckBox.getValue() && !checkEndFieldValue()) || !checkStartFieldValue()) { GeoPlatformMessage.errorMessage( LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_timeFilterErrorTitleText(), LayerModuleConstants.INSTANCE.LayerTimeFilterWidget_timeFilterErrorBodyText()); return; } else { int fromFilter = slider.getValue(); String timeFilter = "" + (startStore.getModels().size() - fromFilter - 1); String variableTimeFilter = (String) startStore.getModels().get(fromFilter).get(DimensionData.DIMENSION_KEY); if (rangeCheckBox.getValue() && playButton.isPressed()) { fromFilter = startStore.getModels().size() - startFilterNumberField.getValue().intValue() - 1; timeFilter = "" + startFilterNumberField.getValue().intValue(); variableTimeFilter = (String) startStore.getModels().get(fromFilter).get(DimensionData.DIMENSION_KEY); // int toFilter = slider.getValue(); timeFilter += "/" + (startStore.getModels().size() - slider.getValue() - 1); variableTimeFilter += "/" + (String) startStore.getModels().get(toFilter).get(DimensionData.DIMENSION_KEY); } // This is usefull when press Apply button to show all the elements in range else if (rangeCheckBox.getValue() && endFilterNumberField.getValue() != null) { fromFilter = startStore.getModels().size() - startFilterNumberField.getValue().intValue() - 1; timeFilter = "" + startFilterNumberField.getValue().intValue(); variableTimeFilter = (String) startStore.getModels().get(fromFilter).get(DimensionData.DIMENSION_KEY); // int toFilter = startStore.getModels().size() - endFilterNumberField.getValue().intValue() - 1; timeFilter += "/" + endFilterNumberField.getValue().intValue(); variableTimeFilter += "/" + (String) startStore.getModels().get(toFilter).get(DimensionData.DIMENSION_KEY); } layerSelected.setTimeFilter(timeFilter); layerSelected.setVariableTimeFilter(variableTimeFilter); layerSelected.setAlias( layerName + LAYER_TIME_DELIMITER + layerSelected.getVariableTimeFilter() + "]"); WidgetPropertiesHandlerManager.fireEvent(labelEvent); slider.setMessage(variableTimeFilter); GeoPlatformMessage.infoMessage( LayerModuleConstants.INSTANCE .LayerTimeFilterWidget_timeFilterMessageTitleText(), LayerModuleMessages.INSTANCE.LayerTimeFilterWidget_layerStatusShowedMessage( timeFilter)); } } mementoSave.putOriginalPropertiesInCache(memento); timeFilterLayerMapEvent.setLayerBean(layerSelected); GPHandlerManager.fireEvent(timeFilterLayerMapEvent); treePanel.refresh(layerSelected); } }; apply.addSelectionListener(applyFilterSelectionListener); super.addButton(apply); Button close = new Button( ButtonsConstants.INSTANCE.closeText(), new SelectionListener<ButtonEvent>() { @Override public void componentSelected(ButtonEvent ce) { startFilterNumberField.clear(); startTimeLabel.setHtml(""); endTimeLabel.setHtml(""); endFilterNumberField.clear(); hide(); } }); super.addButton(close); }