com.smartgwt.client.widgets.Img Java Examples

The following examples show how to use com.smartgwt.client.widgets.Img. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public TopPanel() {
	setBackgroundImage(Session.get().getInfo().getBranding().getBannerSrc());
	setBackgroundRepeat(BackgroundRepeat.REPEAT_X);
	setBackgroundPosition("top left");
	setWidth100();
	setHeight(45);

	// Prepare the logo image to be shown inside the banner
	Img logoImage = ItemFactory.newBrandImg("logo_head.png", Session.get().getInfo());
	logoImage.setStyleName("logo_head");
	logoImage.setWidth(205);
	logoImage.setHeight(40);
	addMember(logoImage);

	Img separator = ItemFactory.newImg("blank.png");
	separator.setWidth100();
	addMember(separator);
	
	// Prepare the OEM logo image to be shown inside the banner
	Img logoOemImage = ItemFactory.newBrandImg("logo_head_oem.png", Session.get().getInfo());
	logoOemImage.setStyleName("logo_head_oem");
	logoOemImage.setWidth(205);
	logoOemImage.setHeight(40);
	addMember(logoOemImage);
}
 
Example #2
Source File: Header.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private Layout getHomeLabel() {
	Layout layout = new VLayout();
	layout.setStyleName("n52_sensorweb_client_logoBlock");
	Img homeLabel = new Img("../img/client-logo.png", 289, 55);
	homeLabel.setStyleName("n52_sensorweb_client_logo");
	homeLabel.setCursor(Cursor.POINTER);
       homeLabel.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			String url = "http://52north.org/communities/sensorweb/";
               Window.open(url, "_blank", "");
		}
       });
       layout.addMember(homeLabel);
	return layout;
}
 
Example #3
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
         * Shows a resource as the {@code <img>} element.
         */
        public void loadImage(String url) {
            ClientUtils.setMembers(display, imgContainer);
            image = new Image();
            image.addLoadHandler(this);
            image.addErrorHandler(this);
            image.setUrl(url);
            drawHandler = imgContainer.addDrawHandler(this);
            resizedHandler = imgContainer.addResizedHandler(this);
            ClientUtils.fine(LOG, "loadImage url: %s, width: %s", url, image.getWidth());
            if (image.getWidth() == 0) {
                WidgetCanvas widgetCanvas = new WidgetCanvas(image);
                widgetCanvas.setVisible(false);
                widgetCanvas.setWidth(1);
                widgetCanvas.setHeight(1);
                widgetCanvas.draw();
                Img loadingImg = new Img("[SKIN]/loadingSmall.gif", 16, 16);
//                Img loadingImg = new Img("[SKIN]/shared/progressCursorTracker.gif", 16, 16);
                loadingImg.setAltText(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setPrompt(i18n.ImportBatchDataSource_State_LOADING());
                loadingImg.setLayoutAlign(Alignment.CENTER);
                imgContainer.setMembers(loadingImg, widgetCanvas);
            }
            scheduleForRender();
        }
 
Example #4
Source File: RepeatableForm.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
RepeatableForm(RepeatableFormItem item) {
        this.formItem = item;
        setAutoHeight();
        this.formFactory = item.getFormFactory();
        if (formItem.getMaxOccurrences() > 1 || formItem.getTitle() != null) {
            setGroupTitle(formItem.getTitle());
            setIsGroup(true);
            setLayoutTopMargin(6);
            setLayoutLeftMargin(4);
        }
        if (formItem.isAutoWidth()) {
            setAutoWidth();
        } else if (formItem.isWidth100()) {
            setWidth100();
        } else {
            setWidth(formItem.getWidthAsString());
        }

        formError = new Img("[SKIN]/actions/exclamation.png", 16, 16);
        formError.setHoverWidth(item.getHoverWidth());
        formError.setVisible(false);
        addMember(formError);
//        ClientUtils.info(LOG, "init.RForm, name: %s, autoWidth: %s, width100: %s, width: %s",
//                formItem.getName(), formItem.isAutoWidth(), formItem.isWidth100(), formItem.getWidthAsString());
    }
 
Example #5
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private void createDeleteLegendEntryButton() {
	this.deleteButton = new SmallButton(new Img("../img/icons/del.png"),
			i18n.delete(), i18n.deleteExtended());
	this.deleteButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent evt) {
			if (SOSController.isDeletingTS) {
				Toaster.getToasterInstance().addMessage(i18n.deleteTimeSeriesActiv());
			} else {
				SOSController.isDeletingTS = true;
				LegendEntryTimeSeries.this.getEventBroker().unregister();
				EventBus.getMainEventBus().fireEvent(
						new DeleteTimeSeriesEvent(LegendEntryTimeSeries.this
								.getElemId()));
			}
		}
	});
}
 
