Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:org.bonitasoft.console.client.view.labels.LabelViewer.java

License:Open Source License

/**
 * Default constructor./*  w  w w.  j  a v a2s.  co  m*/
 * 
 * @param aDataSource
 * @param aCaseItem
 * @param isDeletable
 */
public LabelViewer(LabelDataSource aDataSource, CaseItem aCaseItem, boolean isDeletable) {

    myCaseItem = aCaseItem;
    this.isDeletable = isDeletable;
    myLabelDataSource = aDataSource;

    LabelModel theLabelModel;
    for (LabelUUID theLabelUUID : aCaseItem.getLabels()) {
        theLabelModel = myLabelDataSource.getLabel(theLabelUUID);
        if (theLabelModel != null && theLabelModel.hasToBeDisplayed()) {
            if (isDeletable) {
                theLabelModel.addModelChangeListener(LabelModel.EDITABLE_CSS_CLASS_NAME_PROPERTY, this);
            } else {
                theLabelModel.addModelChangeListener(LabelModel.READONLY_CSS_CLASS_NAME_PROPERTY, this);
            }
            myLabelTable.put(theLabelUUID.getValue(), buildLabelTable(theLabelModel));
        }
    }

    myCaseItem.addModelChangeListener(CaseItem.LABELS_PROPERTY, this);

    // Create an empty horizontal panel to layout. It will be filled in
    // later.
    myOuterPanel = new HorizontalPanel();
    myOuterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // May be better to set the cellSpacing?
    myOuterPanel.setSpacing(5);
    // DOM.setElementPropertyInt(myOuterPanel.getElement(), "cellPadding", 5);

    if (isDeletable) {
        myOuterPanel.setStyleName("label_viewer_editable");
    } else {
        myOuterPanel.setStyleName("label_viewer_readonly");
    }

    initWidget(myOuterPanel);
    fillInTable();
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.components.ShowcaseTopPanel.java

License:Apache License

@Inject
public ShowcaseTopPanel(Image logo, ShowcaseSearchPanel searchPanel) {
    super.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    super.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    super.setStyleName("top");

    super.setSpacing(1);

    logo.setSize("32px", "32px");
    super.add(logo);
    Anchor anchor = new Anchor();
    String text = "<div class=\"brand\"><a href=\"http://cesiumjs.org\">Cesium</a> on GWT Examples</div>";
    anchor.setHTML(SafeHtmlUtils.fromTrustedString(text));
    super.add(anchor);
    super.add(searchPanel);

    super.setCellWidth(logo, "10px");
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Clustering.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    KmlDataSourceLoadStaticOptions kmlDataSourceOptions = KmlDataSourceLoadStaticOptions
            .create(csVPanel.getViewer().camera, csVPanel.getViewer().canvas());
    Promise<KmlDataSource, Void> dataSourcePromise = csVPanel.getViewer().dataSources().add(KmlDataSource
            .load(GWT.getModuleBaseURL() + "SampleData/kml/facilities/facilities.kml", kmlDataSourceOptions));
    dataSourcePromise.then(new Fulfill<KmlDataSource>() {
        @Override/*ww w .  jav  a  2 s  .  c o  m*/
        public void onFulfilled(KmlDataSource dataSource) {
            int pixelRange = 25;
            int minimumClusterSize = 3;
            boolean enabled = true;

            dataSource.clustering.enabled = enabled;
            dataSource.clustering.pixelRange = pixelRange;
            dataSource.clustering.minimumClusterSize = minimumClusterSize;

            PinBuilder pinBuilder = new PinBuilder();
            pin50 = pinBuilder.fromText("50+", Color.RED(), 48).toDataUrl();
            pin40 = pinBuilder.fromText("40+", Color.ORANGE(), 48).toDataUrl();
            pin30 = pinBuilder.fromText("30+", Color.YELLOW(), 48).toDataUrl();
            pin20 = pinBuilder.fromText("20+", Color.GREEN(), 48).toDataUrl();
            pin10 = pinBuilder.fromText("10+", Color.BLUE(), 48).toDataUrl();

            singleDigitPins = new String[8];
            for (int i = 0; i < singleDigitPins.length; ++i) {
                singleDigitPins[i] = pinBuilder.fromText("" + (i + 2), Color.VIOLET(), 48).toDataUrl();
            }
            // start with custom style
            customStyle(dataSource);

            _dataSource = dataSource;
        }
    });

    pixelRangeSlider = new Slider("pixelRange", 1, 200, 15);
    pixelRangeSlider.setStep(1);
    pixelRangeSlider.setWidth("150px");
    pixelRangeSlider.addListener(new MSliderListener());
    pixelRangeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    pixelRangeTBox.setText("" + 15);
    pixelRangeTBox.setSize("30px", "12px");

    HorizontalPanel pixelRangeHPanel = new HorizontalPanel();
    pixelRangeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    pixelRangeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pixelRangeHPanel.setSpacing(10);
    pixelRangeHPanel.add(pixelRangeSlider);
    pixelRangeHPanel.add(pixelRangeTBox);

    minimumClusterSizeSlider = new Slider("minimumClusterSize", 1, 20, 3);
    minimumClusterSizeSlider.setStep(1);
    minimumClusterSizeSlider.setWidth("150px");
    minimumClusterSizeSlider.addListener(new MSliderListener());
    minimumClusterSizeTBox = new TextBox();
    pixelRangeTBox.addChangeHandler(new MChangeHandler());
    minimumClusterSizeTBox.setText("" + 3);
    minimumClusterSizeTBox.setSize("30px", "12px");

    HorizontalPanel minimumClusterSizeHPanel = new HorizontalPanel();
    minimumClusterSizeHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    minimumClusterSizeHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    minimumClusterSizeHPanel.setSpacing(10);
    minimumClusterSizeHPanel.add(minimumClusterSizeSlider);
    minimumClusterSizeHPanel.add(minimumClusterSizeTBox);

    CheckBox enabledCBox = new CheckBox();
    enabledCBox.setValue(true);
    enabledCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            _dataSource.clustering.enabled = valueChangeEvent.getValue();
        }
    });

    CheckBox customStyleCBox = new CheckBox();
    customStyleCBox.setValue(true);
    customStyleCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            customStyle(_dataSource);
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">Pixel Range</font>");
    flexTable.setWidget(1, 1, pixelRangeHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">Minimum Cluster Size</font>");
    flexTable.setWidget(2, 1, minimumClusterSizeHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">Enabled</font>");
    flexTable.setWidget(3, 1, enabledCBox);
    flexTable.setHTML(4, 0, "<font color=\"white\">Custom Style</font>");
    flexTable.setWidget(4, 1, customStyleCBox);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Cluster labels, billboards and points.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.GroundAtmosphere.java

