001/* 002 * #%L 003 * GwtMaterial 004 * %% 005 * Copyright (C) 2015 - 2017 GwtMaterialDesign 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package gwt.material.design.client.ui.html; 021 022import com.google.gwt.dom.client.Document; 023import com.google.gwt.dom.client.OptGroupElement; 024import gwt.material.design.client.base.MaterialWidget; 025 026/** 027 * @author kevzlou7979 028 */ 029public class OptGroup extends MaterialWidget { 030 031 public OptGroup() { 032 super(Document.get().createOptGroupElement()); 033 } 034 035 public OptGroup(String value) { 036 this(); 037 setLabel(value); 038 } 039 040 /** 041 * Option label for use in hierarchical menus. 042 * 043 * @see <a 044 * href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-label-OPTION">W3C 045 * HTML Specification</a> 046 */ 047 public String getLabel() { 048 return OptGroupElement.as(this.getElement()).getLabel(); 049 } 050 051 /** 052 * The control is unavailable in this context. 053 * 054 * @see <a 055 * href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C 056 * HTML Specification</a> 057 */ 058 public boolean isDisabled() { 059 return OptGroupElement.as(this.getElement()).isDisabled(); 060 } 061 062 /** 063 * The control is unavailable in this context. 064 * 065 * @see <a 066 * href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-disabled">W3C 067 * HTML Specification</a> 068 */ 069 public void setDisabled(boolean disabled) { 070 OptGroupElement.as(this.getElement()).setDisabled(disabled); 071 } 072 073 ; 074 075 /** 076 * Option label for use in hierarchical menus. 077 * 078 * @see <a 079 * href="http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#adef-label-OPTION">W3C 080 * HTML Specification</a> 081 */ 082 public void setLabel(String label) { 083 OptGroupElement.as(this.getElement()).setLabel(label); 084 } 085}