001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.console.widgets; 018 019/** 020 * A client-only {@link ActionBarItem} with no endpoint. 021 * 022 * <p> 023 * This slice ships {@link #COLLAPSE} (collapse the child row). Unlike an {@link ActionRef}, a safe action is 024 * enabled immediately — including during an in-flight expand GET and after a failed GET — so the 025 * user can dismiss a loading or error panel. 026 * 027 * @since 10.0.0 028 */ 029public enum SafeAction implements ActionBarItem { 030 031 /** Collapse the expanded child row. */ 032 COLLAPSE("collapse", "Collapse"); 033 034 private final String wire; 035 private final String label; 036 037 SafeAction(String wire, String label) { 038 this.wire = wire; 039 this.label = label; 040 } 041 042 /** 043 * Returns the wire token stamped onto {@code data-juneau-safe}. 044 * 045 * @return The wire token (e.g. {@code "collapse"}). 046 */ 047 public String wire() { 048 return wire; 049 } 050 051 /** 052 * Returns the built-in button label, painted with {@code textContent}. 053 * 054 * @return The label. 055 */ 056 public String label() { 057 return label; 058 } 059}