License:Apache License

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.sceneModePicker = false;
    csVPanel = new ViewerPanel(viewerOptions);

    scene = csVPanel.getViewer().scene();
    globe = scene.globe;/*from w ww .ja va  2s  . c  o m*/

    lightingFadeOutDistance = globe.lightingFadeOutDistance;
    lightingFadeInDistance = globe.lightingFadeInDistance;
    nightFadeOutDistance = globe.nightFadeOutDistance;
    nightFadeInDistance = globe.nightFadeInDistance;

    HorizontalPanel lightingFadeOutDistanceHPanel = new HorizontalPanel();
    lightingFadeOutDistanceHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lightingFadeOutDistanceHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    lightingFadeOutDistanceHPanel.setSpacing(10);
    lightingFadeOutDistanceSlider = new Slider("lightingFadeOutDistance", 1, 100, 10);
    lightingFadeOutDistanceSlider.setStep(1);
    lightingFadeOutDistanceSlider.setWidth("150px");
    lightingFadeOutDistanceSlider.addListener(new MSliderListener());
    lightingFadeOutDistanceTBox = new TextBox();
    lightingFadeOutDistanceTBox.addChangeHandler(new MChangeHandler());
    lightingFadeOutDistanceTBox.setText("" + 10 * 1e6);
    lightingFadeOutDistanceTBox.setSize("100px", "12px");
    lightingFadeOutDistanceHPanel.add(lightingFadeOutDistanceSlider);
    lightingFadeOutDistanceHPanel.add(lightingFadeOutDistanceTBox);

    HorizontalPanel lightingFadeInDistanceHPanel = new HorizontalPanel();
    lightingFadeInDistanceHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    lightingFadeInDistanceHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    lightingFadeInDistanceHPanel.setSpacing(10);
    lightingFadeInDistanceSlider = new Slider("lightingFadeInDistance", 1, 100, 20);
    lightingFadeInDistanceSlider.setStep(1);
    lightingFadeInDistanceSlider.setWidth("150px");
    lightingFadeInDistanceSlider.addListener(new MSliderListener());
    lightingFadeInDistanceTBox = new TextBox();
    lightingFadeInDistanceTBox.addChangeHandler(new MChangeHandler());
    lightingFadeInDistanceTBox.setText("" + 20 * 1e6);
    lightingFadeInDistanceTBox.setSize("100px", "12px");
    lightingFadeInDistanceHPanel.add(lightingFadeInDistanceSlider);
    lightingFadeInDistanceHPanel.add(lightingFadeInDistanceTBox);

    HorizontalPanel nightFadeOutDistanceHPanel = new HorizontalPanel();
    nightFadeOutDistanceHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    nightFadeOutDistanceHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    nightFadeOutDistanceHPanel.setSpacing(10);
    nightFadeOutDistanceSlider = new Slider("nightFadeOutDistance", 1, 100, 10);
    nightFadeOutDistanceSlider.setStep(1);
    nightFadeOutDistanceSlider.setWidth("150px");
    nightFadeOutDistanceSlider.addListener(new MSliderListener());
    nightFadeOutDistanceTBox = new TextBox();
    nightFadeOutDistanceTBox.addChangeHandler(new MChangeHandler());
    nightFadeOutDistanceTBox.setText("" + 10 * 1e6);
    nightFadeOutDistanceTBox.setSize("100px", "12px");
    nightFadeOutDistanceHPanel.add(nightFadeOutDistanceSlider);
    nightFadeOutDistanceHPanel.add(nightFadeOutDistanceTBox);

    HorizontalPanel nightFadeInDistanceHPanel = new HorizontalPanel();
    nightFadeInDistanceHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    nightFadeInDistanceHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    nightFadeInDistanceHPanel.setSpacing(10);
    nightFadeInDistanceSlider = new Slider("nightFadeInDistance", 1, 100, 50);
    nightFadeInDistanceSlider.setStep(1);
    nightFadeInDistanceSlider.setWidth("150px");
    nightFadeInDistanceSlider.addListener(new MSliderListener());
    nightFadeInDistanceTBox = new TextBox();
    nightFadeInDistanceTBox.addChangeHandler(new MChangeHandler());
    nightFadeInDistanceTBox.setText("" + 50 * 1e6);
    nightFadeInDistanceTBox.setSize("100px", "12px");
    nightFadeInDistanceHPanel.add(nightFadeInDistanceSlider);
    nightFadeInDistanceHPanel.add(nightFadeInDistanceTBox);

    CheckBox groundAtmosphereCBox = new CheckBox();
    groundAtmosphereCBox.setWidth("100px");
    groundAtmosphereCBox.setValue(true);
    groundAtmosphereCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            globe.showGroundAtmosphere = event.getValue();
        }
    });

    CheckBox lightingBox = new CheckBox();
    lightingBox.setWidth("100px");
    lightingBox.setValue(false);
    lightingBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            globe.enableLighting = event.getValue();
        }
    });

    ListBox terrainsLBox = new ListBox();
    terrainsLBox.setWidth("160px");
    terrainsLBox.addItem("Cesium World Terrain - no effects", "0");
    terrainsLBox.addItem("Cesium World Terrain w/ Vertex Normals", "1");
    terrainsLBox.addItem("Cesium World Terrain w/ Water", "2");
    terrainsLBox.addItem("Cesium World Terrain w/ Vertex Normals and Water", "3");
    terrainsLBox.addItem("EllipsoidTerrainProvider", "4");
    terrainsLBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            switch (source.getSelectedValue()) {
            case "0": {
                csVPanel.getViewer().terrainProvider = Cesium.createWorldTerrain();
            }
                break;
            case "1": {
                Cesium.CreateWorldTerrainOptions options = new Cesium.CreateWorldTerrainOptions();
                options.requestVertexNormals = true;
                csVPanel.getViewer().terrainProvider = Cesium.createWorldTerrain(options);
            }
                break;
            case "2": {
                Cesium.CreateWorldTerrainOptions options = new Cesium.CreateWorldTerrainOptions();
                options.requestWaterMask = true;
                csVPanel.getViewer().terrainProvider = Cesium.createWorldTerrain(options);
            }
                break;
            case "3": {
                Cesium.CreateWorldTerrainOptions options = new Cesium.CreateWorldTerrainOptions();
                options.requestVertexNormals = true;
                options.requestWaterMask = true;
                csVPanel.getViewer().terrainProvider = Cesium.createWorldTerrain(options);
            }
                break;
            case "4": {
                csVPanel.getViewer().terrainProvider = new EllipsoidTerrainProvider();
            }
                break;
            default:
                break;
            }
        }
    });

    PushButton resetFadeDistancesPBtn = new PushButton();
    resetFadeDistancesPBtn.setText("Reset Fade Distances");
    resetFadeDistancesPBtn.setWidth("160px");
    resetFadeDistancesPBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            globe.lightingFadeOutDistance = lightingFadeOutDistance;
            globe.lightingFadeInDistance = lightingFadeInDistance;
            globe.nightFadeOutDistance = nightFadeOutDistance;
            globe.nightFadeInDistance = nightFadeInDistance;

            lightingFadeOutDistanceSlider.setValue((int) (lightingFadeOutDistance / 1e6));
            lightingFadeInDistanceSlider.setValue((int) (lightingFadeInDistance / 1e6));
            nightFadeOutDistanceSlider.setValue((int) (nightFadeOutDistance / 1e6));
            nightFadeInDistanceSlider.setValue((int) (nightFadeInDistance / 1e6));

            lightingFadeOutDistanceTBox.setValue(String.valueOf(lightingFadeOutDistance), true);
            lightingFadeInDistanceTBox.setValue(String.valueOf(lightingFadeInDistance), true);
            nightFadeOutDistanceTBox.setValue(String.valueOf(nightFadeOutDistance), true);
            nightFadeInDistanceTBox.setValue(String.valueOf(nightFadeInDistance), true);
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">Lighting Fade Out Distance</font>");
    flexTable.setWidget(1, 1, lightingFadeOutDistanceHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">Lighting Fade In Distance</font>");
    flexTable.setWidget(2, 1, lightingFadeInDistanceHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">Night Fade Out Distance</font>");
    flexTable.setWidget(3, 1, nightFadeOutDistanceHPanel);
    flexTable.setHTML(4, 0, "<font color=\"white\">Night Fade In Distance</font>");
    flexTable.setWidget(4, 1, nightFadeInDistanceHPanel);
    flexTable.setHTML(5, 0, "<font color=\"white\">Ground atmosphere</font>");
    flexTable.setWidget(5, 1, groundAtmosphereCBox);
    flexTable.setHTML(6, 0, "<font color=\"white\">Lighting</font>");
    flexTable.setWidget(6, 1, lightingBox);
    flexTable.setWidget(7, 1, terrainsLBox);
    flexTable.setWidget(8, 1, resetFadeDistancesPBtn);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Adjust hue, saturation, and brightness of the sky/atmosphere.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.ImageryAdjustment.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    csVPanel.getViewer().imageryLayers().layerAdded.addEventListener(new UpdateViewModel());
    csVPanel.getViewer().imageryLayers().layerRemoved.addEventListener(new UpdateViewModel());
    csVPanel.getViewer().imageryLayers().layerMoved.addEventListener(new UpdateViewModel());

    brightnessSlider = new Slider("brightness", 0, 300, 100);
    brightnessSlider.setStep(1);/*from w w  w.j  a v a2s . com*/
    brightnessSlider.setWidth("150px");
    brightnessSlider.addListener(new MSliderListener());
    brightnessTBox = new TextBox();
    brightnessTBox.addChangeHandler(new MChangeHandler());
    brightnessTBox.setText("" + 1);
    brightnessTBox.setSize("30px", "12px");

    HorizontalPanel brightnessHPanel = new HorizontalPanel();
    brightnessHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    brightnessHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    brightnessHPanel.setSpacing(10);
    brightnessHPanel.add(brightnessSlider);
    brightnessHPanel.add(brightnessTBox);

    contrastSlider = new Slider("contrast", 0, 300, 100);
    contrastSlider.setStep(1);
    contrastSlider.setWidth("150px");
    contrastSlider.addListener(new MSliderListener());
    contrastTBox = new TextBox();
    contrastTBox.addChangeHandler(new MChangeHandler());
    contrastTBox.setText("" + 1);
    contrastTBox.setSize("30px", "12px");

    HorizontalPanel contrastHPanel = new HorizontalPanel();
    contrastHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    contrastHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    contrastHPanel.setSpacing(10);
    contrastHPanel.add(contrastSlider);
    contrastHPanel.add(contrastTBox);

    hueSlider = new Slider("hue", 0, 300, 0);
    hueSlider.setStep(1);
    hueSlider.setWidth("150px");
    hueSlider.addListener(new MSliderListener());
    hueTBox = new TextBox();
    hueTBox.addChangeHandler(new MChangeHandler());
    hueTBox.setText("" + 0);
    hueTBox.setSize("30px", "12px");

    HorizontalPanel hueHPanel = new HorizontalPanel();
    hueHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hueHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hueHPanel.setSpacing(10);
    hueHPanel.add(hueSlider);
    hueHPanel.add(hueTBox);

    saturationSlider = new Slider("saturation", 0, 300, 100);
    saturationSlider.setStep(1);
    saturationSlider.setWidth("150px");
    saturationSlider.addListener(new MSliderListener());
    saturationTBox = new TextBox();
    saturationTBox.addChangeHandler(new MChangeHandler());
    saturationTBox.setText("" + 1);
    saturationTBox.setSize("30px", "12px");

    HorizontalPanel saturationHPanel = new HorizontalPanel();
    saturationHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    saturationHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    saturationHPanel.setSpacing(10);
    saturationHPanel.add(saturationSlider);
    saturationHPanel.add(saturationTBox);

    gammaSlider = new Slider("gamma", 0, 300, 100);
    gammaSlider.setStep(1);
    gammaSlider.setWidth("150px");
    gammaSlider.addListener(new MSliderListener());
    gammaTBox = new TextBox();
    gammaTBox.addChangeHandler(new MChangeHandler());
    gammaTBox.setText("" + 1);
    gammaTBox.setSize("30px", "12px");

    HorizontalPanel gammaHPanel = new HorizontalPanel();
    gammaHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    gammaHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    gammaHPanel.setSpacing(10);
    gammaHPanel.add(gammaSlider);
    gammaHPanel.add(gammaTBox);

    FlexTable flexTable = new FlexTable();
    flexTable.setCellSpacing(1);
    flexTable.setCellPadding(1);
    flexTable.setHTML(1, 0, "<font color=\"white\">Brightness</font>");
    flexTable.setWidget(1, 1, brightnessHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">Contrast</font>");
    flexTable.setWidget(2, 1, contrastHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">Hue</font>");
    flexTable.setWidget(3, 1, hueHPanel);
    flexTable.setHTML(4, 0, "<font color=\"white\">Saturation</font>");
    flexTable.setWidget(4, 1, saturationHPanel);
    flexTable.setHTML(5, 0, "<font color=\"white\">Gamma</font>");
    flexTable.setWidget(5, 1, gammaHPanel);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(
            new HTML("<p>Adjust brightness, contrast, hue, saturation, and gamma of an imagery layer.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.ImageryLayersManipulation.java

License:Apache License

@Override
public void buildPanel() {
    ViewerOptions viewerOptions = new ViewerOptions();
    viewerOptions.baseLayerPicker = false;
    ViewerPanel csVPanel = new ViewerPanel(viewerOptions);

    imageryLayers = csVPanel.getViewer().imageryLayers();

    setupLayers();//  w  w  w  . j ava 2 s.  c o m
    updateLayerList();

    _callback.onSuccess(null);

    HorizontalPanel baseLayersHPanel = new HorizontalPanel();
    baseLayersHPanel.setSpacing(5);
    baseLayersHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    baseLayersHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    final ListBox baseLayersLBox = new ListBox();
    baseLayersHPanel.add(baseLayersLBox);

    Slider baseLayersSlider = new Slider("baseLayersAlpha", 0, 100, 100);
    baseLayersSlider.setWidth("200px");
    baseLayersSlider.addListener(new MSliderListener());
    baseLayersHPanel.add(baseLayersSlider);

    baseLayersLBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            ImageryLayer baseLayer = baseLayers.get(source.getSelectedValue());

            int activeLayerIndex = 0;
            int numLayers = layers.size();
            for (int i = 0; i < numLayers; ++i) {
                if (baseLayers.containsValue(layers.get(i))) {
                    activeLayerIndex = i;
                }
            }
            ImageryLayer activeLayer = layers.get(activeLayerIndex);
            float alpha = activeLayer.alpha;
            boolean show = activeLayer.show;
            imageryLayers.remove(activeLayer, false);
            imageryLayers.add(baseLayer, numLayers - activeLayerIndex - 1);
            baseLayer.show = show;
            baseLayer.alpha = alpha;
            updateLayerList();

            selectedLayer = baseLayer;
        }
    });

    Callback<Void, Void> cesiumCreated = new Callback<Void, Void>() {
        @Override
        public void onFailure(Void aVoid) {
            //
        }

        @Override
        public void onSuccess(Void aVoid) {
            for (Map.Entry<String, ImageryLayer> entry : baseLayers.entrySet()) {
                baseLayersLBox.addItem(entry.getKey(), entry.getKey());
            }
        }
    };
    addCallback(cesiumCreated);

    contentPanel.add(new HTML(
            "<p>Layer imagery from multiple sources, including WMS servers, Bing Maps, ArcGIS Online, OpenStreetMaps, and more, and adjust the alpha of each independently.</p>"));
    contentPanel.add(baseLayersHPanel);
    contentPanel.add(csVPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Interpolation.java

License:Apache License

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();

    csVPanel.getViewer().scene().globe.enableLighting = false;
    CesiumTerrainProviderOptions cesiumTerrainProviderOptions = new CesiumTerrainProviderOptions();
    cesiumTerrainProviderOptions.url = "https://assets.agi.com/stk-terrain/world";
    cesiumTerrainProviderOptions.requestWaterMask = true;
    cesiumTerrainProviderOptions.requestVertexNormals = true;
    csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(cesiumTerrainProviderOptions);

    csVPanel.getViewer().scene().globe.depthTestAgainstTerrain = true;

    Math.setRandomNumberSeed(3);/*from  w  ww.j av  a2 s .c  om*/

    _start = JulianDate.fromDate(new JsDate(2015, 2, 25, 16));
    _stop = JulianDate.addSeconds(_start, 360, new JulianDate());

    csVPanel.getViewer().clock().startTime = _start.clone();
    csVPanel.getViewer().clock().stopTime = _stop.clone();
    csVPanel.getViewer().clock().currentTime = _start.clone();
    csVPanel.getViewer().clock().clockRange = ClockRange.LOOP_STOP();
    csVPanel.getViewer().clock().multiplier = 10;

    csVPanel.getViewer().timeline().zoomTo(_start, _stop);

    PositionProperty position = computeCirclularFlight(-112.110693, 36.0994841, 0.03);
    TimeIntervalOptions timeIntervalOptions = new TimeIntervalOptions();
    timeIntervalOptions.start = _start;
    timeIntervalOptions.stop = _stop;

    ModelGraphicsOptions modelGraphicsOptions = new ModelGraphicsOptions();
    modelGraphicsOptions.uri = new ConstantProperty<>(
            GWT.getModuleBaseURL() + "SampleData/models/CesiumAir/Cesium_Air.gltf");
    modelGraphicsOptions.minimumPixelSize = new ConstantProperty<>(64);

    PolylineGlowMaterialPropertyOptions polylineGlowMaterialPropertyOptions = new PolylineGlowMaterialPropertyOptions();
    polylineGlowMaterialPropertyOptions.glowPower = new ConstantProperty<>(0.1);
    polylineGlowMaterialPropertyOptions.color = new ConstantProperty<>(Color.YELLOW());
    PathGraphicsOptions pathGraphicsOptions = new PathGraphicsOptions();
    pathGraphicsOptions.resolution = new ConstantProperty<>(1);
    pathGraphicsOptions.material = new PolylineGlowMaterialProperty(polylineGlowMaterialPropertyOptions);
    pathGraphicsOptions.width = new ConstantProperty<>(10);

    EntityOptions entityOptions = new EntityOptions();
    entityOptions.availability = new TimeIntervalCollection(
            new TimeInterval[] { new TimeInterval(timeIntervalOptions) });
    entityOptions.position = position;
    entityOptions.orientation = new VelocityOrientationProperty(position);
    entityOptions.model = new ModelGraphics(modelGraphicsOptions);
    entityOptions.path = new PathGraphics(pathGraphicsOptions);
    _entity = csVPanel.getViewer().entities().add(entityOptions);

    ListBox interpolationsLBox = new ListBox();
    interpolationsLBox.addItem("Interpolation: Linear Approximation", "0");
    interpolationsLBox.addItem("Interpolation: Lagrange Polynomial Approximation", "1");
    interpolationsLBox.addItem("Interpolation: Hermite Polynomial Approximation", "2");
    interpolationsLBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            SampledPropertyInterpolationOptions sampledPropertyInterpolationOptions = new SampledPropertyInterpolationOptions();
            switch (source.getSelectedValue()) {
            case "0":
                sampledPropertyInterpolationOptions.interpolationDegree = 1;
                sampledPropertyInterpolationOptions.interpolationAlgorithm = LinearApproximation.instance();
                ((SampledPositionProperty) _entity.position)
                        .setInterpolationOptions(sampledPropertyInterpolationOptions);
                break;
            case "1":
                sampledPropertyInterpolationOptions.interpolationDegree = 5;
                sampledPropertyInterpolationOptions.interpolationAlgorithm = LagrangePolynomialApproximation
                        .instance();
                ((SampledPositionProperty) _entity.position)
                        .setInterpolationOptions(sampledPropertyInterpolationOptions);
                break;
            case "2":
                sampledPropertyInterpolationOptions.interpolationDegree = 2;
                sampledPropertyInterpolationOptions.interpolationAlgorithm = HermitePolynomialApproximation
                        .instance();
                ((SampledPositionProperty) _entity.position)
                        .setInterpolationOptions(sampledPropertyInterpolationOptions);
                break;
            default:
                break;
            }
        }
    });

    Button viewTopDownBtn = new Button("View Top Down");
    viewTopDownBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            Viewer viewer = csVPanel.getViewer();
            viewer.trackedEntity = (Entity) JsObject.undefined();
            viewer.zoomTo(viewer.entities(), new HeadingPitchRange(0, Math.toRadians(-90), 0));

        }
    });
    Button viewSideBtn = new Button("View Side");
    viewSideBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            Viewer viewer = csVPanel.getViewer();
            viewer.trackedEntity = (Entity) JsObject.undefined();
            viewer.zoomTo(viewer.entities(),
                    new HeadingPitchRange(Math.toRadians(-90), Math.toRadians(-15), 7500.0));
        }
    });
    Button viewAircraftBtn = new Button("View Aircraft");
    viewAircraftBtn.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            Viewer viewer = csVPanel.getViewer();
            viewer.trackedEntity = _entity;
        }
    });

    HorizontalPanel btnHPanel = new HorizontalPanel();
    btnHPanel.setSpacing(5);
    btnHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    btnHPanel.add(interpolationsLBox);
    btnHPanel.add(viewTopDownBtn);
    btnHPanel.add(viewSideBtn);
    btnHPanel.add(viewAircraftBtn);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(btnHPanel, 20, 20);

    contentPanel.add(new HTML("<p>This example shows simple Cesium application</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.SkyAtmosphere.java

License:Apache License

@Override
public void buildPanel() {
    _csVPanel = new ViewerPanel();
    Camera camera = _csVPanel.getViewer().camera;
    ViewOptions viewOptions = new ViewOptions();
    viewOptions.destinationPos = Cartesian3.fromDegrees(-75.5847, 40.0397, 1000.0);
    viewOptions.orientation = new HeadingPitchRoll(-Math.PI_OVER_TWO(), 0.2, 0.0);
    camera.setView(viewOptions);/*from w ww .  j  ava 2  s  .  c  om*/

    HorizontalPanel hueShiftHPanel = new HorizontalPanel();
    hueShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hueShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hueShiftHPanel.setSpacing(10);
    _hueShiftSlider = new Slider("hueShift", -100, 100, 0);
    _hueShiftSlider.setStep(1);
    _hueShiftSlider.setWidth("150px");
    _hueShiftSlider.addListener(new MSliderListener());
    _hueShiftTBox = new TextBox();
    _hueShiftTBox.addChangeHandler(new MChangeHandler());
    _hueShiftTBox.setText("0");
    _hueShiftTBox.setSize("30px", "12px");
    hueShiftHPanel.add(_hueShiftSlider);
    hueShiftHPanel.add(_hueShiftTBox);

    HorizontalPanel saturationShiftHPanel = new HorizontalPanel();
    saturationShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    saturationShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    saturationShiftHPanel.setSpacing(10);
    _saturationShiftSlider = new Slider("saturationShift", -100, 100, 0);
    _saturationShiftSlider.setStep(1);
    _saturationShiftSlider.setWidth("150px");
    _saturationShiftSlider.addListener(new MSliderListener());
    _saturationShiftTBox = new TextBox();
    _saturationShiftTBox.addChangeHandler(new MChangeHandler());
    _saturationShiftTBox.setText("0");
    _saturationShiftTBox.setSize("30px", "12px");
    saturationShiftHPanel.add(_saturationShiftSlider);
    saturationShiftHPanel.add(_saturationShiftTBox);

    HorizontalPanel brightnessShiftHPanel = new HorizontalPanel();
    brightnessShiftHPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    brightnessShiftHPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    brightnessShiftHPanel.setSpacing(10);
    _brightnessShiftSlider = new Slider("brightnessShift", -100, 100, 0);
    _brightnessShiftSlider.setStep(1);
    _brightnessShiftSlider.setWidth("150px");
    _brightnessShiftSlider.addListener(new MSliderListener());
    _brightnessShiftTBox = new TextBox();
    _brightnessShiftTBox.addChangeHandler(new MChangeHandler());
    _brightnessShiftTBox.setText("0");
    _brightnessShiftTBox.setSize("30px", "12px");
    brightnessShiftHPanel.add(_brightnessShiftSlider);
    brightnessShiftHPanel.add(_brightnessShiftTBox);

    CheckBox lightingCBox = new CheckBox();
    lightingCBox.setWidth("100px");
    lightingCBox.setValue(true);
    lightingCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            _csVPanel.getViewer()
                    .scene().globe.enableLighting = !_csVPanel.getViewer().scene().globe.enableLighting;
        }
    });

    CheckBox fogCBox = new CheckBox();
    fogCBox.setWidth("100px");
    fogCBox.setValue(true);
    fogCBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            _csVPanel.getViewer().scene().fog.enabled = !_csVPanel.getViewer().scene().fog.enabled;
        }
    });

    FlexTable flexTable = new FlexTable();
    flexTable.setHTML(1, 0, "<font color=\"white\">hueShift</font>");
    flexTable.setWidget(1, 1, hueShiftHPanel);
    flexTable.setHTML(2, 0, "<font color=\"white\">saturationShift</font>");
    flexTable.setWidget(2, 1, saturationShiftHPanel);
    flexTable.setHTML(3, 0, "<font color=\"white\">brightnessShift</font>");
    flexTable.setWidget(3, 1, brightnessShiftHPanel);
    flexTable.setHTML(4, 0, "<font color=\"white\">Toggle Lighting</font>");
    flexTable.setWidget(4, 1, lightingCBox);
    flexTable.setHTML(5, 0, "<font color=\"white\">Toggle Fog</font>");
    flexTable.setWidget(5, 1, fogCBox);

    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(_csVPanel);
    aPanel.add(flexTable, 20, 20);

    contentPanel.add(new HTML("<p>Adjust hue, saturation, and brightness of the sky/atmosphere.</p>"));
    contentPanel.add(aPanel);

    initWidget(contentPanel);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.InfoPanel.java

