Search in sources :

Example 71 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project ovirt-engine by oVirt.

the class VolumeProfileStatisticsPopupView method edit.

@Override
public void edit(final VolumeProfileStatisticsModel object) {
    driver.edit(object);
    volumeProfileStats.asEditor().edit(object.getCumulativeStatistics());
    nfsServerProfileStats.asEditor().edit(object.getNfsServerProfileStats());
    profileRunTime.setText(object.getProfileRunTime());
    nfsProfileRunTime.setText(object.getNfsProfileRunTime());
    bytesRead.setText(object.getBytesRead());
    nfsBytesRead.setText(object.getNfsBytesRead());
    bytesWritten.setText(object.getBytesWritten());
    nfsBytesWritten.setText(object.getNfsBytesWritten());
    ClickHandler brickTabClickHandler = event -> object.queryBackend(true);
    brickRefreshIcon.setRefreshIconClickListener(brickTabClickHandler);
    ClickHandler nfsTabClickHandler = event -> object.queryBackend(false);
    nfsRefreshIcon.setRefreshIconClickListener(nfsTabClickHandler);
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if (args.propertyName.equals("brickProfileRunTimeChanged")) {
            // $NON-NLS-1$
            profileRunTime.setText(object.getProfileRunTime());
        }
        if (args.propertyName.equals("brickProfileDataRead")) {
            // $NON-NLS-1$
            bytesRead.setText(object.getBytesRead());
        }
        if (args.propertyName.equals("brickProfileDataWritten")) {
            // $NON-NLS-1$
            bytesWritten.setText(object.getBytesWritten());
        }
        if (args.propertyName.equals("nfsProfileRunTimeChanged")) {
            // $NON-NLS-1$
            nfsProfileRunTime.setText(object.getNfsProfileRunTime());
        }
        if (args.propertyName.equals("nfsProfileDataRead")) {
            // $NON-NLS-1$
            nfsBytesRead.setText(object.getNfsBytesRead());
        }
        if (args.propertyName.equals("nfsProfileDataWritten")) {
            // $NON-NLS-1$
            nfsBytesWritten.setText(object.getNfsBytesWritten());
        }
        if (args.propertyName.equals("statusOfFetchingProfileStats")) {
            // $NON-NLS-1$
            boolean disableErrorLabels = !object.isSuccessfulProfileStatsFetch();
            if (!disableErrorLabels) {
                String url = object.getProfileExportUrl();
                // $NON-NLS-1$
                boolean isBrickTabSelected = !url.contains(";nfsStatistics=true");
                initAnchor(url, isBrickTabSelected ? brickProfileAnchor : nfsProfileAnchor);
            }
            bricksError.setVisible(disableErrorLabels);
            nfsError.setVisible(disableErrorLabels);
        }
    });
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) RefreshActionIcon(org.ovirt.engine.ui.common.widget.dialog.RefreshActionIcon) Inject(com.google.inject.Inject) AbstractModelBoundPopupView(org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView) GWT(com.google.gwt.core.client.GWT) ListModelListBoxEditor(org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) UiBinder(com.google.gwt.uibinder.client.UiBinder) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) GlusterVolumeProfileStats(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats) Label(com.google.gwt.user.client.ui.Label) Alert(org.gwtbootstrap3.client.ui.Alert) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) EventBus(com.google.gwt.event.shared.EventBus) ElementIdHandler(org.ovirt.engine.ui.common.idhandler.ElementIdHandler) UiCommonEditorDriver(org.ovirt.engine.ui.common.editor.UiCommonEditorDriver) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) VolumeProfileStatisticsPopupPresenterWidget(org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster.VolumeProfileStatisticsPopupPresenterWidget) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) WithElementId(org.ovirt.engine.ui.common.idhandler.WithElementId) SimpleDialogPanel(org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel) BrickProfileDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickProfileDetails) FopStats(org.ovirt.engine.core.common.businessentities.gluster.FopStats) UiField(com.google.gwt.uibinder.client.UiField) ClickHandler(com.google.gwt.event.dom.client.ClickHandler)

Example 72 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project ovirt-engine by oVirt.

the class RefreshPanel method createDropdownMenu.

