001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.rest.widget;
014
015import static org.apache.juneau.dto.html5.HtmlBuilder.*;
016
017import org.apache.juneau.dto.html5.*;
018import org.apache.juneau.rest.*;
019import org.apache.juneau.utils.*;
020
021/**
022 * @deprecated Use {@link ThemeMenuItem}
023 */
024@Deprecated
025public class StyleMenuItem extends MenuItemWidget {
026
027   private static final String[] BUILT_IN_STYLES = {"devops", "light", "original", "dark"};
028
029   @Override /* Widget */
030   public String getLabel(RestRequest req) {
031      return "styles";
032   }
033   /**
034    * Looks at the supported media types from the request and constructs a list of hyperlinks to render the data
035    * as plain-text.
036    */
037   @Override /* MenuItemWidget */
038   public Div getContent(RestRequest req) throws Exception {
039      Div div = div();
040      for (String s : BUILT_IN_STYLES) {
041         java.net.URI uri = req.getUri(true, new AMap<String,String>().append("stylesheet", "styles/"+s+".css"));
042         div.children(a(uri, s), br());
043      }
044      return div;
045   }
046}