Example #6
Source File: ProgressCanvas.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ProgressCanvas(int progress) {

		setHeight(15);
		setAlign(Alignment.CENTER);

		Progressbar progressBar = new Progressbar();
		progressBar.setHeight(8);
		progressBar.setMargin(3);
		progressBar.setVertical(false);
		progressBar.setShowTitle(true);

		boolean enabled = true;
		// record.getAttributeAsBoolean("eenabled");
		boolean running = true;
		// record.getAttributeAsInt("status") ==
		// GUITask.STATUS_RUNNING;
		Img image = new Img();
		if (enabled && running) {
			image = ItemFactory.newImgIcon("paste.gif");
		} else {
			image = ItemFactory.newImgIcon("document_lock.png");
		}

		image.setWidth("16px");
		image.setHeight("16px");

		addMember(progressBar);
		addMember(image);

		setProgress(progress);
	}
 
Example #7
Source File: Legend.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void createExportLoadingSpinner() {
    this.exportLoadingSpinner = new HLayout();
    Img spinner = new Img("../img/mini_loader_bright.gif", 43, 11);
    // this.exportLoadingSpinner.setWidth100();
    // this.exportLoadingSpinner.setHeight100();
    this.exportLoadingSpinner.setAlign(Alignment.CENTER);
    this.exportLoadingSpinner.addMember(spinner);
    this.exportLoadingSpinner.hide();
}
 
Example #8
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public void render() {
    if (loadFailed) {
        return ;
    }

    double ratio = zoom.ratio(
            imgContainer.getInnerWidth(), imgContainer.getInnerHeight(),
            image.getWidth(), image.getHeight());

    double width = (double) image.getWidth() * ratio;
    double height = (double) image.getHeight() * ratio;
    log("render", width, height);

    // do not try to center horizontally as browsers crop large images in small containers
    Img img = new Img(image.getUrl(),
            (int) width - imgContainer.getScrollbarSize() - 4,
            (int) height - imgContainer.getScrollbarSize() - 4);
    img.setCanFocus(Boolean.TRUE);
    img.setImageType(ImageStyle.STRETCH);
    imgContainer.setMembers(img);
    imgContainer.adjustForContent(true);
    int scrollLeft = (int) (imgContainer.getWidth() * scrollHorizontal);
    int scrollTop = (int) (imgContainer.getHeight() * scrollVertical);
    imgContainer.scrollTo(scrollLeft, scrollTop);
    addContainerMoveListener(imgContainer, img);
    if (focus) {
        img.focus();
    }
}
 
Example #9
Source File: DigitalObjectPreview.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onError(ErrorEvent event) {
    loadFailed = true;
    ClientUtils.warning(LOG, "image onError: %s", image.getUrl());
    Img img = new Img("[SKIN]/Dialog/warn.png", 2 * 16, 2 * 16);
    img.setLayoutAlign(Alignment.CENTER);
    img.setAltText(i18n.DigitalObjectPreview_NoContent_Msg());
    img.setPrompt(i18n.DigitalObjectPreview_NoContent_Msg());
    imgContainer.setMembers(img);
}
 
