LCOV - code coverage report
Current view: top level - extensions/webui - UiResult.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 0 11 0.0 %
Date: 2022-11-19 15:00:39 Functions: 0 4 0.0 %

          Line data    Source code
       1             : // Copyright (C) 2014 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.extensions.webui;
      16             : 
      17             : import java.net.URI;
      18             : 
      19             : /** Default result for {@link UiAction}s with no JavaScript. */
      20             : public class UiResult {
      21             :   /** Display an alert message to the user. */
      22             :   public static UiResult alert(String message) {
      23           0 :     UiResult r = new UiResult();
      24           0 :     r.alert = message;
      25           0 :     return r;
      26             :   }
      27             : 
      28             :   /** Launch URL in a new window. */
      29             :   public static UiResult openUrl(URI uri) {
      30           0 :     return openUrl(uri.toString());
      31             :   }
      32             : 
      33             :   /** Launch URL in a new window. */
      34             :   public static UiResult openUrl(String url) {
      35           0 :     UiResult r = new UiResult();
      36           0 :     r.url = url;
      37           0 :     r.openWindow = true;
      38           0 :     return r;
      39             :   }
      40             : 
      41             :   /** Redirect the browser to a new URL. */
      42             :   public static UiResult redirectUrl(String url) {
      43           0 :     UiResult r = new UiResult();
      44           0 :     r.url = url;
      45           0 :     return r;
      46             :   }
      47             : 
      48             :   /** Alert the user with a message. */
      49             :   protected String alert;
      50             : 
      51             :   /** If present redirect browser to this URL. */
      52             :   protected String url;
      53             : 
      54             :   /** When true open {@link #url} in a new tab/window. */
      55             :   protected Boolean openWindow;
      56             : 
      57             :   private UiResult() {}
      58             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750