public WgtEditOneTrigger() { VerticalPanel vpanel = new VerticalPanel(); m_lstConditions.addChangeListener(this); m_lstConditions.setVisibleItemCount(10); vpanel.add(m_lstConditions); m_lstConditionsClass.setVisibleItemCount(1); for (ConditionClass conditionClass : ConditionClass.values()) { m_lstConditionsClass.addItem(conditionClass.name()); } vpanel.add(m_lstConditionsClass); m_btnNewCondition.addClickHandler(this); vpanel.add(m_btnNewCondition); m_lstActions.addChangeListener(this); m_lstActions.setVisibleItemCount(10); vpanel.add(m_lstActions); m_lstActionsClass.setVisibleItemCount(1); for (ActionClass actionClass : ActionClass.values()) { m_lstActionsClass.addItem(actionClass.name()); } vpanel.add(m_lstActionsClass); m_btnNewAction.addClickHandler(this); vpanel.add(m_btnNewAction); initWidget(vpanel); }
public SelectUserOrRoleDialog( ArrayList<String> existing, final IUserRoleSelectedCallback callback) { super( Messages.getString("selectUserOrRole"), Messages.getString("ok"), Messages.getString("cancel"), false, true, contentTable); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ usersListBox.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { rolesListBox.setSelectedIndex(-1); okButton.setEnabled(true); } }); rolesListBox.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { usersListBox.setSelectedIndex(-1); okButton.setEnabled(true); } }); setCallback( new IDialogCallback() { public void cancelPressed() {} public void okPressed() { if (getSelectedUser() != null) { callback.userSelected(getSelectedUser()); } else { callback.roleSelected(getSelectedRole()); } } }); // Unique ids are important for test automation contentTable.getElement().setId("userOrRoleDialogContentTable"); usersListBox.getElement().setId("userOrRoleDialogUsersList"); rolesListBox.getElement().setId("userOrRoleDialogRolesList"); okButton.getElement().setId("userOrRoleDialogOkButton"); okButton.setEnabled(false); cancelButton.getElement().setId("userOrRoleDialogCancelButton"); usersListBox.setVisibleItemCount(5); rolesListBox.setVisibleItemCount(5); rolesListBox.setWidth("100%"); // $NON-NLS-1$ usersListBox.setWidth("100%"); // $NON-NLS-1$ contentTable.clear(); contentTable.setWidth("100%"); // $NON-NLS-1$ contentTable.setWidget(0, 0, new Label(Messages.getString("users"))); // $NON-NLS-1$ contentTable.setWidget(1, 0, usersListBox); contentTable.setWidget(2, 0, new Label(Messages.getString("roles"))); // $NON-NLS-1$ contentTable.setWidget(3, 0, rolesListBox); fetchAllUsers(existing); fetchAllRoles(existing); setWidth("200px"); // $NON-NLS-1$ }
public void addGoalType() { for (int i = 0; i < vgoalTypes.length; i++) { vdropBox.addItem(vgoalTypes[i]); } vdropBox.ensureDebugId("vcwListBox-dropBox"); vmultiBox.ensureDebugId("vcwListBox-multiBox"); vmultiBox.setWidth("11em"); vmultiBox.setVisibleItemCount(3); // RootPanel.get("goalTypeDropBox").add(dropBox); vendorTable.setWidget(2, 0, new HTML("What is your Number 1 Weakness?")); vendorTable.setWidget(2, 1, businessName); vendorTable.setWidget(3, 0, new HTML("How is your Number 1 Weakness impacting you?")); vendorTable.setWidget(3, 1, product); vendorTable.setWidget(4, 0, new HTML("How do you plan to overcome this weakness")); vendorTable.setWidget(4, 1, income); vendorTable.setWidget(4, 0, new HTML("What is your Number 2 Strength?")); vendorTable.setWidget(4, 1, expense); vendorTable.setWidget(4, 0, new HTML("How is your Number 2 Weakness impacting you?")); vendorTable.setWidget(4, 1, savings); vendorTable.setWidget(5, 1, registerButton); // vendorTable.setWidget(2, 1, vdropBox); // RootPanel.get("flexTable").add(vendorTable); // topBarViewListener.onGoalWordsSelect(vdropBox); // Add a handler to handle drop box events vdropBox.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { showCategory(vmultiBox, vdropBox.getSelectedIndex()); vmultiBox.ensureDebugId("vcwListBox-multiBox"); } }); }
private ListBox createScheduleCombo() { final ScheduleEditor localThis = this; ListBox lb = new ListBox(); lb.setVisibleItemCount(1); // lb.setStyleName("scheduleCombo"); //$NON-NLS-1$ lb.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { localThis.handleScheduleChange(); } }); // add all schedule types to the combobox for (ScheduleType schedType : EnumSet.range(ScheduleType.RUN_ONCE, ScheduleType.CRON)) { if (!isBlockoutDialog || (schedType != ScheduleType.CRON && schedType != ScheduleType.SECONDS && schedType != ScheduleType.MINUTES && schedType != ScheduleType.HOURS)) { lb.addItem(schedType.toString()); } } lb.setItemSelected(0, true); return lb; }
private ListBox getListBox() { ListBox listBox = new ListBox(false); listBox.setVisibleItemCount(2); listBox.addItem("item 0"); listBox.addItem("item 1"); return listBox; }
private ListBox createRolesListBox() { rolesListBox = new ListBox(); rolesListBox.setVisibleItemCount(20); rolesListBox.setHeight("100%"); rolesListBox.setWidth("200px"); rolesListBox.addChangeHandler(this); return rolesListBox; }
private Grid buildDoubleList(WorkingSetConfigData wsData) { Grid grid = new Grid(2, 3); availableFacts.setVisibleItemCount(10); selectedFacts.setVisibleItemCount(10); Grid btnsPanel = new Grid(2, 1); btnsPanel.setWidget( 0, 0, new Button( ">", new ClickHandler() { public void onClick(ClickEvent sender) { moveSelected(availableFacts, selectedFacts); } })); btnsPanel.setWidget( 1, 0, new Button( "<", new ClickHandler() { public void onClick(ClickEvent sender) { moveSelected(selectedFacts, availableFacts); } })); grid.setWidget(0, 0, new SmallLabel("Available")); // TODO i18n grid.setWidget(0, 1, new SmallLabel("")); grid.setWidget(0, 2, new SmallLabel("Selected")); // TODO i18n grid.setWidget(1, 0, availableFacts); grid.setWidget(1, 1, btnsPanel); grid.setWidget(1, 2, selectedFacts); grid.getColumnFormatter().setWidth(0, "45%"); grid.getColumnFormatter().setWidth(0, "10%"); grid.getColumnFormatter().setWidth(0, "45%"); return grid; }
private void setListitems() { Set<String> keys = map.keySet(); Set<String> cloned = new TreeSet<String>(); for (String name : keys) { cloned.add(name); } for (String key : cloned) { listbox.addItem(key); } listbox.setVisibleItemCount(5); }
public BootstrapGeneratorWidget() { contentPanel = new VerticalPanel(); contentPanel.setWidth("800px"); surveyService = GWT.create(SurveyService.class); addSurveyButton = new Button(TEXT_CONSTANTS.addSelected()); addSurveyButton.addClickHandler(this); generateFileButton = new Button(TEXT_CONSTANTS.generate()); generateFileButton.addClickHandler(this); removeButton = new Button(TEXT_CONSTANTS.removeSelected()); removeButton.addClickHandler(this); CaptionPanel selectorPanel = new CaptionPanel(TEXT_CONSTANTS.selectSurveyForInclusion()); HorizontalPanel temp = new HorizontalPanel(); selectionWidget = new SurveySelectionWidget(Orientation.HORIZONTAL, TerminalType.SURVEY); temp.add(selectionWidget); temp.add(addSurveyButton); selectorPanel.add(temp); contentPanel.add(selectorPanel); CaptionPanel zipPanel = new CaptionPanel(TEXT_CONSTANTS.fileContents()); selectionListbox = new ListBox(true); selectionListbox.setVisibleItemCount(DEFAULT_ITEM_COUNT); VerticalPanel zipPanelContent = new VerticalPanel(); HorizontalPanel selectedSurveyPanel = new HorizontalPanel(); ViewUtil.installFieldRow( selectedSurveyPanel, TEXT_CONSTANTS.selectedSurveys(), selectionListbox, LABEL_STYLE); selectedSurveyPanel.add(removeButton); zipPanelContent.add(selectedSurveyPanel); temp = new HorizontalPanel(); includeDbScriptBox = new CheckBox(); includeDbScriptBox.addClickHandler(this); ViewUtil.installFieldRow(temp, TEXT_CONSTANTS.includeDB(), includeDbScriptBox, LABEL_STYLE); zipPanelContent.add(temp); dbInstructionArea = new TextArea(); dbInstructionArea.setVisible(false); zipPanelContent.add(dbInstructionArea); temp = new HorizontalPanel(); notificationEmailBox = new TextBox(); ViewUtil.installFieldRow( temp, TEXT_CONSTANTS.notificationEmail(), notificationEmailBox, LABEL_STYLE); zipPanelContent.add(temp); zipPanelContent.add(generateFileButton); zipPanel.add(zipPanelContent); contentPanel.add(zipPanel); initWidget(contentPanel); }
public ListBoxItem(String name, String title) { super(name, title); listBox = new ListBox(); listBox.setName(name); listBox.setTitle(title); listBox.setVisibleItemCount(5); listBox.setTabIndex(0); listBox.setHeight("50px"); valueChangeHandler = new ChangeHandler() { @Override public void onChange(ChangeEvent event) {} }; listBox.addChangeHandler(valueChangeHandler); wrapper = new HorizontalPanel(); wrapper.add(listBox); }
private void createResponseTypeColumn() { VerticalPanel rp = new VerticalPanel(); upperLinePanel.add(rp); Label responseTypeLabel = new Label(myConstants.responseType() + ":"); responseTypeLabel.setStyleName("keyLabel"); rp.add(responseTypeLabel); final ListBox responseTypeListBox = new ListBox(); responseTypeListBox.addItem(Input2.LIKERT_SMILEYS); responseTypeListBox.addItem(Input2.LIKERT); responseTypeListBox.addItem(Input2.OPEN_TEXT); responseTypeListBox.addItem(Input2.LIST); responseTypeListBox.addItem(Input2.NUMBER); responseTypeListBox.addItem(Input2.LOCATION); responseTypeListBox.addItem(Input2.PHOTO); // responseType.addItem(InputDAO.SOUND); // responseType.addItem(InputDAO.ACTIVITY); responseTypeListBox.setVisibleItemCount(1); int responseTypeSelectedIndex = 0; for (int i = 0; i < Input2.RESPONSE_TYPES.length; i++) { if (Input2.RESPONSE_TYPES[i].equals(input.getResponseType())) { responseTypeSelectedIndex = i; break; } } responseTypeListBox.setItemSelected(responseTypeSelectedIndex, true); rp.add(responseTypeListBox); responseTypeListBox.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { input.setResponseType( responseTypeListBox.getItemText(responseTypeListBox.getSelectedIndex())); responseView.drawWidgetForInput(input); // inputPromptTextPanel.setVisible(!input.isInvisibleInput()); } }); }
public AddPR() { VerticalPanel verticalPanel = new VerticalPanel(); initWidget(verticalPanel); FlexTable flexTable = new FlexTable(); verticalPanel.add(flexTable); flexTable.setSize("323px", "184px"); Label lblSelectTheMethod = new Label("Select the method to add physical resources"); lblSelectTheMethod.setStyleName("gui-Label"); flexTable.setWidget(0, 0, lblSelectTheMethod); lblSelectTheMethod.setHeight("39px"); final ListBox prList = new ListBox(); flexTable.setWidget(1, 0, prList); prList.setWidth("249px"); prList.addItem("Add PR by IP"); prList.addItem("Add PR by IP response"); prList.addItem("Add PR by URL"); prList.addItem("Add PR by URL response"); prList.addItem("Add Multiple PRs"); prList.setVisibleItemCount(5); flexTable.getCellFormatter().setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); Button btnAddPr = new Button("Add PR"); btnAddPr.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // if (prList.getSelectedIndex() == -1) {Window.alert("Select the method!");}; // if (prList.getSelectedIndex() == 0) {Window.alert("Under construction!");}; } }); flexTable.setWidget(2, 0, btnAddPr); flexTable.getCellFormatter().setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER); }
private void buildContent(RowData data) { grid = new FlexTable(); grid.setCellSpacing(5); HTML html = new HTML("Working Set Name: "); html.addStyleName("color-dark-blue"); workingSetName = new TextBox(); grid.setWidget(0, 0, html); grid.setWidget(0, 1, workingSetName); workingSetName.setSize("95%", "100%"); html = new HTML("Creator: "); html.addStyleName("color-dark-blue"); managerHTML = new HTML(); grid.setWidget(1, 0, html); grid.setWidget(1, 1, managerHTML); html = new HTML("Date Created: "); html.addStyleName("color-dark-blue"); dateCreatedHTML = new HTML(); grid.setWidget(2, 0, html); grid.setWidget(2, 1, dateCreatedHTML); html = new HTML("Working Set Type: "); html.addStyleName("color-dark-blue"); workingSetMode = new ListBox(false); workingSetMode.insertItem("none selected", 0); workingSetMode.insertItem(WorkingSetData.PRIVATE, PRIVATEINDEX); workingSetMode.insertItem(WorkingSetData.PUBLIC, PUBLICINDEX); workingSetMode.setVisibleItemCount(1); workingSetMode.setEnabled(false); workingSetMode.setSelectedIndex(PUBLICINDEX); grid.setWidget(3, 0, html); grid.setWidget(3, 1, workingSetMode); html = new HTML("Associated People: "); html.addStyleName("color-dark-blue"); people = new SISCompleteList(this, 400); grid.setWidget(PEOPLECELL, 0, html); grid.setWidget(PEOPLECELL, 1, people); html = new HTML("Assessment Scope: "); html.addStyleName("color-dark-blue"); filterPanel = new AssessmentFilterPanel(new AssessmentFilter(), false, true, false, true); grid.setWidget(5, 0, html); grid.setWidget(5, 1, filterPanel); html = new HTML("Description: "); html.addStyleName("color-dark-blue"); description = new TextArea(); grid.setWidget(6, 0, html); grid.setWidget(6, 1, description); description.setSize("95%", "100%"); html = new HTML("Working Set Notes: "); html.addStyleName("color-dark-blue"); notes = new TextArea(); grid.setWidget(7, 0, html); grid.setWidget(7, 1, notes); notes.setSize("95%", "100%"); grid.getColumnFormatter().setWidth(0, "130px"); grid.getColumnFormatter().setWidth(1, "400px"); grid.getRowFormatter().addStyleName(5, "vertical-align-top"); grid.getRowFormatter().addStyleName(6, "vertical-align-top"); grid.getRowFormatter().addStyleName(7, "vertical-align-top"); grid.getCellFormatter().setHeight(6, 1, "200px"); grid.getCellFormatter().setHeight(7, 1, "200px"); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP); hp.addStyleName("expert-border"); hp.add(grid); // add(hp, data); LayoutContainer widget = new LayoutContainer(); widget.setScrollMode(Scroll.AUTO); widget.setLayout(new FillLayout()); widget.add(hp); add(widget, data); grid.setWidth("100%"); }
// TODO extract & move private VerticalPanel createArcTypeContainerControl( String label, final ArcItemContainer arcItemContainer) { final TextBox arcColorText = new TextBox(); arcColorText.setText(arcItemContainer.getArcColor()); final ListBox arcStyleDropDown = new ListBox(); arcStyleDropDown.setVisibleItemCount(1); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_SOLID); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DASHED); arcStyleDropDown.addItem(ArcSettings.ARC_STYLE_DOTTED); String arcStyle = arcItemContainer.getArcStyle(); if (ArcSettings.ARC_STYLE_DOTTED.equals(arcStyle)) { arcStyleDropDown.setSelectedIndex(2); } else if (ArcSettings.ARC_STYLE_DASHED.equals(arcStyle)) { arcStyleDropDown.setSelectedIndex(1); } else { arcStyleDropDown.setSelectedIndex(0); } final ListBox arcHeadDropDown = new ListBox(); arcHeadDropDown.setVisibleItemCount(1); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_NONE); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_EMPTY); arcHeadDropDown.addItem(ArcSettings.ARC_HEAD_TRIANGLE_FULL); String arcHead = arcItemContainer.getArcHead(); if (ArcSettings.ARC_HEAD_TRIANGLE_FULL.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(2); } else if (ArcSettings.ARC_HEAD_TRIANGLE_EMPTY.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(1); } else if (ArcSettings.ARC_HEAD_NONE.equals(arcHead)) { arcHeadDropDown.setSelectedIndex(0); } final String defaultEntry = "Default"; final ListBox arcThicknessDropDown = new ListBox(); arcThicknessDropDown.setVisibleItemCount(1); arcThicknessDropDown.addItem(defaultEntry); arcThicknessDropDown.addItem("1"); arcThicknessDropDown.addItem("2"); arcThicknessDropDown.addItem("3"); arcThicknessDropDown.addItem("4"); arcThicknessDropDown.addItem("5"); arcThicknessDropDown.setSelectedIndex(0); final Button updateButton = new Button("Update Arcs"); updateButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { arcItemContainer.setArcColor(arcColorText.getText()); arcItemContainer.setArcStyle( arcStyleDropDown.getItemText(arcStyleDropDown.getSelectedIndex())); String selectedThicknessText = arcThicknessDropDown.getItemText(arcThicknessDropDown.getSelectedIndex()); if (selectedThicknessText.equals(defaultEntry)) { arcItemContainer.setArcThicknessLevel(0); } else { arcItemContainer.setArcThicknessLevel(Integer.parseInt(selectedThicknessText)); } arcItemContainer.setArcHead( arcHeadDropDown.getItemText(arcHeadDropDown.getSelectedIndex())); } }); final CheckBox visibleCheckBox = new CheckBox("Arcs Visible"); visibleCheckBox.setValue(true); visibleCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { @Override public void onValueChange(ValueChangeEvent<Boolean> event) { boolean value = visibleCheckBox.getValue(); updateButton.setEnabled(value); arcStyleDropDown.setEnabled(value); arcHeadDropDown.setEnabled(value); arcThicknessDropDown.setEnabled(value); arcColorText.setEnabled(value); arcItemContainer.setVisible(value); } }); VerticalPanel containerPanel = new VerticalPanel(); containerPanel.add(new Label(label)); containerPanel.add(visibleCheckBox); containerPanel.add(new Label("Arc Color")); containerPanel.add(arcColorText); containerPanel.add(new Label("Arc Style")); containerPanel.add(arcStyleDropDown); containerPanel.add(new Label("Arc Head")); containerPanel.add(arcHeadDropDown); containerPanel.add(new Label("Arc Thickness")); containerPanel.add(arcThicknessDropDown); containerPanel.add(updateButton); // Handler runs and removes itself internally. @SuppressWarnings("unused") Handler handler = new Handler() { private HandlerRegistration register = arcColorText.addAttachHandler(this); @Override public void onAttachOrDetach(AttachEvent event) { $(arcColorText).as(Enhance).colorBox(ColorPickerType.SIMPLE); // Only want this run once, so let's do a trick to remove it. register.removeHandler(); } }; return containerPanel; }
private void addDebetKredit(ListBox listBox) { listBox.setVisibleItemCount(1); listBox.addItem("", "0"); listBox.addItem(elements.debet(), "1"); listBox.addItem(elements.kredit(), "-1"); }
TrustActionEditFields() { setText(elements.project()); FlexTable edittable = new FlexTable(); edittable.setStyleName("edittable"); edittable.setText(0, 0, elements.trust()); trustBox = new ListBoxWithErrorText("trust"); trustActionCache.fillTrustList(trustBox.getListbox()); edittable.setWidget(0, 1, trustBox); edittable.setText(1, 0, elements.description()); descBox = new TextBoxWithErrorText("description"); descBox.setMaxLength(40); descBox.setVisibleLength(40); edittable.setWidget(1, 1, descBox); edittable.setText(2, 0, elements.trust_default_desc()); defaultDescBox = new TextBoxWithErrorText("trust_default_desc"); defaultDescBox.setMaxLength(50); defaultDescBox.setVisibleLength(50); edittable.setWidget(2, 1, defaultDescBox); edittable.setText(3, 0, elements.trust_actionclub()); actionClubBox = new ListBox(); addDebetKredit(actionClubBox); edittable.setWidget(3, 1, actionClubBox); edittable.setText(4, 0, elements.trust_actiontrust()); actionTrustBox = new ListBox(); addDebetKredit(actionTrustBox); edittable.setWidget(4, 1, actionTrustBox); edittable.setText(5, 0, elements.trust_creditpost()); HorizontalPanel hpcred = new HorizontalPanel(); HTML errorAccountCredHtml = new HTML(); accountCredIdBox = new TextBoxWithErrorText("account", errorAccountCredHtml); accountCredIdBox.setVisibleLength(6); accountCredNameBox = new ListBox(); accountCredNameBox.setVisibleItemCount(1); hpcred.add(accountCredIdBox); hpcred.add(accountCredNameBox); hpcred.add(errorAccountCredHtml); PosttypeCache.getInstance(constants, messages).fillAllPosts(accountCredNameBox); Util.syncListbox(accountCredNameBox, accountCredIdBox.getTextBox()); edittable.setWidget(5, 1, hpcred); edittable.setText(6, 0, elements.trust_debetpost()); HorizontalPanel hpdeb = new HorizontalPanel(); HTML errorAccountDebHtml = new HTML(); accountDebIdBox = new TextBoxWithErrorText("account", errorAccountDebHtml); accountDebIdBox.setVisibleLength(6); accountDebNameBox = new ListBox(); accountDebNameBox.setVisibleItemCount(1); hpdeb.add(accountDebIdBox); hpdeb.add(accountDebNameBox); hpdeb.add(errorAccountDebHtml); PosttypeCache.getInstance(constants, messages).fillAllPosts(accountDebNameBox); Util.syncListbox(accountDebNameBox, accountDebIdBox.getTextBox()); edittable.setWidget(6, 1, hpdeb); DockPanel dp = new DockPanel(); dp.add(edittable, DockPanel.NORTH); saveButton = new NamedButton("projectEditView_saveButton", elements.save()); saveButton.addClickHandler(this); cancelButton = new NamedButton("projectEditView_cancelButton", elements.cancel()); cancelButton.addClickHandler(this); mainErrorLabel = new HTML(); mainErrorLabel.setStyleName("error"); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(saveButton); buttonPanel.add(cancelButton); buttonPanel.add(mainErrorLabel); dp.add(buttonPanel, DockPanel.NORTH); setWidget(dp); }
public I2CRegistersPanel() { service_ = initGSON.initGSON(); mainPanel_ = new HorizontalPanel(); cbcList_ = new ListBox(true); // TODO enables multiple select cbcList_.addItem("Waiting..."); cbcList_.setEnabled(false); cbcList_.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { getI2CValues(); } }); cbcList_.setVisibleItemCount(0); mainPanel_.add(cbcList_); mainPanel_.add(echo_); registerValues.put(null, null); cbcNames.put(null, null); rpcContainer.add(cbcNames); // sends an empty request rpcMessage myparams = new rpcMessage(); myparams.setMethod("connectedCBCNames"); myparams.setParams(rpcContainer); // send an empty request, returns connected names service_.connectedCBCService( myparams, new MethodCallback<cbcNamesResponse>() { @Override public void onFailure(Method method, Throwable exception) { // TODO Auto-generated method stub Window.alert(exception.getMessage().toString()); } @Override public void onSuccess(Method method, cbcNamesResponse response) { cbcList_.removeItem(0); for (final String cbcName : response.getResult()) { cbcList_.addItem(cbcName); } cbcList_.setEnabled(true); cbcList_.setVisibleItemCount(response.getResult().size()); getI2CValues(); } }); mainSettings_ = new DisclosurePanel("Main control registers"); channelMasks_ = new DisclosurePanel("Channel masks"); channelTrims_ = new DisclosurePanel("Channel trims"); HorizontalPanel verticalPanelForI2C = new HorizontalPanel(); verticalPanelForI2C.add(mainSettings_); verticalPanelForI2C.add(channelMasks_); verticalPanelForI2C.add(channelTrims_); mainPanel_.add(verticalPanelForI2C); mainSettings_.add( addRegisters( new String[] { "FrontEndControl", "TriggerLatency", "HitDetectSLVS", "Ipre1", "Ipre2", "Ipsf", "Ipa", "Ipaos", "Vpafb", "Icomp", "Vpc", "Vplus", "VCth", "TestPulsePot", "SelTestPulseDel&ChanGroup", "MiscTestPulseCtrl&AnalogMux", "TestPulseChargePumpCurrent", "TestPulseChargeMirrCascodeVolt", "CwdWindow&Coincid", "MiscStubLogic" })); channelMasks_.add( addRegisters( new String[] { "MaskChannelFrom008downto001", "MaskChannelFrom016downto009", "MaskChannelFrom024downto017", "MaskChannelFrom032downto025", "MaskChannelFrom040downto033", "MaskChannelFrom048downto041", "MaskChannelFrom056downto049", "MaskChannelFrom064downto057", "MaskChannelFrom072downto065", "MaskChannelFrom080downto073", "MaskChannelFrom088downto081", "MaskChannelFrom096downto089", "MaskChannelFrom104downto097", "MaskChannelFrom112downto105", "MaskChannelFrom120downto113", "MaskChannelFrom128downto121", "MaskChannelFrom136downto129", "MaskChannelFrom144downto137", "MaskChannelFrom152downto145", "MaskChannelFrom160downto153", "MaskChannelFrom168downto161", "MaskChannelFrom176downto169", "MaskChannelFrom184downto177", "MaskChannelFrom192downto185", "MaskChannelFrom200downto193", "MaskChannelFrom208downto201", "MaskChannelFrom216downto209", "MaskChannelFrom224downto217", "MaskChannelFrom232downto225", "MaskChannelFrom240downto233", "MaskChannelFrom248downto241", "MaskChannelFrom254downto249" })); channelTrims_.add( addRegisters( new String[] { "Channel001", "Channel002", "Channel003", "Channel004", "Channel005", "Channel006", "Channel007", "Channel008", "Channel009", "Channel010", "Channel011", "Channel012", "Channel013", "Channel014", "Channel015", "Channel016", "Channel017", "Channel018", "Channel019", "Channel020", "Channel021", "Channel022", "Channel023", "Channel024", "Channel025", "Channel026", "Channel027", "Channel028", "Channel029", "Channel030", "Channel031", "Channel032", "Channel033", "Channel034", "Channel035", "Channel036", "Channel037", "Channel038", "Channel039", "Channel040", "Channel041", "Channel042", "Channel043", "Channel044", "Channel045", "Channel046", "Channel047", "Channel048", "Channel049", "Channel050", "Channel051", "Channel052", "Channel053", "Channel054", "Channel055", "Channel056", "Channel057", "Channel058", "Channel059", "Channel060", "Channel061", "Channel062", "Channel063", "Channel064", "Channel065", "Channel066", "Channel067", "Channel068", "Channel069", "Channel070", "Channel071", "Channel072", "Channel073", "Channel074", "Channel075", "Channel076", "Channel077", "Channel078", "Channel079", "Channel080", "Channel081", "Channel082", "Channel083", "Channel084", "Channel085", "Channel086", "Channel087", "Channel088", "Channel089", "Channel090", "Channel091", "Channel092", "Channel093", "Channel094", "Channel095", "Channel096", "Channel097", "Channel098", "Channel099", "Channel100", "Channel101", "Channel102", "Channel103", "Channel104", "Channel105", "Channel106", "Channel107", "Channel108", "Channel109", "Channel110", "Channel111", "Channel112", "Channel113", "Channel114", "Channel115", "Channel116", "Channel117", "Channel118", "Channel119", "Channel120", "Channel121", "Channel122", "Channel123", "Channel124", "Channel125", "Channel126", "Channel127", "Channel128", "Channel129", "Channel130", "Channel131", "Channel132", "Channel133", "Channel134", "Channel135", "Channel136", "Channel137", "Channel138", "Channel139", "Channel140", "Channel141", "Channel142", "Channel143", "Channel144", "Channel145", "Channel146", "Channel147", "Channel148", "Channel149", "Channel150", "Channel151", "Channel152", "Channel153", "Channel154", "Channel155", "Channel156", "Channel157", "Channel158", "Channel159", "Channel160", "Channel161", "Channel162", "Channel163", "Channel164", "Channel165", "Channel166", "Channel167", "Channel168", "Channel169", "Channel170", "Channel171", "Channel172", "Channel173", "Channel174", "Channel175", "Channel176", "Channel177", "Channel178", "Channel179", "Channel180", "Channel181", "Channel182", "Channel183", "Channel184", "Channel185", "Channel186", "Channel187", "Channel188", "Channel189", "Channel190", "Channel191", "Channel192", "Channel193", "Channel194", "Channel195", "Channel196", "Channel197", "Channel198", "Channel199", "Channel200", "Channel201", "Channel202", "Channel203", "Channel204", "Channel205", "Channel206", "Channel207", "Channel208", "Channel209", "Channel210", "Channel211", "Channel212", "Channel213", "Channel214", "Channel215", "Channel216", "Channel217", "Channel218", "Channel219", "Channel220", "Channel221", "Channel222", "Channel223", "Channel224", "Channel225", "Channel226", "Channel227", "Channel228", "Channel229", "Channel230", "Channel231", "Channel232", "Channel233", "Channel234", "Channel235", "Channel236", "Channel237", "Channel238", "Channel239", "Channel240", "Channel241", "Channel242", "Channel243", "Channel244", "Channel245", "Channel246", "Channel247", "Channel248", "Channel249", "Channel250", "Channel251", "Channel252", "Channel253", "Channel254", "ChannelDummy" })); }
public void setVisibleItemCount(int count) { listBox.setVisibleItemCount(count); }
/** @param node */ public LoggerDetailTopPanel(final LoggerInfo info, String shortName, final LogTreeNode node) { super(); this.info = info; this.shortName = shortName; this.node = node; this.topTopList = new ListPanel(); this.topTopList.setWidth("100%"); this.topTopList.setHeight("100%"); this.topTopList.setCellText(0, 0, "Short name:"); Hyperlink l = new Hyperlink(this.shortName, null); l.setTitle(this.info.getFullName()); this.topTopList.setCell(0, 1, l); this.topTopList.setCellText(0, 2, "Use parent handlers:"); final ListBox ups = new ListBox(); ups.addItem("Yes", _TRUE); ups.addItem("No", _FALSE); ups.setVisibleItemCount(1); ups.setSelectedIndex(info.isUseParentHandlers() ? 0 : 1); this.topTopList.setCell(0, 3, ups); for (int i = 0; i < LogTreeNode._LEVELS.length; i++) { levelB.addItem(LogTreeNode._LEVELS[i], LogTreeNode._LEVELS[i]); if (LogTreeNode._LEVELS[i].equals(info.getLevel())) levelB.setSelectedIndex(i); } this.topTopList.setCellText(2, 0, "Level:"); this.topTopList.setCell(2, 1, levelB); this.topTopList.setCellText(2, 2, "Filter class name:"); this.filterClassName.setWidth("100%"); this.filterClassName.setText(info.getFilterClass()); this.topTopList.setCell(2, 3, this.filterClassName); Hyperlink saveDetails = new Hyperlink(); saveDetails.setText("Loger details (Save)"); this.setHeader(0, saveDetails); this.setCell(0, 0, this.topTopList); buildParamList(); this.setColumnWidth(0, "100%"); // Change listeners for ListBoxes: class UseParentHandlerListener implements ChangeListener { /* * (non-Javadoc) * * @see com.google.gwt.user.client.ui.ChangeListener#onChange(com.google .gwt.user.client.ui.Widget) */ public void onChange(Widget sender) { final ListBox ss = (ListBox) sender; final String value = ss.getValue(ss.getSelectedIndex()); final boolean sendValue; if (value.equals(_TRUE)) sendValue = (true); else sendValue = (false); class UseParentHandlerCallback implements AsyncCallback { /* * (non-Javadoc) * * @see com.google.gwt.user.client.rpc.AsyncCallback#onFailure (java.lang.Throwable) */ public void onFailure(Throwable caught) { Logger.error( "Could not set \"UseParentHandler\" flag for logger [" + info.getFullName() + "] due to[" + caught.getMessage() + "]"); if (sendValue) { ss.setItemSelected(1, true); } else { ss.setItemSelected(0, true); } } /* * (non-Javadoc) * * @see com.google.gwt.user.client.rpc.AsyncCallback#onSuccess (java.lang.Object) */ public void onSuccess(Object result) {} } ServerConnection.logServiceAsync.setUseParentHandlers( info.getFullName(), sendValue, new UseParentHandlerCallback()); } } class LevelChangeListener implements ChangeListener { public void onChange(Widget sender) { ListBox ss = (ListBox) sender; final String logLevel = ss.getValue(ss.getSelectedIndex()); class LevelChangeCallBack implements AsyncCallback { public void onFailure(Throwable caught) { Logger.error( "Could not set logger level for logger [" + info.getFullName() + "] due to[" + caught.getMessage() + "]"); } public void onSuccess(Object result) { if (logLevel.equals(LogTreeNode._LEVEL_OFF)) { node.turnOff(); } else { node.turnOn(); } } } ServerConnection.logServiceAsync.setLoggerLevel( info.getFullName(), logLevel, new LevelChangeCallBack()); } } // add listeners ups.addChangeListener(new UseParentHandlerListener()); levelB.addChangeListener(new LevelChangeListener()); }
public GeoStory() { panel = new SplitLayoutPanel(); types = new GeoEventTypes(); model = new GeoStoryModel(types); space = new Space(LatLng.newInstance(45.50, -73.60), 4, types, model); time = new TimeLine(model, types); list = new ListBox(true); list.setVisibleItemCount(20); for (GeoStoryItem i : model.getItems()) { list.addItem(i.toString()); } { controls = new VerticalPanel(); { email = new TextBox(); email.setText("*****@*****.**"); controls.add(email); email.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) {} }); } { Button getFromServer = new Button("Get from server"); getFromServer.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { types.getEventFromServer.shareEvent(getEmail()); } }); controls.add(getFromServer); } { Button dump = new Button("Json dump"); dump.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { StringBuilder sb = new StringBuilder(); for (GeoStoryItem item : model.getItems()) { sb.append(item.toJSON() + "\n"); } DialogBox db = new DialogBox(true); TextArea ta = new TextArea(); ta.setEnabled(true); ta.setText(sb.toString()); db.add(ta); db.center(); db.show(); } }); controls.add(dump); } { Button jsonload = new Button("Json load"); jsonload.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Question<String> q = new ContentQuestion("Entrer la cha”ne JSON"); final QPanel textContent = new QPanel(new Questionnaire(q)); textContent.center(); textContent.show(); q.answerChannel() .registerHandler( new WHandler<String>() { @Override public void onEvent(WEvent<String> elt) { String[] lines = elt.getElement().split("\n"); for (String item : lines) { JSONValue json = JSONParser.parse(item); JSONObject object = json.isObject(); GeoStoryItem gsi = GeoStoryItem.fromJSON(object); types.itemAdded.shareEvent(gsi); types.centerEvent.shareEvent(null); } } }); } }); controls.add(jsonload); } { Button popRandom = new Button("Populate at random"); controls.add(popRandom); popRandom.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { model.populateRandomly(10); types.centerEvent.shareEvent(null); } }); } { Button popFromText = new Button("Populate from text"); controls.add(popFromText); popFromText.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Question<String> q = new ContentQuestion("Description des evenements"); final QPanel textContent = new QPanel(new Questionnaire(q)); textContent.center(); textContent.show(); q.answerChannel() .registerHandler( new WHandler<String>() { @Override public void onEvent(WEvent<String> elt) { List<Triple<String, Interval, String>> res = GeoStoryParser.parse(elt.getElement()); int delay = 0; final Geocoder geo = new Geocoder(); for (final Triple<String, Interval, String> indiv : res) { geodecode(geo, indiv, delay = delay + 100); } textContent.hide(); } }); } }); } { Button cia = new Button("Draw borders"); controls.add(cia); cia.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { for (final Polyline poly : CIA.segments(CIA.northamerica)) { space.space.addOverlay(poly); } for (final Polyline poly : CIA.segments(CIA.europe)) { space.space.addOverlay(poly); } } }); } { Button family = new Button("Genealogy info"); controls.add(family); family.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Geocoder geo = new Geocoder(); for (final Triple<String, Interval, String> indiv : Genea.people()) { geodecode(geo, indiv, 100); } } }); } { Button addOne = new Button("Add one"); addOne.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { ContentQuestion desc = new ContentQuestion("Description?"); WhenQuestion when = new WhenQuestion("Quand?"); ContentQuestion plac = new ContentQuestion("Nom du lieu?"); WhereQuestion wher = new WhereQuestion("Sur la carte?", plac.answerChannel()); Questionnaire q = new Questionnaire(desc, when, plac, wher); QPanel tested = new QPanel(q); // tested.setSize("50%", "50%"); q.answerChannel() .registerHandler( new WHandler<Map<String, String>>() { @Override public void onEvent(WEvent<Map<String, String>> elt) { Map<String, String> map = elt.getElement(); // Window.alert("Questionnaire are "+ elt.getElement().toString()); String[] coord = map.get("Sur la carte?").split("\\|"); // Window.alert("Questionnaire are "+ elt.getElement().toString()+" // "+Arrays.toString(coord)); LatLng ll = LatLng.newInstance( Double.parseDouble(coord[0]), Double.parseDouble(coord[1])); // ; String[] dates = map.get("Quand?").split("->"); Interval interval = new Interval( WhenQuestion.dtf.parse(dates[0]), WhenQuestion.dtf.parse(dates[1])); GeoStoryItem geo = new GeoStoryItem( interval, map.get("Nom du lieu?"), ll, map.get("Description?")); Window.alert( "GeoStory " + geo + " " + Arrays.toString(dates) + " " + map.get("Quand?")); types.itemAdded.shareEvent(geo); types.centerEvent.shareEvent(null); } }); tested.center(); tested.show(); } }); controls.add(addOne); } { Button reset = new Button("Reset"); reset.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { model.reset(); types.centerEvent.shareEvent(null); } }); controls.add(reset); } { final TextBox search = new TextBox(); search.setTitle("Search"); final Button go = new Button("go"); go.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Set<GeoStoryItem> itemsSet = model.getItems(); // filtering if (search.getText() != null && !search.getText().isEmpty()) { for (GeoStoryItem geoStoryItem : itemsSet) { if (geoStoryItem.getDescription().contains(search.getText())) { geoStoryItem.setVisible(true); } else { geoStoryItem.setVisible(false); } } } types.centerEvent.shareEvent(null); } }); controls.add(go); controls.add(search); } { final Button removeFilter = new Button("remove filter"); removeFilter.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Set<GeoStoryItem> itemsSet = model.getItems(); // filtering for (GeoStoryItem geoStoryItem : itemsSet) { geoStoryItem.setVisible(true); } types.centerEvent.shareEvent(null); } }); controls.add(removeFilter); } panel.addSouth(time, 150); panel.addWest(controls, 150); panel.add(space); Window.addResizeHandler(this); } this.initWidget(panel); // Short term timer to check and resize the badly initialized map. Timer t = new Timer() { public void run() { space.checkResizeAndCenter(); time.init(); } }; t.schedule(1); }
public void addBadge( String badge, boolean requireForSignup, String applyToRole, int numSlots, int earlySignup) { if (badge.equals(SELECT_A_BADGE)) { return; } final int rows = badgeft.getRowCount() - 1; badgeft.setText(rows + 1, 0, badge); final CheckBox cb = new CheckBox(); cb.setValue(requireForSignup); badgeft.setWidget(rows + 1, 1, cb); final ListBox roles = new ListBox(); roles.setVisibleItemCount(1); roles.addItem(ALL_ROLES); int sel_index = 0; for (int i = 0; i < roleft.getRowCount() - 2; ++i) { String role = roleft.getText(i + 1, 0); roles.addItem(role); if (applyToRole != null && role.equals(applyToRole)) { sel_index = roles.getItemCount() - 1; } } roles.setSelectedIndex(sel_index); badgeft.setWidget(rows + 1, 2, roles); final TextBox slots = new TextBox(); slots.setVisibleLength(2); if (requireForSignup && applyToRole != null) { slots.setText("" + numSlots); } else { slots.setEnabled(false); slots.setText("0"); } badgeft.setWidget(rows + 1, 3, slots); slots.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int num = Integer.parseInt(slots.getText()); if (num < 0) { slots.setText("0"); } } catch (NumberFormatException e) { slots.setText("0"); } } }); cb.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (cb.getValue() && roles.getSelectedIndex() > 0) { slots.setEnabled(true); } else { slots.setEnabled(false); slots.setText("0"); } } }); roles.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { if (cb.getValue() && roles.getSelectedIndex() > 0) { slots.setEnabled(true); } else { slots.setEnabled(false); slots.setText("0"); } } }); final TextBox early = new TextBox(); early.setVisibleLength(2); early.setText("" + earlySignup); badgeft.setWidget(rows + 1, 4, early); early.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int num = Integer.parseInt(early.getText()); if (num < 0) { early.setText("0"); } } catch (NumberFormatException e) { early.setText("0"); } } }); badgeft.setWidget( rows + 1, 5, new Button( "Remove", new ClickHandler() { public void onClick(ClickEvent event) { final Object sender = event.getSource(); final int rows = badgeft.getRowCount() - 1; for (int i = 0; i < rows; ++i) { if (badgeft.getWidget(i + 1, 5) == sender) { badgeft.removeRow(i + 1); break; } } } })); }
// Override Widget Methods @Override public void onLoad() { // Create the two needed Listboxs final ListBox lbHourSelector = new ListBox(); final ListBox lbMinuteSelector = new ListBox(); final Label lblHour = new Label("h"); final Label lblMinute = new Label("min"); final Label lblName = new Label(this.getTimePickerName()); // Implements the HourSelector lbHourSelector.addItem("00"); lbHourSelector.addItem("01"); lbHourSelector.addItem("02"); lbHourSelector.addItem("03"); lbHourSelector.addItem("04"); lbHourSelector.addItem("05"); lbHourSelector.addItem("06"); lbHourSelector.addItem("07"); lbHourSelector.addItem("08"); lbHourSelector.addItem("09"); lbHourSelector.addItem("10"); lbHourSelector.addItem("11"); lbHourSelector.addItem("12"); lbHourSelector.addItem("13"); lbHourSelector.addItem("14"); lbHourSelector.addItem("15"); lbHourSelector.addItem("16"); lbHourSelector.addItem("17"); lbHourSelector.addItem("18"); lbHourSelector.addItem("19"); lbHourSelector.addItem("20"); lbHourSelector.addItem("21"); lbHourSelector.addItem("22"); lbHourSelector.addItem("23"); // Define the number of visible elements lbHourSelector.setVisibleItemCount(1); // Define the listBox's size lbHourSelector.getElement().getStyle().setWidth(50, Unit.PX); // Implements the MinuteSelector lbMinuteSelector.addItem("00"); lbMinuteSelector.addItem("01"); lbMinuteSelector.addItem("02"); lbMinuteSelector.addItem("03"); lbMinuteSelector.addItem("04"); lbMinuteSelector.addItem("05"); lbMinuteSelector.addItem("06"); lbMinuteSelector.addItem("07"); lbMinuteSelector.addItem("08"); lbMinuteSelector.addItem("09"); lbMinuteSelector.addItem("10"); lbMinuteSelector.addItem("11"); lbMinuteSelector.addItem("12"); lbMinuteSelector.addItem("13"); lbMinuteSelector.addItem("14"); lbMinuteSelector.addItem("15"); lbMinuteSelector.addItem("16"); lbMinuteSelector.addItem("17"); lbMinuteSelector.addItem("18"); lbMinuteSelector.addItem("19"); lbMinuteSelector.addItem("20"); lbMinuteSelector.addItem("21"); lbMinuteSelector.addItem("22"); lbMinuteSelector.addItem("23"); lbMinuteSelector.addItem("24"); lbMinuteSelector.addItem("25"); lbMinuteSelector.addItem("26"); lbMinuteSelector.addItem("27"); lbMinuteSelector.addItem("28"); lbMinuteSelector.addItem("29"); lbMinuteSelector.addItem("30"); lbMinuteSelector.addItem("31"); lbMinuteSelector.addItem("32"); lbMinuteSelector.addItem("33"); lbMinuteSelector.addItem("34"); lbMinuteSelector.addItem("35"); lbMinuteSelector.addItem("36"); lbMinuteSelector.addItem("37"); lbMinuteSelector.addItem("38"); lbMinuteSelector.addItem("39"); lbMinuteSelector.addItem("40"); lbMinuteSelector.addItem("41"); lbMinuteSelector.addItem("42"); lbMinuteSelector.addItem("43"); lbMinuteSelector.addItem("44"); lbMinuteSelector.addItem("45"); lbMinuteSelector.addItem("46"); lbMinuteSelector.addItem("47"); lbMinuteSelector.addItem("48"); lbMinuteSelector.addItem("49"); lbMinuteSelector.addItem("50"); lbMinuteSelector.addItem("51"); lbMinuteSelector.addItem("52"); lbMinuteSelector.addItem("53"); lbMinuteSelector.addItem("54"); lbMinuteSelector.addItem("55"); lbMinuteSelector.addItem("56"); lbMinuteSelector.addItem("57"); lbMinuteSelector.addItem("58"); lbMinuteSelector.addItem("59"); // Define the number of visible elements lbMinuteSelector.setVisibleItemCount(1); // Define the listbox's size lbMinuteSelector.getElement().getStyle().setWidth(50, Unit.PX); /* This bloc defines th UI, set the Component Draggable and defines width of the contentpanel */ // 1st one HorizontalPanel which horizontally plces the elements HorizontalPanel hpContainer = new HorizontalPanel(); VerticalPanel vpContainer = new VerticalPanel(); setWidgetInVPContainer(lblName); hpContainer.add(lbHourSelector); hpContainer.add(lblHour); hpContainer.add(lbMinuteSelector); hpContainer.add(lblMinute); setWidgetInVPContainer(hpContainer); // RootPanel.get().add(getVPTimerContainer()); // Create change value handler passing index to notify a listbox change for hours lbHourSelector.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Integer iIndex = lbHourSelector.getSelectedIndex(); switch (iIndex) { case 0: setSelectedHour("00"); break; case 1: setSelectedHour("01"); break; case 2: setSelectedHour("02"); break; case 3: setSelectedHour("03"); break; case 4: setSelectedHour("04"); break; case 5: setSelectedHour("05"); break; case 6: setSelectedHour("06"); break; case 7: setSelectedHour("07"); break; case 8: setSelectedHour("08"); break; case 9: setSelectedHour("09"); break; case 10: setSelectedHour("10"); break; case 11: setSelectedHour("11"); break; case 12: setSelectedHour("12"); break; case 13: setSelectedHour("13"); break; case 14: setSelectedHour("14"); break; case 15: setSelectedHour("15"); break; case 16: setSelectedHour("16"); break; case 17: setSelectedHour("17"); break; case 18: setSelectedHour("18"); break; case 19: setSelectedHour("19"); break; case 20: setSelectedHour("20"); break; case 21: setSelectedHour("21"); break; case 22: setSelectedHour("22"); break; case 23: setSelectedHour("23"); break; } setTimePickerValue(); } }); // Create change Value handler passing index to notify a lisbox change for minutes lbMinuteSelector.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { Integer iIndex = lbMinuteSelector.getSelectedIndex(); switch (iIndex) { case 0: setSelectedMinute("00"); break; case 1: setSelectedMinute("01"); break; case 2: setSelectedMinute("02"); break; case 3: setSelectedMinute("03"); break; case 4: setSelectedMinute("04"); break; case 5: setSelectedMinute("05"); break; case 6: setSelectedMinute("06"); break; case 7: setSelectedMinute("07"); break; case 8: setSelectedMinute("08"); break; case 9: setSelectedMinute("09"); break; case 10: setSelectedMinute("10"); break; case 11: setSelectedMinute("11"); break; case 12: setSelectedMinute("12"); break; case 13: setSelectedMinute("13"); break; case 14: setSelectedMinute("14"); break; case 15: setSelectedMinute("15"); break; case 16: setSelectedMinute("16"); break; case 17: setSelectedMinute("17"); break; case 18: setSelectedMinute("18"); break; case 19: setSelectedMinute("19"); break; case 20: setSelectedMinute("20"); break; case 21: setSelectedMinute("21"); break; case 22: setSelectedMinute("22"); break; case 23: setSelectedMinute("23"); break; case 24: setSelectedMinute("24"); break; case 25: setSelectedMinute("25"); break; case 26: setSelectedMinute("26"); break; case 27: setSelectedMinute("27"); break; case 28: setSelectedMinute("28"); break; case 29: setSelectedMinute("29"); break; case 30: setSelectedMinute("30"); break; case 31: setSelectedMinute("31"); break; case 32: setSelectedMinute("32"); break; case 33: setSelectedMinute("33"); break; case 34: setSelectedMinute("34"); break; case 35: setSelectedMinute("35"); break; case 36: setSelectedMinute("36"); break; case 37: setSelectedMinute("37"); break; case 38: setSelectedMinute("38"); break; case 39: setSelectedMinute("39"); break; case 40: setSelectedMinute("40"); break; case 41: setSelectedMinute("41"); break; case 42: setSelectedMinute("42"); break; case 43: setSelectedMinute("43"); break; case 44: setSelectedMinute("44"); break; case 45: setSelectedMinute("45"); break; case 46: setSelectedMinute("46"); break; case 47: setSelectedMinute("47"); break; case 48: setSelectedMinute("48"); break; case 49: setSelectedMinute("49"); break; case 50: setSelectedMinute("50"); break; case 51: setSelectedMinute("51"); break; case 52: setSelectedMinute("52"); break; case 53: setSelectedMinute("53"); break; case 54: setSelectedMinute("54"); break; case 55: setSelectedMinute("55"); break; case 56: setSelectedMinute("56"); break; case 57: setSelectedMinute("57"); break; case 58: setSelectedMinute("58"); break; case 59: setSelectedMinute("59"); break; } setTimePickerValue(); } }); }
/** This is the entry point method. */ public void onModuleLoad() { // init the song final int songLengthInS = 10; final int tempo = 120; final int signatureTop = 4; final int signatureBottom = 4; // ensure the document BODY has dimensions in standards mode RootPanel.get().setPixelSize(800, 600); song = new Song(tempo, songLengthInS, signatureTop, signatureBottom); // song.setLengthInS(songLengthInS); // song.setTempo(tempo); // song.setSignatureTop(signatureTop); // song.setSignatureBottom(signatureBottom); // song.setWidth(trackWidth); song.readyToGo(); Sequencer seq = new Sequencer(song); song.setSequencer(seq); seq.Display(600, 120); MyPickupDragController dragController = new MyPickupDragController(seq.getGridConstrainedDropTarget(), true, song); song.setDragController(dragController); dragController.setBehaviorMultipleSelection(false); dragController.registerDropController(seq.getGcdcNone()); // Make a new list box, adding a few items to it. final ListBox lbQuantize = new ListBox(); lbQuantize.addItem("None"); lbQuantize.addItem("1"); lbQuantize.addItem("1/2"); lbQuantize.addItem("1/4"); lbQuantize.addItem("1/8"); lbQuantize.addItem("1/16"); // Make enough room for all five items (setting this value to 1 turns it // into a drop-down list). lbQuantize.setVisibleItemCount(1); // Add it to the root panel. RootPanel.get().add(lbQuantize, 550, 370); RootPanel.get().add(new Label("Quantize"), 490, 370); lbQuantize.addChangeHandler(new QuantizeChangeHandler(song)); Label lSignature = new Label("Signature : " + song.getSignatureTop() + "/" + song.getSignatureBottom()); RootPanel.get().add(lSignature, 0, 550); Label lTempo = new Label("Tempo : " + song.getTempo()); RootPanel.get().add(lTempo, 0, 570); // Init des samples dans le sample browser final AudioSample sd = new AudioSample("sd", "sounds/SD.mp3", "#FE0101"); sd.loadSample(); final AudioSample bd = new AudioSample("bd", "sounds/BD.mp3", "#FE8800"); bd.loadSample(); final AudioSample hh = new AudioSample("hh", "sounds/HH.mp3", "#FEED00"); hh.loadSample(); final AudioSample p0 = new AudioSample("p0", "sounds/p0.mp3", "#8340A4"); p0.loadSample(); // TODO : automate position bd.setX_orig(80); bd.setY_orig(220); sd.setX_orig(80); sd.setY_orig(260); hh.setX_orig(80); hh.setY_orig(300); p0.setX_orig(80); p0.setY_orig(340); song.getBrowser().addSoundsample(sd); song.getBrowser().addSoundsample(bd); song.getBrowser().addSoundsample(hh); song.getBrowser().addSoundsample(p0); Label lBrowser = new Label("Samples :"); lBrowser.setStyleName("module_title"); Label lBD = new Label("Bass Drum"); Label lSD = new Label("Snare Drum"); Label lHH = new Label("Hi Hat"); Label lp0 = new Label("Piano"); RootPanel.get().add(lBrowser, 0, 180); RootPanel.get().add(lBD, 0, 220); RootPanel.get().add(lSD, 0, 260); RootPanel.get().add(lHH, 0, 300); RootPanel.get().add(lp0, 0, 340); // Ajout des images RootPanel.get().add(bd, bd.getX_orig(), bd.getY_orig()); RootPanel.get().add(sd, sd.getX_orig(), sd.getY_orig()); RootPanel.get().add(hh, hh.getX_orig(), hh.getY_orig()); RootPanel.get().add(p0, p0.getX_orig(), p0.getY_orig()); song.getDragController().makeDraggable(sd); song.getDragController().makeDraggable(bd); song.getDragController().makeDraggable(hh); song.getDragController().makeDraggable(p0); // Useless but might be a good example for a t�te de lecture // work with the customAnimation class // CustomAnimation animation = new CustomAnimation(img.getElement()); // animation.scrollTo(100, 500, 2000); Button b2 = new Button("play !"); b2.setPixelSize(200, 40); b2.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // example of animating an object // movePic(img2); System.out.println("Song play"); System.out.println(song.toString()); song.playSong(); System.out.println("Song played"); } }); RootPanel.get().add(b2, 400, 530); Label lClickTwice = new Label("Please play twice : the 1st time does not work well yet"); lClickTwice.setPixelSize(200, 200); RootPanel.get().add(lClickTwice, 610, 530); }
public WgtGameHeaderInfo() { super(); HorizontalPanel hPanel = new HorizontalPanel(); hPanel.add(new Label("Nom :")); m_name.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> p_event) { GameEngine.model().getGame().setName(m_name.getText()); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); hPanel.add(m_name); m_panel.add(hPanel); m_panel.add(new Label("Description :")); m_description.addValueChangeHandler( new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> p_event) { GameEngine.model().getGame().setDescription(m_description.getText()); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); m_panel.add(m_description); hPanel = new HorizontalPanel(); hPanel.add(new Label("Nombre maxi de joueur :")); m_maxPlayerCount.addItem("2"); m_maxPlayerCount.addItem("3"); m_maxPlayerCount.addItem("4"); m_maxPlayerCount.addItem("5"); m_maxPlayerCount.addItem("6"); m_maxPlayerCount.addItem("7"); m_maxPlayerCount.addItem("8"); m_maxPlayerCount.addItem("9"); m_maxPlayerCount.addItem("10"); m_maxPlayerCount.addItem("11"); m_maxPlayerCount.addItem("12"); m_maxPlayerCount.setVisibleItemCount(1); m_maxPlayerCount.setItemSelected(2, true); m_maxPlayerCount.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent p_event) { GameEngine.model() .getGame() .setMaxNumberOfPlayer(m_maxPlayerCount.getSelectedIndex() + 2); AppRoot.getEventBus().fireEvent(new ModelUpdateEvent(GameEngine.model())); } }); hPanel.add(m_maxPlayerCount); m_panel.add(hPanel); // fill UI onModelUpdate(GameEngine.model()); initWidget(m_panel); // receive all model change AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this); }
public ScheduleEditor(ScheduleDialogType type) { super(); isBlockoutDialog = (type == ScheduleDialogType.BLOCKOUT); startTimePicker = new TimePicker(); setStylePrimaryName("scheduleEditor"); // $NON-NLS-1$ scheduleCombo = createScheduleCombo(); Label l = new Label(MSGS.recurrenceColon()); l.setStyleName(SCHEDULE_LABEL); add(l); add(scheduleCombo); SimplePanel hspacer = new SimplePanel(); hspacer.setWidth("100px"); // $NON-NLS-1$ if (!isBlockoutDialog) { startTimePanel = createStartTimePanel(); add(startTimePanel); } else { // Blockout End TimePicker blockoutEndTimePicker = new TimePicker(); blockoutEndTimePicker.setHour("01"); // $NON-NLS-1$ blockoutEndTimePicker.setMinute("00"); // $NON-NLS-1$ blockoutEndTimePicker.setTimeOfDay(TimeUtil.TimeOfDay.PM); // Blockout End Caption Panel blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE); final String[] daysList = new String[365]; final String[] hoursList = new String[24]; final String[] minutesList = new String[60]; // Populate list for (Integer i = 0; i < 365; i++) { String iStr = i.toString(); daysList[i] = iStr; if (i < 60) { minutesList[i] = iStr; if (i < 24) { hoursList[i] = iStr; } } } // Units of time Drop Down daysListBox = new ListBox(); daysListBox.getElement().setId("daysListBox"); // $NON-NLS-1$ populateListItems(daysListBox, daysList, 0, 365); final Label daysLabel = new Label(MSGS.dayOrDays()); daysLabel.getElement().setAttribute("for", daysListBox.getElement().getId()); // $NON-NLS-1$ hoursListBox = new ListBox(); hoursListBox.getElement().setId("hoursListBox"); // $NON-NLS-1$ populateListItems(hoursListBox, hoursList, 0, 24); final Label hoursLabel = new Label(MSGS.hourOrHours()); hoursLabel.getElement().setAttribute("for", hoursListBox.getElement().getId()); // $NON-NLS-1$ minutesListBox = new ListBox(); minutesListBox.getElement().setId("minutesListBox"); // $NON-NLS-1$ populateListItems(minutesListBox, minutesList, 0, 60); final Label minutesLabel = new Label(MSGS.minuteOrMinutes()); minutesLabel .getElement() .setAttribute("for", minutesListBox.getElement().getId()); // $NON-NLS-1$ final HorizontalPanel durationPanel = new HorizontalPanel(); durationPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); durationPanel.setSpacing(blockoutEndTimePicker.getSpacing()); durationPanel.add(daysListBox); durationPanel.add(daysLabel); durationPanel.add(hoursListBox); durationPanel.add(hoursLabel); durationPanel.add(minutesListBox); durationPanel.add(minutesLabel); // Bind change handler this.scheduleCombo.addChangeHandler( new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String scheduleType = scheduleCombo.getItemText(scheduleCombo.getSelectedIndex()); if (ScheduleType.RUN_ONCE.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 365); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.HOURS.toString().equals(scheduleType)) { hide(true, daysListBox, daysLabel, hoursListBox, hoursLabel); show(true, minutesListBox, minutesLabel); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.DAILY.toString().equals(scheduleType)) { hide(true, daysListBox, daysLabel); show(true, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.WEEKLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 7); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.MONTHLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 28); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } else if (ScheduleType.YEARLY.toString().equals(scheduleType)) { show( true, daysListBox, daysLabel, hoursListBox, hoursLabel, minutesListBox, minutesLabel); populateListItems(daysListBox, daysList, 0, 365); populateListItems(hoursListBox, hoursList, 0, 24); populateListItems(minutesListBox, minutesList, 0, 60); } } }); /* * Radio Buttons for duration */ this.durationRadioButton = new RadioButton("durationRadioGroup", "durationRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$ this.durationRadioButton.setText(MSGS.duration()); this.durationRadioButton.setValue(Boolean.TRUE); this.durationRadioButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { blockoutEndTimePicker.getElement().getStyle().setDisplay(Display.NONE); durationPanel.getElement().getStyle().clearDisplay(); } }); this.endTimeRadioButton = new RadioButton("durationRadioGroup", "endTimeRadioButton"); // $NON-NLS-1$ //$NON-NLS-2$ this.endTimeRadioButton.setText(MSGS.endTime()); this.endTimeRadioButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { blockoutEndTimePicker.getElement().getStyle().clearDisplay(); durationPanel.getElement().getStyle().setDisplay(Display.NONE); } }); // Radio Buttons Panel HorizontalPanel radioButtonsPanel = new HorizontalPanel(); radioButtonsPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); radioButtonsPanel.add(this.durationRadioButton); radioButtonsPanel.add(this.endTimeRadioButton); // Ends Panel VerticalPanel endsPanel = new VerticalPanel(); endsPanel.add(radioButtonsPanel); endsPanel.add(blockoutEndTimePicker); endsPanel.add(durationPanel); // Blockout period CaptionPanel blockoutStartCaptionPanel = new CaptionPanel(MSGS.startTime()); HorizontalPanel blockoutStartPanel = new HorizontalPanel(); blockoutStartPanel.add(getStartTimePicker()); timeZonePicker = new ListBox(); timeZonePicker.setStyleName("timeZonePicker"); timeZonePicker.setVisibleItemCount(1); blockoutStartPanel.add(timeZonePicker); timeZonePicker.getElement().getParentElement().getStyle().setPaddingTop(5, Unit.PX); blockoutStartCaptionPanel.add(blockoutStartPanel); populateTimeZonePicker(); // Ends Caption Panel CaptionPanel endCaptionPanel = new CaptionPanel(MSGS.endsCaptionTitle()); endCaptionPanel.add(endsPanel); VerticalPanel blockoutPanel = new VerticalPanel(); blockoutPanel.setWidth("100%"); // $NON-NLS-1$ blockoutPanel.add(blockoutStartCaptionPanel); blockoutPanel.add(endCaptionPanel); add(blockoutPanel); } VerticalPanel vp = new VerticalPanel(); vp.setWidth("100%"); // $NON-NLS-1$ add(vp); setCellHeight(vp, "100%"); // $NON-NLS-1$ runOnceEditor = new RunOnceEditor(startTimePicker); vp.add(runOnceEditor); scheduleTypeMap.put(ScheduleType.RUN_ONCE, runOnceEditor); runOnceEditor.setVisible(true); recurrenceEditor = new RecurrenceEditor(startTimePicker); vp.add(recurrenceEditor); scheduleTypeMap.put(ScheduleType.SECONDS, recurrenceEditor); scheduleTypeMap.put(ScheduleType.MINUTES, recurrenceEditor); scheduleTypeMap.put(ScheduleType.HOURS, recurrenceEditor); scheduleTypeMap.put(ScheduleType.DAILY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.WEEKLY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.MONTHLY, recurrenceEditor); scheduleTypeMap.put(ScheduleType.YEARLY, recurrenceEditor); recurrenceEditor.setVisible(false); cronEditor = new CronEditor(); scheduleTypeMap.put(ScheduleType.CRON, cronEditor); cronEditor.setVisible(false); if (!isBlockoutDialog) { vp.add(cronEditor); VerticalPanel blockoutButtonPanel = new VerticalPanel(); blockoutButtonPanel.setWidth("100%"); // $NON-NLS-1$ // blockoutButtonPanel.setHeight("30%"); blockoutButtonPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); blockoutButtonPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); // We want to add a button to check for blockout conflicts blockoutCheckButton.setStyleName("pentaho-button"); // $NON-NLS-1$ blockoutCheckButton.getElement().setId("blockout-check-button"); // $NON-NLS-1$ blockoutCheckButton.setVisible(false); hspacer.setHeight("50px"); // $NON-NLS-1$ blockoutButtonPanel.add(hspacer); blockoutButtonPanel.add(blockoutCheckButton); vp.add(hspacer); add(blockoutButtonPanel); } configureOnChangeHandler(); }
private Grid buildDoubleList() { Grid grid = new Grid(2, 5); availableWorkspacesListBox = new ListBox(); availableWorkspacesListBox.setVisibleItemCount(10); availableWorkspacesListBox.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent arg0) { String selectedWorkspaceName = availableWorkspacesListBox.getItemText( availableWorkspacesListBox.getSelectedIndex()); refreshModuleList(selectedWorkspaceName); } }); // availableWorkspaces.setWidth( "30%" ); refreshWorkspaceList(); try { availableModulesListBox.setVisibleItemCount(10); selectedModulesListBox.setVisibleItemCount(10); Grid btnsPanel = new Grid(2, 1); btnsPanel.setWidget( 0, 0, new Button( ">", new ClickHandler() { public void onClick(ClickEvent sender) { copySelected(availableModulesListBox, selectedModulesListBox); } })); btnsPanel.setWidget( 1, 0, new Button( "<", new ClickHandler() { public void onClick(ClickEvent sender) { copySelected(selectedModulesListBox, availableModulesListBox); } })); grid.setWidget(0, 0, new SmallLabel(constants.Workspaces())); grid.setWidget(0, 2, new SmallLabel("Workspace: Available Modules")); grid.setWidget(0, 3, new SmallLabel("")); grid.setWidget(0, 4, new SmallLabel("Workspace: Selected Modules")); grid.setWidget(1, 0, availableWorkspacesListBox); grid.setWidget(1, 2, availableModulesListBox); grid.setWidget(1, 3, btnsPanel); grid.setWidget(1, 4, selectedModulesListBox); grid.getColumnFormatter().setWidth(0, "25%"); grid.getColumnFormatter().setWidth(1, "10%"); grid.getColumnFormatter().setWidth(2, "25%"); grid.getColumnFormatter().setWidth(3, "15%"); grid.getColumnFormatter().setWidth(4, "25%"); return grid; } finally { // sce.setFilteringFacts( filteringFact ); } }
/** @param jobs */ public void initUI(JsArray<JsJob> jobs) { if (jobs != null) { for (int i = 0; i < jobs.length(); i++) { resourceOracle.add(jobs.get(i).getShortResourceName()); } } resourceSuggestBox.setWidth("240px"); userListBox.setWidth("200px"); userListBox.getElement().getStyle().setTextTransform(Style.TextTransform.CAPITALIZE); scheduleStateListBox.setWidth("200px"); scheduleTypeListBox.setWidth("200px"); // next execution filter CaptionPanel executionFilterCaptionPanel = new CaptionPanel(Messages.getString("executionTime")); FlexTable executionFilterPanel = new FlexTable(); executionFilterPanel.setWidget(0, 0, beforeCheckBox); executionFilterPanel.setWidget(0, 1, beforeDateBox); executionFilterPanel.setWidget(1, 0, afterCheckBox); executionFilterPanel.setWidget(1, 1, afterDateBox); executionFilterCaptionPanel.add(executionFilterPanel); afterCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { afterDateBox.setEnabled(event.getValue()); } }); beforeCheckBox.addValueChangeHandler( new ValueChangeHandler<Boolean>() { public void onValueChange(ValueChangeEvent<Boolean> event) { beforeDateBox.setEnabled(event.getValue()); } }); beforeDateBox.setEnabled(beforeCheckBox.getValue()); afterDateBox.setEnabled(afterCheckBox.getValue()); final String showAll = Messages.getString("showAll"); // user filter int selectedIndex = getSelectedIndex(userListBox); userListBox.clear(); userListBox.addItem(showAll); HashSet<String> uniqueUsers = new HashSet<String>(); if (jobs != null) { for (int i = 0; i < jobs.length(); i++) { uniqueUsers.add(jobs.get(i).getUserName()); } } for (String user : uniqueUsers) { userListBox.addItem(user); } userListBox.setSelectedIndex(selectedIndex); // state filter scheduleStateListBox.setVisibleItemCount(1); selectedIndex = getSelectedIndex(scheduleStateListBox); scheduleStateListBox.clear(); // NORMAL, PAUSED, COMPLETE, ERROR, BLOCKED, UNKNOWN scheduleStateListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue()); scheduleStateListBox.addItem(Messages.getString("normal"), ScheduleStateEnum.NORMAL.getValue()); scheduleStateListBox.addItem(Messages.getString("paused"), ScheduleStateEnum.PAUSED.getValue()); scheduleStateListBox.addItem( Messages.getString("complete"), ScheduleStateEnum.COMPLETE.getValue()); scheduleStateListBox.addItem(Messages.getString("error"), ScheduleStateEnum.ERROR.getValue()); scheduleStateListBox.addItem( Messages.getString("blocked"), ScheduleStateEnum.BLOCKED.getValue()); scheduleStateListBox.addItem( Messages.getString("unknown"), ScheduleStateEnum.UNKNOWN.getValue()); scheduleStateListBox.setSelectedIndex(selectedIndex); // state filter scheduleTypeListBox.setVisibleItemCount(1); selectedIndex = getSelectedIndex(scheduleTypeListBox); scheduleTypeListBox.clear(); // DAILY, WEEKLY, MONTHLY, YEARLY scheduleTypeListBox.addItem(showAll, ScheduleStateEnum.SHOWALL.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.daily"), ScheduleTypeEnum.DAILY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.weekly"), ScheduleTypeEnum.WEEKLY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.monthly"), ScheduleTypeEnum.MONTHLY.getValue()); scheduleTypeListBox.addItem( Messages.getString("schedule.yearly"), ScheduleTypeEnum.YEARLY.getValue()); scheduleTypeListBox.setSelectedIndex(selectedIndex); FlexTable filterPanel = new FlexTable(); filterPanel.setWidget(0, 0, new Label(Messages.getString("scheduledResource"))); filterPanel.setWidget(1, 0, resourceSuggestBox); filterPanel.setWidget(2, 0, new Label(Messages.getString("_user"))); filterPanel.setWidget(3, 0, userListBox); filterPanel.setWidget(4, 0, new Label(Messages.getString("scheduleState"))); filterPanel.setWidget(5, 0, scheduleStateListBox); filterPanel.setWidget(6, 0, new Label(Messages.getString("scheduleType"))); filterPanel.setWidget(7, 0, scheduleTypeListBox); filterPanel.setWidget(8, 0, executionFilterCaptionPanel); setContent(filterPanel); }
public EventEditor(final Admin admin, JSEventTemplate et) { this.admin = admin; this.et = et; vpanel.setWidth("100%"); vpanel.setHeight("100%"); final Label errmsg = new Label(); errmsg.addStyleName(errmsg.getStylePrimaryName() + "-error"); errmsg.addStyleName(errmsg.getStylePrimaryName() + "-bottom"); FlexTable grid = new FlexTable(); grid.setWidth("100%"); CellFormatter cf = grid.getCellFormatter(); // right align field labels cf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(1, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(2, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(3, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(4, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(5, 0, HasHorizontalAlignment.ALIGN_RIGHT); cf.setHorizontalAlignment(7, 0, HasHorizontalAlignment.ALIGN_RIGHT); grid.setText(0, 0, "Event Name:"); grid.setText(1, 0, "Raid Size:"); grid.setText(2, 0, "Minimum Level:"); grid.setText(3, 0, "Instance:"); grid.setText(4, 0, "Bosses:"); grid.setText(5, 0, "Roles:"); grid.setText(7, 0, "Badges:"); size.setVisibleLength(2); minlevel.setVisibleLength(2); size.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int sizen = Integer.parseInt(size.getText()); if (sizen < 0) { size.setText("0"); } } catch (NumberFormatException e) { size.setText("25"); } updateRoleTotals(); } }); minlevel.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { try { int minleveln = Integer.parseInt(minlevel.getText()); if (minleveln < 0) { size.setText("0"); } } catch (NumberFormatException e) { size.setText(MAX_LEVEL); } } }); instances.setWidth("100%"); instances.setVisibleItemCount(1); roles.setWidth("100%"); roles.setVisibleItemCount(1); badges.setWidth("100%"); badges.setVisibleItemCount(1); grid.setWidget(0, 1, name); grid.setWidget(1, 1, size); grid.setWidget(2, 1, minlevel); grid.setWidget(3, 1, instances); GoteFarm.goteService.getInstances( admin.current_guild.key, new AsyncCallback<List<JSInstance>>() { public void onSuccess(List<JSInstance> results) { int sel = 0; for (JSInstance i : results) { instances.addItem(i.name, i.key); if (EventEditor.this.et != null && i.key.equals(EventEditor.this.et.instance_key)) { sel = instances.getItemCount() - 1; } } instances.setSelectedIndex(sel); updateBosses(); } public void onFailure(Throwable caught) {} }); instances.addChangeHandler(this); roles.addChangeHandler(this); badges.addChangeHandler(this); grid.setWidget(3, 2, newinst); newinst.setText(NEW_INSTANCE); newinst.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String inst = newinst.getText(); boolean found = false; for (int i = 0; i < instances.getItemCount(); ++i) { if (instances.getItemText(i).equals(inst)) { instances.setSelectedIndex(i); focusBoss(); found = true; break; } } if (!found) { GoteFarm.goteService.addInstance( admin.current_guild.key, inst, new AsyncCallback<JSInstance>() { public void onSuccess(JSInstance result) { instances.addItem(result.name, result.key); instances.setSelectedIndex(instances.getItemCount() - 1); bosses.clear(); focusBoss(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); grid.setWidget(4, 1, bosses); grid.setWidget(4, 2, newboss); bosses.setWidth("100%"); bosses.setVisibleItemCount(10); newboss.setText(NEW_BOSS); newboss.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { int selinst = instances.getSelectedIndex(); if (selinst == -1) { errmsg.setText("You need to select and instance to " + "add a boss."); return; } final String boss = newboss.getText(); boolean found = false; for (int i = 0; i < bosses.getItemCount(); ++i) { if (bosses.getItemText(i).equals(boss)) { bosses.setItemSelected(i, true); focusBoss(); found = true; break; } } if (!found) { GoteFarm.goteService.addBoss( instances.getValue(selinst), boss, new AsyncCallback<JSBoss>() { public void onSuccess(JSBoss result) { bosses.addItem(result.name, result.key); bosses.setItemSelected(bosses.getItemCount() - 1, true); focusBoss(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); grid.setWidget(5, 1, roles); roles.addItem(SELECT_A_ROLE); GoteFarm.goteService.getRoles( admin.current_guild.key, new AsyncCallback<List<JSRole>>() { public void onSuccess(List<JSRole> results) { for (JSRole i : results) { roles.addItem(i.name, i.key); } } public void onFailure(Throwable caught) {} }); grid.setWidget(5, 2, newrole); newrole.setText(NEW_ROLE); newrole.addKeyPressHandler( new KeyPressHandler() { private void focusRole() { newrole.setFocus(true); newrole.setText(NEW_ROLE); newrole.setSelectionRange(0, NEW_ROLE.length()); } public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String role = newrole.getText(); boolean found = false; for (int i = 0; i < roles.getItemCount(); ++i) { if (roles.getItemText(i).equals(role)) { roles.setSelectedIndex(i); addRole(role); focusRole(); found = true; break; } } if (!found) { GoteFarm.goteService.addRole( admin.current_guild.key, role, true, new AsyncCallback<JSRole>() { public void onSuccess(JSRole result) { roles.addItem(role, result.key); roles.setSelectedIndex(roles.getItemCount() - 1); addRole(role); focusRole(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); roleft.setWidth("100%"); roleft.setCellSpacing(0); roleft.setCellPadding(5); roleft.setText(0, 0, "Role"); roleft.setText(0, 1, "Min"); roleft.setText(0, 2, "Max"); roleft.setText(1, 0, "Totals"); FlexTable.FlexCellFormatter rcf = roleft.getFlexCellFormatter(); rcf.addStyleName(0, 0, "header"); rcf.addStyleName(0, 1, "header"); rcf.addStyleName(0, 2, "header"); rcf.addStyleName(0, 3, "header"); rcf.addStyleName(1, 0, "footer"); rcf.addStyleName(1, 1, "footer"); rcf.addStyleName(1, 2, "footer"); rcf.addStyleName(1, 3, "footer"); FlexTable.FlexCellFormatter gcf = grid.getFlexCellFormatter(); grid.setWidget(6, 0, roleft); gcf.setColSpan(6, 0, 3); grid.setWidget(7, 1, badges); badges.addItem(SELECT_A_BADGE); GoteFarm.goteService.getBadges( admin.current_guild.key, new AsyncCallback<List<JSBadge>>() { public void onSuccess(List<JSBadge> results) { for (JSBadge badge : results) { badges.addItem(badge.name, badge.key); } } public void onFailure(Throwable caught) {} }); grid.setWidget(7, 2, newbadge); newbadge.setText(NEW_BADGE); newbadge.addKeyPressHandler( new KeyPressHandler() { private void focusBadge() { newbadge.setFocus(true); newbadge.setText(NEW_BADGE); newbadge.setSelectionRange(0, NEW_BADGE.length()); } public void onKeyPress(KeyPressEvent event) { if (event.getCharCode() == KeyCodes.KEY_ENTER) { final String badge = newbadge.getText(); boolean found = false; for (int i = 0; i < badges.getItemCount(); ++i) { if (badges.getItemText(i).equals(badge)) { addBadge(badge); focusBadge(); found = true; break; } } if (!found) { GoteFarm.goteService.addBadge( admin.current_guild.key, badge, 0, new AsyncCallback<JSBadge>() { public void onSuccess(JSBadge result) { badges.addItem(badge, result.key); badges.setSelectedIndex(badges.getItemCount() - 1); addBadge(badge); focusBadge(); } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } } } }); badgeft.setWidth("100%"); badgeft.setCellSpacing(0); badgeft.setCellPadding(5); badgeft.setText(0, 0, "Badge"); badgeft.setText(0, 1, "Require For Sign Up"); badgeft.setText(0, 2, "Apply To Role"); badgeft.setText(0, 3, "Num Role Slots"); badgeft.setText(0, 4, "Early Signup (Hours)"); FlexTable.FlexCellFormatter bcf = badgeft.getFlexCellFormatter(); bcf.addStyleName(0, 0, "header"); bcf.addStyleName(0, 1, "header"); bcf.addStyleName(0, 2, "header"); bcf.addStyleName(0, 3, "header"); bcf.addStyleName(0, 4, "header"); bcf.addStyleName(0, 5, "header"); grid.setWidget(8, 0, badgeft); gcf.setColSpan(8, 0, 3); vpanel.add(grid); HorizontalPanel hpanel = new HorizontalPanel(); hpanel.setWidth("100%"); final CheckBox modify = new CheckBox("Modify published events (can change signups)"); modify.setValue(true); modify.addStyleName(modify.getStylePrimaryName() + "-bottom"); modify.addStyleName(modify.getStylePrimaryName() + "-left"); Button save = new Button( "Save", new ClickHandler() { public void onClick(ClickEvent event) { // clear error message errmsg.setText(""); final JSEventTemplate t = new JSEventTemplate(); if (EventEditor.this.et != null) { t.key = EventEditor.this.et.key; } else { t.key = null; } t.name = name.getText(); t.size = getRaidSize(); t.minimumLevel = Integer.parseInt(minlevel.getText()); int index = instances.getSelectedIndex(); if (index < 0) { errmsg.setText("Please select an instance for this event."); return; } t.instance_key = instances.getValue(index); t.boss_keys = new ArrayList<String>(); for (int i = 0; i < bosses.getItemCount(); ++i) { if (bosses.isItemSelected(i)) { t.boss_keys.add(bosses.getValue(i)); } } t.roles = new ArrayList<JSEventRole>(); for (int i = 0; i < roleft.getRowCount() - 2; ++i) { JSEventRole er = new JSEventRole(); er.name = roleft.getText(i + 1, 0); er.role_key = getRoleKey(er.name); TextBox minmax; minmax = (TextBox) roleft.getWidget(i + 1, 1); er.min = Integer.parseInt(minmax.getText()); minmax = (TextBox) roleft.getWidget(i + 1, 2); er.max = Integer.parseInt(minmax.getText()); t.roles.add(er); } t.badges = new ArrayList<JSEventBadge>(); for (int i = 0; i < badgeft.getRowCount() - 1; ++i) { JSEventBadge eb = new JSEventBadge(); eb.name = badgeft.getText(i + 1, 0); eb.badge_key = getBadgeKey(eb.name); CheckBox cb = (CheckBox) badgeft.getWidget(i + 1, 1); eb.requireForSignup = cb.getValue(); ListBox lb = (ListBox) badgeft.getWidget(i + 1, 2); String role = lb.getItemText(lb.getSelectedIndex()); if (!role.equals(ALL_ROLES)) { eb.applyToRole = role; } TextBox tb; tb = (TextBox) badgeft.getWidget(i + 1, 3); eb.numSlots = Integer.parseInt(tb.getText()); tb = (TextBox) badgeft.getWidget(i + 1, 4); eb.earlySignup = Integer.parseInt(tb.getText()); t.badges.add(eb); } t.modifyEvents = modify.getValue(); GoteFarm.goteService.saveEventTemplate( admin.current_guild.key, t, new AsyncCallback<JSEventTemplate>() { public void onSuccess(JSEventTemplate result) { EventEditor.this.admin.eventAdded(); EventEditor.this.admin.setCenterWidget(null); if (t.key != null && t.modifyEvents) { admin.fireAdminChange(AdminChange.getEventsChanged()); } } public void onFailure(Throwable caught) { errmsg.setText(caught.getMessage()); } }); } }); save.addStyleName(save.getStylePrimaryName() + "-bottom"); save.addStyleName(save.getStylePrimaryName() + "-left"); Button cancel = new Button( "Cancel", new ClickHandler() { public void onClick(ClickEvent event) { EventEditor.this.admin.setCenterWidget(null); } }); cancel.addStyleName(cancel.getStylePrimaryName() + "-bottom"); cancel.addStyleName(cancel.getStylePrimaryName() + "-right"); hpanel.add(save); // Editing an existing event? if (EventEditor.this.et != null) { hpanel.add(modify); } hpanel.add(errmsg); hpanel.add(cancel); vpanel.add(hpanel); if (et != null) { for (JSEventRole ev : et.roles) { addRole(ev.name, ev.min, ev.max); } for (JSEventBadge eb : et.badges) { addBadge(eb.name, eb.requireForSignup, eb.applyToRole, eb.numSlots, eb.earlySignup); } } if (et == null) { name.setText(NEW_EVENT); DeferredCommand.addCommand( new Command() { public void execute() { name.setFocus(true); name.setSelectionRange(0, NEW_EVENT.length()); } }); size.setText("25"); minlevel.setText(MAX_LEVEL); } else { name.setText(et.name); size.setText("" + et.size); minlevel.setText("" + et.minimumLevel); } updateRoleTotals(); initWidget(vpanel); setStyleName("Admin-EventEditor"); }