Example #10
Source File: SubscriptionListGrid.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createDeleteButton(final ListGridRecord ruleRecord) {
    Canvas delButton = new SmallButton(new Img(delImg) , "", "");
    delButton.addClickHandler(createDeleteHandler(ruleRecord));
    delButton.setPrompt(i18n.unsubscribeThisRule());
    delButton.setLayoutAlign(CENTER);
    delButton.setMargin(1);
    return delButton;
}
 
Example #11
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private Canvas createStationLoadingSpinner() {
	stationLoadingSpinner = new Img("../img/loader.gif");
	stationLoadingSpinner.setWidth(32);
	stationLoadingSpinner.setHeight(32);
	setStationLoadingSpinnerPosition();
	return stationLoadingSpinner;
}
 
Example #12
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void createSesCommunicatorButton() {
	this.sesComButton = new SmallButton(
			new Img("../img/icons/event.png"), i18n.sesCommunicatorButton(), i18n.sesCommunicatorButtonExtend());
	this.sesComButton.hide();
	this.sesComButton.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
		    TimeseriesLegendData dataItem = TimeseriesDataStore.getTimeSeriesDataStore().getDataItem(timeseriesID);
		    LegendEntryTimeSeries.this.showSubscriptionWindow(dataItem);
		}
	});
}
 
Example #13
Source File: LegendEntryTimeSeries.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private void createInformationButton() {
	this.infoButton = new SmallButton(new Img("../img/icons/info.png"),
			i18n.infos(), i18n.infoExtended());
	this.infoButton.addClickHandler(new ClickHandler() {
		public void onClick(ClickEvent event) {
			if (informationWindow == null) {
				createInformationWindow();
			}
			informationWindow.show();
		}
	});
}
 
Example #14
Source File: ApplyCancelButtonLayout.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
private Canvas createSmallButton(String img, String tooltip, String longTooltip) {
    return new SmallButton(new Img(img), tooltip, longTooltip);
}
 
Example #15
Source File: DiagramTab.java    From SensorWebClient with GNU General Public License v2.0 4 votes vote down vote up
public void init() {
    try {
        setPane(layout);

        DiagramTab.layout.setVertical(true);

        this.mainChartViewport = getMainChartViewport();
        this.overviewChartViewport = getOverviewChartViewport();

        DiagramTab.layout.addMember(this.mainChartViewport);
        DiagramTab.layout.addMember(this.overviewChartViewport);
        initKeyControls();
        initZooming();
        initTooltips();

        this.mainChartLoadingSpinner = new Img("../img/loader.gif");
        this.mainChartLoadingSpinner.setWidth(32);
        this.mainChartLoadingSpinner.setHeight(32);
        this.mainChartLoadingSpinner.setLeft(getPanelWidth()/2);
        this.mainChartLoadingSpinner.setTop(getPanelHeight()/2);
        this.mainChartLoadingSpinner.hide();
        this.mainChartViewport.add(this.mainChartLoadingSpinner);

        this.mainChartViewport.setHandlerManager(this.mainChartEventBus);
        this.overviewChartViewport.setHandlerManager(this.overviewEventBus);
        this.overviewEventBus.fireEvent(StateChangeEvent.createMove());
        this.mainChartEventBus.fireEvent(StateChangeEvent.createMove());
        this.mainChartEventBus.fireEvent(StateChangeEvent.createZoom());

        int mainOffsetWidth = this.mainChartViewport.getOffsetWidth();
        int mainOffsetHeight = this.mainChartViewport.getOffsetHeight();
        Bounds mainBounds = new Bounds(mainOffsetWidth, 0, mainOffsetHeight, 0);
        int overviewOffsetWidth = this.overviewChartViewport.getOffsetWidth();
        int overviewOffsetHeight = this.overviewChartViewport.getOffsetHeight();
        Bounds overviewBounds = new Bounds(overviewOffsetWidth, 0, overviewOffsetHeight, 0);
        this.mainChartEventBus.fireEvent(new SetViewportPixelBoundsEvent(mainBounds));
        this.overviewEventBus.fireEvent(new SetViewportPixelBoundsEvent(overviewBounds));
    }
    catch (Exception e) {
        ExceptionHandler.handleUnexpectedException(e);
    }
}
 
