use of java.util.Dictionary in project sling by apache.
the class XingLoginAuthenticationHandler method configure.
protected void configure(final ComponentContext context) {
final Dictionary properties = context.getProperties();
consumerKey = PropertiesUtil.toString(properties.get(CONSUMER_KEY_PARAMETER), "").trim();
userCookie = PropertiesUtil.toString(properties.get(USER_COOKIE_PARAMETER), DEFAULT_USER_COOKIE).trim();
userIdCookie = PropertiesUtil.toString(properties.get(USERID_COOKIE_PARAMETER), DEFAULT_USERID_COOKIE).trim();
maxCookieSize = PropertiesUtil.toInteger(properties.get(MAX_COOKIE_SIZE_PARAMETER), DEFAULT_MAX_COOKIE_SIZE);
loginPath = PropertiesUtil.toString(properties.get(LOGIN_PATH_PARAMETER), "").trim();
logoutPath = PropertiesUtil.toString(properties.get(LOGOUT_PATH_PARAMETER), "").trim();
if (StringUtils.isEmpty(consumerKey)) {
logger.warn("configured consumer key is empty");
xingCookie = "";
} else {
xingCookie = XingLogin.XING_COOKIE_PREFIX.concat(consumerKey);
}
if (loginPageRegistration != null) {
loginPageRegistration.unregister();
}
if (StringUtils.isEmpty(loginPath)) {
logger.warn("configured login path is empty");
} else {
final Dictionary<String, Object> loginPathProperties = new Hashtable<String, Object>();
final String[] authRequirements = new String[] { "-".concat(loginPath) };
loginPathProperties.put(AuthConstants.AUTH_REQUIREMENTS, authRequirements);
loginPageRegistration = context.getBundleContext().registerService(Object.class.getName(), new Object(), loginPathProperties);
}
if (StringUtils.isEmpty(logoutPath)) {
logger.warn("configured logout path is empty");
}
logger.info("configured with consumer key '{}', cookie name '{}', login path '{}' and logout path '{}'", consumerKey, xingCookie, loginPath, logoutPath);
}
use of java.util.Dictionary in project jdk8u_jdk by JetBrains.
the class BasicSliderUI method paintLabels.
public void paintLabels(Graphics g) {
Rectangle labelBounds = labelRect;
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
Enumeration keys = dictionary.keys();
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
boolean enabled = slider.isEnabled();
while (keys.hasMoreElements()) {
Integer key = (Integer) keys.nextElement();
int value = key.intValue();
if (value >= minValue && value <= maxValue) {
JComponent label = (JComponent) dictionary.get(key);
label.setEnabled(enabled);
if (label instanceof JLabel) {
Icon icon = label.isEnabled() ? ((JLabel) label).getIcon() : ((JLabel) label).getDisabledIcon();
if (icon instanceof ImageIcon) {
// Register Slider as an image observer. It allows to catch notifications about
// image changes (e.g. gif animation)
Toolkit.getDefaultToolkit().checkImage(((ImageIcon) icon).getImage(), -1, -1, slider);
}
}
if (slider.getOrientation() == JSlider.HORIZONTAL) {
g.translate(0, labelBounds.y);
paintHorizontalLabel(g, value, label);
g.translate(0, -labelBounds.y);
} else {
int offset = 0;
if (!BasicGraphicsUtils.isLeftToRight(slider)) {
offset = labelBounds.width - label.getPreferredSize().width;
}
g.translate(labelBounds.x + offset, 0);
paintVerticalLabel(g, value, label);
g.translate(-labelBounds.x - offset, 0);
}
}
}
}
}
use of java.util.Dictionary in project jdk8u_jdk by JetBrains.
the class BasicSliderUI method labelsHaveSameBaselines.
/**
* Returns true if all the labels from the label table have the same
* baseline.
*
* @return true if all the labels from the label table have the
* same baseline
* @since 1.6
*/
protected boolean labelsHaveSameBaselines() {
if (!checkedLabelBaselines) {
checkedLabelBaselines = true;
Dictionary dictionary = slider.getLabelTable();
if (dictionary != null) {
sameLabelBaselines = true;
Enumeration elements = dictionary.elements();
int baseline = -1;
while (elements.hasMoreElements()) {
JComponent label = (JComponent) elements.nextElement();
Dimension pref = label.getPreferredSize();
int labelBaseline = label.getBaseline(pref.width, pref.height);
if (labelBaseline >= 0) {
if (baseline == -1) {
baseline = labelBaseline;
} else if (baseline != labelBaseline) {
sameLabelBaselines = false;
break;
}
} else {
sameLabelBaselines = false;
break;
}
}
} else {
sameLabelBaselines = false;
}
}
return sameLabelBaselines;
}
use of java.util.Dictionary in project jdk8u_jdk by JetBrains.
the class BasicSliderUI method getHeightOfTallestLabel.
protected int getHeightOfTallestLabel() {
Dictionary dictionary = slider.getLabelTable();
int tallest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
tallest = Math.max(label.getPreferredSize().height, tallest);
}
}
return tallest;
}
use of java.util.Dictionary in project jdk8u_jdk by JetBrains.
the class BasicSliderUI method getWidthOfWidestLabel.
protected int getWidthOfWidestLabel() {
Dictionary dictionary = slider.getLabelTable();
int widest = 0;
if (dictionary != null) {
Enumeration keys = dictionary.keys();
while (keys.hasMoreElements()) {
JComponent label = (JComponent) dictionary.get(keys.nextElement());
widest = Math.max(label.getPreferredSize().width, widest);
}
}
return widest;
}
Aggregations