private void createDropdownMenu() {
    dropdownMenu = new DropDownMenu();
    dropdownMenu.setPull(Pull.LEFT);
    Set<Integer> refreshRates = AbstractRefreshManager.getRefreshRates();
    for (Integer refreshRate : refreshRates) {
        AnchorListItem refreshRateItem = new AnchorListItem();
        refreshRateItem.setText(MillisecondRenderer.getInstance().render(refreshRate));
        refreshRateItem.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                refreshManager.setCurrentRefreshRate(refreshRate);
                removeActiveStyles();
                refreshRateItem.addStyleName(Styles.ACTIVE);
            }
        });
        if (refreshManager.getCurrentRefreshRate() == refreshRate) {
            refreshRateItem.addStyleName(Styles.ACTIVE);
        }
        dropdownMenu.add(refreshRateItem);
    }
}
Also used : AnchorListItem(org.gwtbootstrap3.client.ui.AnchorListItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) DropDownMenu(org.gwtbootstrap3.client.ui.DropDownMenu) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 73 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project closure-compiler by google.

the class DebuggerGwtMain method createCheckboxes.

private void createCheckboxes(CellPanel checkboxPanel) {
    for (CompilationParam.ParamGroup group : CompilationParam.ParamGroup.values()) {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();
        builder.appendHtmlConstant("<b>");
        builder.appendEscaped(group.name);
        builder.appendHtmlConstant("</b>");
        checkboxPanel.add(new HTML(builder.toSafeHtml()));
        for (final CompilationParam param : CompilationParam.getGroupedSortedValues().get(group)) {
            CheckBox cb = new CheckBox(param.toString());
            if (param.getJavaInfo() != null) {
                cb.setTitle("Java API equivalent: " + param.getJavaInfo());
            }
            cb.setValue(param.getDefaultValue());
            param.apply(options, param.getDefaultValue());
            cb.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    boolean checked = ((CheckBox) event.getSource()).getValue();
                    param.apply(options, checked);
                    doCompile();
                }
            });
            checkboxPanel.add(cb);
        }
    }
}
Also used : CompilationParam(com.google.javascript.jscomp.debugger.common.CompilationParam) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CheckBox(com.google.gwt.user.client.ui.CheckBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) HTML(com.google.gwt.user.client.ui.HTML) SafeHtmlBuilder(com.google.gwt.safehtml.shared.SafeHtmlBuilder)

Example 74 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project webprotege by protegeproject.

the class EntityLabel method updateDisplay.

private void updateDisplay() {
    typeLabel.setText(entityData.getEntity().getEntityType().getName() + ": ");
    browserTextLabel.setText(entityData.getBrowserText());
    browserTextLabel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (selectionModel != null) {
                selectionModel.setSelection(entityData.getEntity());
            }
        }
    });
    iriLabel.setText("(" + entityData.getEntity().getIRI().toQuotedString() + ")");
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent)

Example 75 with ClickHandler

use of com.google.gwt.event.dom.client.ClickHandler in project gwt-cs by iSergio.

the class Terrain method buildPanel.