License:Apache License

/**
 * Maak een nieuw infopanel./*from   w w  w  .  j  a  va 2 s .co  m*/
 *
 * @param message Het weer te geven bericht
 */
public InfoPanel(String message) {
    HorizontalPanel container = new HorizontalPanel();
    Image imgInfo = new Image(Resources.INSTANCE.icon_info());
    lblMessage.setHTML(message);

    container.add(imgInfo);
    container.add(lblMessage);
    container.setCellWidth(imgInfo, "70px");
    container.setCellHorizontalAlignment(imgInfo, HasHorizontalAlignment.ALIGN_CENTER);
    container.setCellVerticalAlignment(lblMessage, HasVerticalAlignment.ALIGN_MIDDLE);
    container.setCellVerticalAlignment(imgInfo, HasVerticalAlignment.ALIGN_MIDDLE);

    initWidget(container);
    setStyleName("infopanel");
    setSize("480px", "60px");
}

From source file:org.cleanlogic.ol4gwt.showcase.components.ShowcaseTopPanel.java

License:Apache License

@Inject
public ShowcaseTopPanel(Image logo, ShowcaseSearchPanel searchPanel) {
    super.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    super.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    super.setStyleName("top");

    super.setSpacing(1);

    logo.setSize("32px", "32px");
    super.add(logo);
    Anchor anchor = new Anchor();
    String text = "<div class=\"brand\"><a href=\"http://openlayers.org\">OpenLayers</a> on GWT Examples</div>";
    anchor.setHTML(SafeHtmlUtils.fromTrustedString(text));
    super.add(anchor);
    super.add(searchPanel);

    super.setCellWidth(logo, "10px");
}