/*
* Copyright 2000-2018 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.vaadin.server;
/**
* A generic implementation of {@link FontIcon} interface.
*
* @since 7.5.0
* @author Vaadin Ltd
*/
@SuppressWarnings("serial")
public class GenericFontIcon implements FontIcon {
private final String fontFamily;
private final int codePoint;
/**
* Creates a new instance of GenericFontIcon with given font family and
* codepoint.
*
* @param fontFamily
* Name of the type face that is used to display icons
* @param codepoint
* Numerical code point in the font
*/
public GenericFontIcon(String fontFamily, int codepoint) {
this.fontFamily = fontFamily;
codePoint = codepoint;
}
/*
* (non-Javadoc)
*
* @see com.vaadin.server.FontIcon#getFontFamily()
*/
@Override
public String getFontFamily() {
return fontFamily;
}
/*
* (non-Javadoc)
*
* @see com.vaadin.server.Resource#getMIMEType()
*/
@Override
public String getMIMEType() {
throw new UnsupportedOperationException(FontIcon.class.getSimpleName()
+ " should not be used where a MIME type is needed.");
}
/*
* (non-Javadoc)
*
* @see com.vaadin.server.FontIcon#getCodepoint()
*/
@Override
public int getCodepoint() {
return codePoint;
}
/*
* (non-Javadoc)
*
* @see com.vaadin.server.FontIcon#getHtml()
*/
@Override
public String getHtml() {
return getHtml(fontFamily, codePoint);
}
/**
* Utility method for generating HTML that displays an icon from specific
* fontFamiliy with a given codePoint in the font.
*
* @param fontFamily
* Name of the font family
* @param codePoint
* Icon's character code point in the font
* @return
*/
public static String getHtml(String fontFamily, int codePoint) {
return "" + Integer.toHexString(codePoint) + ";";
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + codePoint;
result = prime * result
+ ((fontFamily == null) ? 0 : fontFamily.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GenericFontIcon)) {
return false;
}
GenericFontIcon other = (GenericFontIcon) obj;
if (codePoint != other.codePoint) {
return false;
}
if (fontFamily == null) {
if (other.fontFamily != null) {
return false;
}
} else if (!fontFamily.equals(other.fontFamily)) {
return false;
}
return true;
}
}
x.html?h=dependabot/github_actions/github-actions-f50e11107c&id=232fe3bafad09ac8fe0270cd5d09ff6b47bee76c'>diffstats
blob: f853a79aa187009bddb7e14b0e8183051ca6b094 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Slider Demos</title>
</head>
<body>
<ul>
<li><a href="default.html">Default functionality</a></li>
<li><a href="steps.html">Snap to increments</a></li>
<li><a href="range.html">Range slider</a></li>
<li><a href="rangemin.html">Range with fixed minimum</a></li>
<li><a href="hotelrooms.html">Room reservation</a></li>
<li><a href="rangemax.html">Range with fixed maximum</a></li>
<li><a href="slider-vertical.html">Vertical slider</a></li>
<li><a href="range-vertical.html">Vertical range slider</a></li>
<li><a href="multiple-vertical.html">Multiple sliders</a></li>
<li><a href="colorpicker.html">Simple colorpicker</a></li>
<li><a href="custom-handle.html">Custom handle</a></li>
</ul>
</body>
</html>
|