@Override
public void buildPanel() {
    csVPanel = new ViewerPanel();
    CesiumTerrainProviderOptions cesiumTerrainProviderOptions = new CesiumTerrainProviderOptions();
    cesiumTerrainProviderOptions.url = "https://assets.agi.com/stk-terrain/world";
    cesiumTerrainProviderOptions.requestWaterMask = true;
    cesiumTerrainProviderOptions.requestVertexNormals = true;
    cesiumTerrainProviderMeshes = new CesiumTerrainProvider(cesiumTerrainProviderOptions);
    csVPanel.getViewer().terrainProvider = cesiumTerrainProviderMeshes;
    Cartesian3 target = new Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
    Cartesian3 offset = new Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
    csVPanel.getViewer().camera.lookAt(target, offset);
    csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());
    ListBox terrainsLBox = new ListBox();
    terrainsLBox.setWidth("130px");
    terrainsLBox.addItem("CesiumTerrainProvider - STK World Terrain", "0");
    terrainsLBox.addItem("CesiumTerrainProvider - STK World Terrain - no effects", "1");
    terrainsLBox.addItem("CesiumTerrainProvider - STK World Terrain w/ Lighting", "2");
    terrainsLBox.addItem("CesiumTerrainProvider - STK World Terrain w/ Water", "3");
    terrainsLBox.addItem("EllipsoidTerrainProvider", "4");
    terrainsLBox.addItem("VRTheWorldTerrainProvider", "5");
    terrainsLBox.addItem("GeoserverTerrainProvider", "6");
    terrainsLBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            switch(source.getSelectedValue()) {
                case "0":
                    {
                        csVPanel.getViewer().terrainProvider = cesiumTerrainProviderMeshes;
                        csVPanel.getViewer().scene().globe.enableLighting = true;
                    }
                    break;
                case "1":
                    {
                        CesiumTerrainProviderOptions options = new CesiumTerrainProviderOptions();
                        options.url = "https://assets.agi.com/stk-terrain/world";
                        csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(options);
                    }
                    break;
                case "2":
                    {
                        CesiumTerrainProviderOptions options = new CesiumTerrainProviderOptions();
                        options.url = "https://assets.agi.com/stk-terrain/world";
                        options.requestVertexNormals = true;
                        csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(options);
                        csVPanel.getViewer().scene().globe.enableLighting = true;
                    }
                    break;
                case "3":
                    {
                        CesiumTerrainProviderOptions options = new CesiumTerrainProviderOptions();
                        options.url = "https://assets.agi.com/stk-terrain/world";
                        options.requestWaterMask = true;
                        csVPanel.getViewer().terrainProvider = new CesiumTerrainProvider(options);
                        csVPanel.getViewer().scene().globe.enableLighting = true;
                    }
                    break;
                case "4":
                    {
                        csVPanel.getViewer().terrainProvider = new EllipsoidTerrainProvider();
                    }
                    break;
                case "5":
                    {
                        VRTheWorldTerrainProviderOptions options = new VRTheWorldTerrainProviderOptions();
                        options.url = "http://www.vr-theworld.com/vr-theworld/tiles1.0.0/73/";
                        csVPanel.getViewer().terrainProvider = new VRTheWorldTerrainProvider(options);
                    }
                    break;
                case "6":
                    {
                        GeoserverTerrainProviderOptions options = new GeoserverTerrainProviderOptions();
                        options.url = "http://sergeserver.noip.me/geobase-portal/ows";
                        options.layerName = "geoserver:geobase:SRTM90";
                        options.styleName = "geobase:grayToColor";
                        csVPanel.getViewer().terrainProvider = new GeoserverTerrainProvider(options);
                    }
                    break;
                default:
                    break;
            }
        }
    });
    ListBox targetsLBox = new ListBox();
    targetsLBox.addItem("Mount Everest", "0");
    targetsLBox.addItem("Half Dome", "1");
    targetsLBox.addItem("San Francisco Bay", "2");
    targetsLBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            ListBox source = (ListBox) changeEvent.getSource();
            switch(source.getSelectedValue()) {
                case "0":
                    {
                        Cartesian3 target = new Cartesian3(300770.50872389384, 5634912.131394585, 2978152.2865545116);
                        Cartesian3 offset = new Cartesian3(6344.974098678562, -793.3419798081741, 2499.9508860763162);
                        csVPanel.getViewer().camera.lookAt(target, offset);
                        csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());
                    }
                    break;
                case "1":
                    {
                        Cartesian3 target = new Cartesian3(-2489625.0836225147, -4393941.44443024, 3882535.9454173897);
                        Cartesian3 offset = new Cartesian3(-6857.40902037546, 412.3284835694358, 2147.5545426812023);
                        csVPanel.getViewer().camera.lookAt(target, offset);
                        csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());
                    }
                    break;
                case "2":
                    {
                        Cartesian3 target = new Cartesian3(-2708814.85583248, -4254159.450845907, 3891403.9457429945);
                        Cartesian3 offset = new Cartesian3(70642.66030209465, -31661.517948317807, 35505.179997143336);
                        csVPanel.getViewer().camera.lookAt(target, offset);
                        csVPanel.getViewer().camera.lookAtTransform(Matrix4.IDENTITY());
                    }
                default:
                    break;
            }
        }
    });
    ToggleButton lightingTBtn = new ToggleButton("Toggle Lighting");
    lightingTBtn.setWidth("130px");
    lightingTBtn.setValue(true);
    lightingTBtn.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            csVPanel.getViewer().scene().globe.enableLighting = !csVPanel.getViewer().scene().globe.enableLighting;
        }
    });
    ToggleButton fogTBtn = new ToggleButton("Toggle Fog");
    fogTBtn.setWidth("130px");
    fogTBtn.setValue(true);
    fogTBtn.addValueChangeHandler(new ValueChangeHandler<Boolean>() {

        @Override
        public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
            csVPanel.getViewer().scene().fog.enabled = !csVPanel.getViewer().scene().fog.enabled;
        }
    });
    Button sampleBtn = new Button("Sample Everest Terrain");
    sampleBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            int gridWidth = 41;
            int gridHeight = 41;
            double everestLatitude = Math.toRadians(27.988257);
            double everestLongitude = Math.toRadians(86.925145);
            double rectangleHalfSize = 0.005;
            Rectangle e = new Rectangle(everestLongitude - rectangleHalfSize, everestLatitude - rectangleHalfSize, everestLongitude + rectangleHalfSize, everestLatitude + rectangleHalfSize);
            terrainSamplePositions = new ArrayList<>();
            for (int y = 0; y < gridHeight; ++y) {
                for (int x = 0; x < gridWidth; ++x) {
                    double lon = Math.lerp(e.west, e.east, (double) x / (gridWidth - 1.));
                    double lat = Math.lerp(e.south, e.north, (double) y / (gridHeight - 1.));
                    Cartographic position = new Cartographic(lon, lat);
                    terrainSamplePositions.add(position);
                }
            }
            Promise<Cartographic[], Void> promise = Cesium.sampleTerrain(csVPanel.getViewer().terrainProvider, 9, terrainSamplePositions.toArray(new Cartographic[terrainSamplePositions.size()]));
            promise.then(new Fulfill<Cartographic[]>() {

                @Override
                public void onFulfilled(Cartographic[] value) {
                    sampleTerrainSuccess();
                }
            });
        }
    });
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(targetsLBox);
    vPanel.add(terrainsLBox);
    vPanel.add(lightingTBtn);
    vPanel.add(fogTBtn);
    vPanel.add(sampleBtn);
    AbsolutePanel aPanel = new AbsolutePanel();
    aPanel.add(csVPanel);
    aPanel.add(vPanel, 20, 20);
    contentPanel.add(new HTML("<p>Visualize worldwide, high-resolution terrain.</p>"));
    contentPanel.add(aPanel);
    initWidget(contentPanel);
}
Also used : VRTheWorldTerrainProvider(org.cesiumjs.cs.core.providers.VRTheWorldTerrainProvider) CesiumTerrainProviderOptions(org.cesiumjs.cs.core.providers.options.CesiumTerrainProviderOptions) EllipsoidTerrainProvider(org.cesiumjs.cs.core.providers.EllipsoidTerrainProvider) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) GeoserverTerrainProviderOptions(org.cesiumjs.cs.core.providers.options.GeoserverTerrainProviderOptions) VRTheWorldTerrainProviderOptions(org.cesiumjs.cs.core.providers.options.VRTheWorldTerrainProviderOptions) ValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CesiumTerrainProvider(org.cesiumjs.cs.core.providers.CesiumTerrainProvider) Fulfill(org.cesiumjs.cs.promise.Fulfill) ViewerPanel(org.cesiumjs.cs.widgets.ViewerPanel) Promise(org.cesiumjs.cs.promise.Promise) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ValueChangeEvent(com.google.gwt.event.logical.shared.ValueChangeEvent) GeoserverTerrainProvider(org.cesiumjs.cs.core.providers.GeoserverTerrainProvider)

Aggregations

ClickHandler (com.google.gwt.event.dom.client.ClickHandler)447 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)437 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)168 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)143 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)129 ArrayList (java.util.ArrayList)128 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)110 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)79 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)48 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)47 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)41 PerunError (cz.metacentrum.perun.webgui.model.PerunError)38 HashMap (java.util.HashMap)37 Button (com.google.gwt.user.client.ui.Button)35 HTML (com.google.gwt.user.client.ui.HTML)34 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)33 Button (org.gwtbootstrap3.client.ui.Button)33 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)31 Image (com.google.gwt.user.client.ui.Image)30 Map (java.util.Map)27