/** * Create a slider bar. * * @param minValue the minimum value in the range * @param maxValue the maximum value in the range * @param labelFormatter the label formatter * @param images the images to use for the slider */ public SliderBar(double minValue, double maxValue, LabelFormatter labelFormatter) { super(); resources.sliderBarCss().ensureInjected(); this.minValue = minValue; this.maxValue = maxValue; setLabelFormatter(labelFormatter); // Create the outer shell DOM.setStyleAttribute(getElement(), "position", "relative"); // $NON-NLS-1$ //$NON-NLS-2$ setStyleName("gwt-SliderBar-shell"); // $NON-NLS-1$ // Create the line lineElement = DOM.createDiv(); DOM.appendChild(getElement(), lineElement); DOM.setStyleAttribute(lineElement, "position", "absolute"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setElementProperty( lineElement, "className", "gwt-SliderBar-line"); // $NON-NLS-1$ //$NON-NLS-2$ // Create the knob knobImage.setResource(resources.slider()); Element knobElement = knobImage.getElement(); DOM.appendChild(getElement(), knobElement); DOM.setStyleAttribute(knobElement, "position", "absolute"); // $NON-NLS-1$ //$NON-NLS-2$ DOM.setElementProperty( knobElement, "className", "gwt-SliderBar-knob"); // $NON-NLS-1$ //$NON-NLS-2$ sinkEvents(Event.MOUSEEVENTS | Event.KEYEVENTS | Event.FOCUSEVENTS); }
private Widget getSetterLabel() { HorizontalPanel horiz = new HorizontalPanel(); if (model.state == ActionCallMethod.TYPE_UNDEFINED) { Image edit = DroolsGuvnorImages.INSTANCE.AddFieldToFact(); edit.setAltText(Constants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.setTitle(Constants.INSTANCE.AddAnotherFieldToThisSoYouCanSetItsValue()); edit.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { Widget w = (Widget) event.getSource(); showAddFieldPopup(w); } }); horiz.add( new SmallLabel( HumanReadable.getActionDisplayName("call") + " [" + model.variable + "]")); // NON-NLS if (!this.readOnly) { horiz.add(edit); } } else { horiz.add( new SmallLabel( HumanReadable.getActionDisplayName("call") + " [" + model.variable + "." + model.methodName + "]")); // NON-NLS } return horiz; }
@Test public void checkVisible() { Image i = new Image(); Assert.assertEquals(true, i.isVisible()); i.setVisible(false); Assert.assertEquals(false, i.isVisible()); }
private void setBallPosition(TileIndex index) { GridPosition position = m_tileManager.getGridPosition(index); int x = position.getLeft() + (m_tileManager.getGridElementWidth() - m_ball.getWidth()) / 2; int y = position.getTop() + (m_tileManager.getGridElementHeight() + m_ball.getHeight()) / 2; setWidgetTopHeight(m_ball, y, Unit.PX, m_ball.getHeight(), Unit.PX); setWidgetLeftWidth(m_ball, x, Unit.PX, m_ball.getWidth(), Unit.PX); }
private void addToolbar(Element el, boolean isSetupChunk, AceEditorNative editor) { FlowPanel toolbarPanel = new FlowPanel(); toolbarPanel.addStyleName(ThemeStyles.INSTANCE.inlineChunkToolbar()); boolean isDark = themes_.isDark(themes_.getEffectiveThemeName(uiPrefs_.theme().getValue())); if (isSetupChunk) { Image optionsIcon = createOptionsIcon(isDark, true); toolbarPanel.add(optionsIcon); } else { Image optionsIcon = createOptionsIcon(isDark, false); optionsIcon.getElement().getStyle().setMarginRight(9, Unit.PX); toolbarPanel.add(optionsIcon); // Note that 'run current chunk' currently only operates within Rmd if (editor.getSession().getMode().getId().equals("mode/rmarkdown")) { Image runPreviousIcon = createRunPreviousIcon(isDark); runPreviousIcon.getElement().getStyle().setMarginRight(8, Unit.PX); toolbarPanel.add(runPreviousIcon); Image runIcon = createRunIcon(); toolbarPanel.add(runIcon); } } display(toolbarPanel, el); }
private void addAssignmentRow(final Assignment assignment, int insertrow) { int j = 0; int row = (insertrow <= assignmentsTable.getRowCount()) ? assignmentsTable.insertRow(insertrow) : insertrow; Image delIcon = getDeleteIcon(assignment); // assignment assignmentsTable.setWidget(row, j++, delIcon); Image icon = new Image(); icon.setUrl(getIconFile(assignment.getIconFileName())); assignmentsTable.setWidget(row, j++, icon); assignmentsTable.setWidget(row, j++, new Label(assignment.getToolName())); final TextBox textForSolvedAssignment = getHintTextBox(assignment, Result.CORRECT); assignmentsTable.setWidget(row, j++, textForSolvedAssignment); final ListBox fractions = getFractionsLB(assignment, Result.CORRECT); assignmentsTable.setWidget(row, j++, fractions); Image editIcon = new Image(GuiResources.INSTANCE.menu_icon_edit()); editIcon.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { handleEditClick(assignment); } }); assignmentsTable.setWidget(row, j++, editIcon); }
private Image createRunIcon() { Image icon = new Image(ThemeResources.INSTANCE.runChunk()); icon.addStyleName(ThemeStyles.INSTANCE.highlightIcon()); icon.setTitle(commands_.executeCurrentChunk().getTooltip()); bindNativeClickToExecuteChunk(this, icon.getElement()); return icon; }
public SimpleComposite() { label = new Label(); img = new Image("img/logo.PNG"); img.getElement().setId("pc-template-img"); // The wrapper panel FlowPanel panel = new FlowPanel(); panel.getElement().setClassName("composite"); panel.add(img); panel.add(label); // All composites must call initWidget() in their constructors. initWidget(panel); // Add mouse move handler to the image img.addMouseMoveHandler( new MouseMoveHandler() { public void onMouseMove(MouseMoveEvent event) { label.setText("mouse moved on picture !"); } }); }
/** Wraps a RuleModellerWidget with an icon to delete the pattern */ private Widget wrapLHSWidget(final CompositeFactPattern model, int i, RuleModellerWidget w) { DirtyableHorizontalPane horiz = new DirtyableHorizontalPane(); final Image remove = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall(); remove.setTitle( Constants.INSTANCE.RemoveThisENTIREConditionAndAllTheFieldConstraintsThatBelongToIt()); final int idx = i; remove.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (Window.confirm(Constants.INSTANCE.RemoveThisEntireConditionQ())) { if (pattern.removeFactPattern(idx)) { getModeller().refreshWidget(); } } } }); horiz.setWidth("100%"); w.setWidth("100%"); horiz.add(w); if (!(getModeller().lockLHS() || w.isReadOnly())) { horiz.add(remove); } return horiz; }
public static String getImageURL(int mode, AppW app) { // String modeText = app.getKernel().getModeText(mode); // // bugfix for Turkish locale added Locale.US // String iconName = "mode_" +StringUtil.toLowerCase(modeText) // + "_32"; // // macro if (mode >= EuclidianConstants.MACRO_MODE_ID_OFFSET) { int macroID = mode - EuclidianConstants.MACRO_MODE_ID_OFFSET; try { Macro macro = app.getKernel().getMacro(macroID); String iconName = macro.getIconFileName(); if (iconName == null || iconName.length() == 0) { // default icon return safeURI(myIconResourceBundle.mode_tool_32()); } // use image as icon Image img = new NoDragImage(app.getImageManager().getExternalImageSrc(iconName), 32); return img.getUrl(); } catch (Exception e) { App.debug("macro does not exist: ID = " + macroID); return ""; } } return safeURI(getImageURLNotMacro(mode)); }
public void showFile(FileSystemItem file, String commitId, String contents) { commitId_ = commitId; targetFile_ = file; docDisplay_.setCode(contents, false); adaptToFileType(fileTypeRegistry_.getTextTypeForFile(file)); // header widget has icon + label HorizontalPanel panel = new HorizontalPanel(); Image imgFile = new Image(fileTypeRegistry_.getIconForFile(file)); imgFile.addStyleName(RES.styles().captionIcon()); panel.add(imgFile); Label lblCaption = new Label(file.getPath() + " @ " + commitId); lblCaption.addStyleName(RES.styles().captionLabel()); panel.add(lblCaption); popupPanel_ = new FullscreenPopupPanel(panel, asWidget(), false); popupPanel_.center(); // set focus to the doc display after 100ms Timer timer = new Timer() { public void run() { docDisplay_.focus(); } }; timer.schedule(100); }
public DeviceUc(SimplePanel wrapperPanel, HeaderUc headerUc) { initWidget(uiBinder.createAndBindUi(this)); this.headerUc = headerUc; this.wrapperPanel = wrapperPanel; androidSectiondiv.getElement().setId("pnlAndroidSectiondiv"); ipadSectiondiv.getElement().setId("pnlIpadSectiondiv"); msglinkPanel.getElement().setId("pnlMsglinkPanel"); msgPanel.getElement().setId("pnlMsgPanel"); closeAndriodBtn.getElement().setId("imgCloseAndriodBtn"); closeIpadBtn.getElement().setId("imgCloseIpadBtn"); gooruPanel.getElement().setId("pnlGooruPanel"); ednovoPanel.getElement().setId("pnlEdnovoPanel"); appstorePanel.getElement().setId("pnlAppstorePanel"); viewAnchor.getElement().setId("lnkViewAnchor"); setUiText(); if (isIpad && !StringUtil.IPAD_MESSAGE_Close_Click) { ipadSectiondiv.setVisible(true); androidSectiondiv.setVisible(false); ipadSectiondiv.getElement().setAttribute("style", "margin-top:-20px;"); wrapperPanel.getElement().setAttribute("style", "margin-top:0px;"); headerUc.getElement().getFirstChildElement().setAttribute("style", "position:relative;"); } else if (isAndriod && !StringUtil.IPAD_MESSAGE_Close_Click) { ipadSectiondiv.setVisible(false); androidSectiondiv.setVisible(true); androidSectiondiv.getElement().setAttribute("style", "margin-top:-20px;"); wrapperPanel.getElement().setAttribute("style", "margin-top:0px;"); headerUc.getElement().getFirstChildElement().setAttribute("style", "position:relative;"); } }
public void onSuccess(List<PacketUserData> result) { clear(); add(html); HorizontalPanel horizontalPanel = new HorizontalPanel(); for (PacketUserData data : result) { final VerticalPanel panel = new VerticalPanel(); panel.setHorizontalAlignment(ALIGN_CENTER); final Image image = new Image(Constant.ICON_URL_PREFIX + data.imageFileName); image.setPixelSize(Constant.ICON_SIZE_BIG, Constant.ICON_SIZE_BIG); panel.add(image); final Label label = new Label(data.playerName); panel.add(label); horizontalPanel.add(panel); if (horizontalPanel.getWidgetCount() == 8) { add(horizontalPanel); horizontalPanel = new HorizontalPanel(); } } if (horizontalPanel.getWidgetCount() != 0) { add(horizontalPanel); } }
public PlaceBookEntryPreview(final Entry entry) { initWidget(uiBinder.createAndBindUi(this)); container .getElement() .getStyle() .setBackgroundImage( "url(" + Resources.IMAGES.placebook_open().getSafeUri().asString() + ")"); title.setText(entry.getTitle()); description.setText(entry.getDescription()); author.setText(entry.getOwnerName()); if (entry.getPreviewImage() != null) { image.setUrl( PlaceBooks.getServer().getHostURL() + "media?hash=" + entry.getPreviewImage() + "&type=imageitem"); } else { image.setVisible(false); } container.addDomHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { PlaceBooks.goTo(new PlaceBookPage(entry.getKey())); } }, ClickEvent.getType()); }
public PreloaderCallback getPreloaderCallback() { final Panel preloaderPanel = new VerticalPanel(); preloaderPanel.setStyleName("gdx-preloader"); final Image logo = new Image(GWT.getModuleBaseURL() + "logo.png"); logo.setStyleName("logo"); preloaderPanel.add(logo); final Panel meterPanel = new SimplePanel(); meterPanel.setStyleName("gdx-meter"); meterPanel.addStyleName("red"); final InlineHTML meter = new InlineHTML(); final Style meterStyle = meter.getElement().getStyle(); meterStyle.setWidth(0, Unit.PCT); meterPanel.add(meter); preloaderPanel.add(meterPanel); getRootPanel().add(preloaderPanel); return new PreloaderCallback() { @Override public void error(String file) { System.out.println("error: " + file); } @Override public void update(PreloaderState state) { meterStyle.setWidth(100f * state.getProgress(), Unit.PCT); } }; }
private void setIconImage() { if (expanded) { icon.setResource(images.collapse()); } else { icon.setResource(images.expand()); } }
private void addImageAndTitle(HorizontalPanel hp, GWTAppProperties properties) { Image logo = new Image(properties.getHeaderLogo()); logo.setStyleName("square-header-LogoImage"); logo.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { // when you click on the image, go to the home page. History.newItem(ChooseCasePilot.generateNavigationId(ChooseCasePilot.PageId.home)); } }); logo.setPixelSize(50, 50); hp.add(logo); VerticalPanel titleVerticalPane = new VerticalPanel(); titleVerticalPane.setSize("100%", "100%"); Label title = new Label(properties.getHeaderTitle1()); Label subTitle = new Label(properties.getHeaderTitle2()); title.setStyleName("square-headerpane-title"); subTitle.setStyleName("square-headerpane-tagline"); titleVerticalPane.add(title); titleVerticalPane.add(subTitle); hp.add(titleVerticalPane); }
@Override protected void onAttach() { super.onAttach(); Image img = new Image( getBaseImageUrl() + "?merchant_id=" + getMerchantId() + "&w=" + getWidth() + "&h=" + getHeight() + "&style=" + getStyle() + "&variant=" + getVariant() + "&loc=" + getLoc()); img.setTitle("Fast checkout through Google"); PushButton pb = new PushButton(img); pb.addClickHandler(this); vpanel.clear(); vpanel.add(pb); }
/** * @function setLabelsAndIds * @created_date : Jan 2, 2014 * @description To set Labels and Id for buttons. * @parm(s) : * @return : void * @throws : <Mentioned if any exceptions> */ private void setLabelsAndIds() { btnResourceLink.setText(i18n.GL0548()); btnResourceLink.getElement().setId("btnResourceLink"); btnResourceLink.getElement().setAttribute("alt", i18n.GL0548()); btnResourceLink.getElement().setAttribute("title", i18n.GL0548()); lblGooruFieldTrip.setText(i18n.GL0549()); lblGooruFieldTrip.getElement().setId("lblGooruFieldTrip"); lblGooruFieldTrip.getElement().setAttribute("alt", i18n.GL0549()); lblGooruFieldTrip.getElement().setAttribute("title", i18n.GL0549()); // lblGooruFieldTripDescUnforseen.setText(i18n.GL0550); // lblGooruFieldTripDescOriginal.setText(i18n.GL0552); lblGooruFieldTripDescOriginal.setText(""); lblGooruFieldTripDescOriginal.getElement().setId("lblGooruFieldTripDescOriginal"); lblGooruFieldTripDescOriginal.getElement().setAttribute("alt", ""); lblGooruFieldTripDescOriginal.getElement().setAttribute("title", ""); lblDontForget.setText(i18n.GL0551()); lblDontForget.getElement().setId("lblDontForget"); lblDontForget.getElement().setAttribute("alt", i18n.GL0551()); lblDontForget.getElement().setAttribute("title", i18n.GL0551()); imgFieldTrip.getElement().setId("imgFieldTrip"); imgFieldTrip.setUrl("images/framebraker/field-trip.png"); resoruceFrameBrakerContainer.getElement().setId("fpnlResoruceFrameBrakerContainer"); resourceCategory.getElement().setId("pnlResourceCategory"); lblGooruFieldTripDescUnforseen.getElement().setId("lblGooruFieldTripDescUnforseen"); supportTip.getElement().setId("lblSupportTip"); // learnMoreLbl.setText("Learn more."); }
private void turnNameFieldIntoLabel() { String name = patternNameField.getText(); if (name.equalsIgnoreCase(DEFAULT_PATTERN_NAME)) { name = ""; } arrowImage.setVisible(true); patternNameField.setVisible(false); if (name.equals("")) { GWTServiceLookup.getSearchService().deleteSavedSearch(currentSearchId, blackHoleCallback); currentSearchId = 0; starImage.setUrl(STAR_OFF_URL); } else { // NOTE: currently do not support updated a saved search pattern if (currentSearchId == 0) { String pattern = autoCompletePatternField.getText(); createSavedSearch(name, pattern); } else { updateSavedSearchName(currentSearchId, name); } patternNameLabel.setText(elipse(name)); patternNameLabel.setVisible(true); starImage.setUrl(STAR_ON_URL); } }
@UiHandler("categoryImage") public void setDefaultImage(ErrorEvent event) { if (category.equalsIgnoreCase("collection")) { categoryImage.setUrl(DEFULT_IMAGE); } else if (category.equalsIgnoreCase("video")) { categoryImage.setUrl(DEFULT_VIMAGE); } else if (category.equalsIgnoreCase("question")) { categoryImage.setUrl(DEFULT_QIMAGE); } else if (category.equalsIgnoreCase("interactive")) { categoryImage.setUrl(DEFULT_IIMAGE); } else if (category.equalsIgnoreCase("website") || category.equalsIgnoreCase("exam") || category.equalsIgnoreCase("webpage")) { categoryImage.setUrl(DEFULT_WIMAGE); } else if (category.equalsIgnoreCase("slide") || category.equalsIgnoreCase("image")) { categoryImage.setUrl(DEFULT_ITYPEIMAGE); } else if (category.equalsIgnoreCase("textbook") || category.equalsIgnoreCase("handout") || category.equalsIgnoreCase("lesson") || category.equalsIgnoreCase("text")) { categoryImage.setUrl(DEFULT_TEXTIMAGE); } else if (category.equalsIgnoreCase("audio")) { categoryImage.setUrl(DEFULT_AIMAGE); } else if (category.equalsIgnoreCase("other")) { categoryImage.setUrl(DEFULT_OIMAGE); } else if (category.equalsIgnoreCase("profile")) { categoryImage.setUrl(DEFAULT_PROFILEIMAGE); } }
private HorizontalPanel getConceptBrowseButton() { destConcept = new LabelAOS("--None--", null); browse = new Image("images/browseButton3-grey.gif"); browse.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { destConcept.setText("--None--"); final ConceptBrowser cb = ((MainApp) RootPanel.get().getWidget(0)).conceptBrowser; cb.showBrowser(); cb.addSubmitClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { destConcept.setValue(cb.getSelectedItem(), cb.getTreeObject().getUri()); } }); } }); browse.setStyleName(Style.Link); HorizontalPanel hp = new HorizontalPanel(); hp.add(new HTML(constants.conceptDestination())); hp.add(destConcept); hp.add(browse); hp.setWidth("100%"); hp.setCellHorizontalAlignment(destConcept, HasHorizontalAlignment.ALIGN_LEFT); hp.setCellHorizontalAlignment(browse, HasHorizontalAlignment.ALIGN_RIGHT); return hp; }
private void addFileUploadWidget() { final FileUpload upload = new FileUpload(); upload.setWidth("200px"); upload.setName(getUniqueId()); uploadForms.add(upload); final HorizontalPanel hPanel = new HorizontalPanel(); hPanel.setHeight("30px"); hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); // Don't display ability to remove form if expecting exactly 1 upload or if this is the first // upload element if (isMultiple() && uploadForms.size() > 1) { com.google.gwt.user.client.ui.Image crossImage = new com.google.gwt.user.client.ui.Image(); crossImage.setUrl(Resources.CROSS); crossImage.addClickHandler( new com.google.gwt.event.dom.client.ClickHandler() { public void onClick(final com.google.gwt.event.dom.client.ClickEvent clickEvent) { panel.remove(hPanel); uploadForms.remove(hPanel.getWidget(1)); } }); hPanel.add(crossImage); } else { com.google.gwt.user.client.ui.VerticalPanel space = new com.google.gwt.user.client.ui.VerticalPanel(); space.setSize("16px", "1px"); hPanel.add(space); } hPanel.add(upload); panel.add(hPanel); if (get() != null) { get().markForRedraw(); } }
public static void scaleImage(AbsolutePanel container, Image image, Dimension area) { float blockRatio = (float) area.width / (float) area.height; int imgHeight = image.getHeight(); int imgWidth = image.getWidth(); float imgRatio = (float) imgWidth / (float) imgHeight; int resultWidth = 0; int resultHeight = 0; if (blockRatio > imgRatio) { resultWidth = area.width; resultHeight = (int) ((float) imgHeight * ((float) resultWidth / (float) imgWidth)); } else { resultHeight = area.height; resultWidth = (int) ((float) imgWidth * ((float) resultHeight / (float) imgHeight)); } image.setPixelSize(resultWidth, resultHeight); int xOffset = 0; int yOffset = 0; if (resultWidth > area.width) { xOffset = (resultWidth - area.width) / 2; } if (resultHeight > area.height) { yOffset = (resultHeight - area.height) / 2; } container.setWidgetPosition(image, -xOffset, -yOffset); }
private Widget addPopupMenu( final MenuLabel menuLabel, final MenuSource menuSource, boolean left) { final Widget label = menuLabel.asWidget(); label.setStylePrimaryName("rstudio-StrongLabel"); label.getElement().getStyle().setCursor(Style.Cursor.DEFAULT); label.getElement().getStyle().setOverflow(Overflow.HIDDEN); if (left) addLeftWidget(label); else addRightWidget(label); Image image = new Image(ThemeResources.INSTANCE.menuDownArrow()); image.getElement().getStyle().setMarginLeft(5, Unit.PX); image.getElement().getStyle().setMarginRight(8, Unit.PX); image.getElement().getStyle().setMarginBottom(2, Unit.PX); if (left) addLeftWidget(image); else addRightWidget(image); final ClickHandler clickHandler = new ClickHandler() { public void onClick(ClickEvent event) { ToolbarPopupMenu menu = menuSource.getMenu(); menu.showRelativeTo(label); menu.getElement().getStyle().setPaddingTop(3, Style.Unit.PX); } }; menuLabel.addClickHandler(clickHandler); image.addClickHandler(clickHandler); return image; }
@UiHandler("resourceThumbnail") public void onErrorResourceImage(ErrorEvent errorEvent) { resourceThumbnail.setUrl("images/resource_trans.png"); if (collectionItemDo.getResource().getResourceFormat() != null) { String resourceType = collectionItemDo.getResource().getResourceFormat().getDisplayName(); resourceType = resourceType.toLowerCase(); if (resourceType.equalsIgnoreCase("lesson") || resourceType.equalsIgnoreCase("textbook") || resourceType.equalsIgnoreCase("handout")) { resourceType = resourceType .replaceAll("lesson", "text") .replaceAll("textbook", "text") .replaceAll("handout", "text"); } if (resourceType.equalsIgnoreCase("slide")) { resourceType = resourceType.replaceAll("slide", "image"); } if (resourceType.equalsIgnoreCase("exam") || resourceType.equalsIgnoreCase("website") || resourceType.equalsIgnoreCase("challenge")) { resourceType = resourceType .replaceAll("exam", "webpage") .replaceAll("website", "webpage") .replaceAll("challenge", "webpage"); } resourceThumbnail.setStyleName(getResourceDefaultImage(resourceType)); } }
/** * Utility method to create anchor tags * * @param image Image * @param relValue anchor "rel" attribute value * @return anchorElement Element */ private Element createAnchor(Image image, String relValue) { Element anchorElement = DOM.createAnchor(); DOM.setAttribute(anchorElement, "rel", relValue); DOM.setAttribute(anchorElement, "href", image.getUrl()); DOM.setAttribute(anchorElement, "title", image.getTitle()); DOM.appendChild(anchorElement, image.getElement()); return anchorElement; }
@Override public void withLogo(ImageResource resource) { final Image logo = new Image(resource); logo.getElement().getStyle().setMarginTop(-18, Style.Unit.PX); logo.getElement().getStyle().setMarginBottom(-18, Style.Unit.PX); logo.setStyleName(Styles.IMG_RESPONSIVE); root.appendChild(logo.getElement()); }
public CourseSelectorWidget() { courseHorizontalPanel = new HorizontalPanel(); courseVerticalPanel = new VerticalPanel(); courseHorizontalPanel.add(courseVerticalPanel); courseHorizontalPanel.setStyleName("courseSelectorPanel"); courseSelectLabel = new Label(); courseSelectLabel.setStyleName("courseSelectLabel"); HorizontalPanel courseInputPanel = new HorizontalPanel(); courseLabel = new Label(constants.course() + ": "); courseListBox = new ListBox(); courseListBox.insertItem("<" + constants.select() + ">", 0); courseInputPanel.add(courseLabel); courseInputPanel.add(courseListBox); tariffInputPanel = new HorizontalPanel(); tariffLabel = new Label(constants.tariff() + ": "); tariffListBox = new ListBox(); tariffListBox.insertItem("<" + constants.select() + ">", 0); tariffInputPanel.add(tariffLabel); tariffInputPanel.add(tariffListBox); HorizontalPanel gradeInputPanel = new HorizontalPanel(); gradeLabel = new Label(constants.grade() + ": "); gradeListBox = new ListBox(); gradeListBox.insertItem("<" + constants.select() + ">", 0); gradeInputPanel.add(gradeLabel); gradeInputPanel.add(gradeListBox); deleteButton = new Image("/imgs/Symbol_Delete.png"); deleteButton.setStyleName("clickable"); deleteButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { courseSelectorWrapper.remove(index - 1); int j = 0; for (int i = 0; i < 15; i++) { if (!courseList.get(i).getCourseSelector().isAttached()) { courseList.get(i).resetSelector(); } else { courseList.get(i).setCourseLabel(j + 1); j++; } } } }); courseVerticalPanel.add(courseSelectLabel); courseVerticalPanel.add(courseInputPanel); courseVerticalPanel.add(tariffInputPanel); courseVerticalPanel.add(gradeInputPanel); courseHorizontalPanel.add(deleteButton); }
public void setData(String[] data) { final int baseName = 12; final int basePrice = baseName + Constants.NO_OF_EXTRAS_IN_UI; final int basePriceValue = basePrice + Constants.NO_OF_EXTRAS_IN_UI; tbKeyId.setText(data[0]); String imageKey = data[1]; if (imageKey != null) { imgItem.setUrl(GWT.getHostPageBaseURL() + "serveBlob?id=" + data[1]); imgItem.setVisible(true); } tbName.setText(data[2]); taDescription.setText(data[3]); editingExistingData = true; if (data[4] != null) { rbSinglePrice.setValue(true); rbSinglePrice.setFormValue("single"); dbSinglePrice.setValue(Double.parseDouble(data[basePriceValue])); } else { rbMultiplePrice.setValue(true); rbMultiplePrice.setFormValue("multiple"); if (data[5] != null) { cbSmall.setValue(true); dbSmallPrice.setValue(Double.parseDouble(data[basePriceValue + 1])); } if (data[6] != null) { cbMedium.setValue(true); dbMediumPrice.setValue(Double.parseDouble(data[basePriceValue + 2])); } if (data[7] != null) { cbLarge.setValue(true); dbLargePrice.setValue(Double.parseDouble(data[basePriceValue + 3])); } if (data[8] != null) { cbTapa.setValue(true); dbTapaPrice.setValue(Double.parseDouble(data[basePriceValue + 4])); } if (data[9] != null) { cbHalf.setValue(true); dbHalfPrice.setValue(Double.parseDouble(data[basePriceValue + 5])); } if (data[10] != null) { cbFull.setValue(true); dbFullPrice.setValue(Double.parseDouble(data[basePriceValue + 6])); } } if (data[11] != null) { tbExtrasName.setText(data[11]); } for (int i = 0; i < Constants.NO_OF_EXTRAS_IN_UI; i++) { String name = data[baseName + i]; if (name != null) { tbExtras[i].setText(name); tbExtrasPrices[i].setText(data[basePrice + i]); } } }