Example #16
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static Img newImg(String name) {
	Img img = new Img("[SKIN]/" + name);
	return img;
}
 
Example #17
Source File: ItemFactory.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static Img newImgIcon(String name) {
	Img img = newImg(name);
	img.setWidth("16px");
	return img;
}
 
Example #18
Source File: AboutDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public AboutDialog() {
	super();

	addCloseClickHandler(new CloseClickHandler() {
		@Override
		public void onCloseClick(CloseClickEvent event) {
			destroy();
		}
	});

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("about") + " " + Session.get().getInfo().getBranding().getProductName());
	setWidth(400);
	setPadding(2);
	setAutoSize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	HTMLPane vspacer1 = new HTMLPane();
	vspacer1.setContents("<div>&nbsp;</div>");
	vspacer1.setPixelSize(100, 5);
	vspacer1.setOverflow(Overflow.HIDDEN);

	Img logoImage = ItemFactory.newBrandImg("logo.png", Session.get().getInfo());
	logoImage.setWidth(205);
	logoImage.setHeight(40);

	Label productName = new Label(Session.get().getInfo().getBranding().getProductName());
	productName.setWrap(false);
	productName.setHeight(10);
	productName.setAlign(Alignment.CENTER);

	Label version = new Label(I18N.message("version") + " " + Session.get().getInfo().getRelease());
	version.setWrap(false);
	version.setHeight(10);
	version.setAlign(Alignment.CENTER);

	Label copyright = new Label("&copy; " + Session.get().getInfo().getYear() + " "
			+ Session.get().getInfo().getBranding().getVendor());
	copyright.setWrap(false);
	copyright.setHeight(20);
	copyright.setAlign(Alignment.CENTER);

	Label trademark = new Label(I18N.message("copyrights", new String[] { Session.get().getInfo().getBranding().getProduct(),
			Session.get().getInfo().getBranding().getProduct(), Session.get().getInfo().getBranding().getVendor() }));
	trademark.setWidth("80%");
	trademark.setHeight(40);
	trademark.setAlign(Alignment.CENTER);

	// Prepare the website link
	String wsurl = Session.get().getInfo().getBranding().getUrl();

	String htmlUrl = "";
	if (Session.get().getInfo().getBranding().getUrl() != null && !"-".equals(Session.get().getInfo().getBranding().getUrl()))
		htmlUrl = "<div style='text-align: center;'><a href='" + wsurl + "' target='_blank'>" + wsurl
				+ "</a></div>";
	HTMLPane sitelink = new HTMLPane();
	sitelink.setContents(htmlUrl);
	sitelink.setPixelSize(300, 16);
	sitelink.setAlign(Alignment.CENTER);
	sitelink.setLayoutAlign(Alignment.CENTER);

	// Prepare the support link
	String support = Session.get().getInfo().getBranding().getSupport();
	String htmlSupp = "<div style='text-align: center;'><a href='mailto:" + support + "'>" + support + "</a></div>";
	HTMLPane maillink = new HTMLPane();
	maillink.setContents(htmlSupp);
	maillink.setPixelSize(300, 16);
	maillink.setAlign(Alignment.CENTER);
	maillink.setLayoutAlign(Alignment.CENTER);

	HTMLPane vspacer2 = new HTMLPane();
	vspacer2.setContents("<div>&nbsp;</div>");
	vspacer2.setPixelSize(100, 10);
	vspacer2.setOverflow(Overflow.HIDDEN);

	VStack content = new VStack();
	content.setWidth("100%");
	content.setMembersMargin(5);
	content.setMargin(4);
	content.setAlign(Alignment.CENTER);
	content.setDefaultLayoutAlign(Alignment.CENTER);
	content.setBackgroundColor("#ffffff");
	content.setMembers(vspacer1, logoImage, productName, version, copyright, trademark, sitelink, maillink,
			vspacer2);

	addItem(content);
}