Spark 연구 노트 5: 주요 공장 유형 Native Manager(오리지널)
9537 단어 manager
public class FlashingHandler implements NativeHandler {
private FlashWindow flasher;
public FlashingHandler() {
flasher = new FlashWindow();
}
@Override
public void flashWindow(Window window) {
FlashingPreference preference = (FlashingPreference) SparkManager.getPreferenceManager().getPreference(FlashingPreference.NAMESPACE);
if (preference.getPreferences().isFlashingEnabled()) {
if (preference.getPreferences().getFlashingType().equals(FlashingPreferences.TYPE_CONTINOUS)) {
flasher.startFlashing(window);
}
else if (preference.getPreferences().getFlashingType().equals(FlashingPreferences.TYPE_TEMPORARY)) {
flasher.flash(window, 1500, 5);
}
}
}
실제로 전체 프로젝트의 Native Manager가 실례화된 적이 없다는 것은 정말 이상한 일이지만, 이런 종류는 특별히 중요한 것이 아니다.
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2011 Jive Software. All rights reserved.
*
* 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 org.jivesoftware.spark;
import java.awt.Window;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jivesoftware.spark.util.ModelUtil;
/**
* The AlertManager handles the delegation of Alerting based.
*
* @author Derek DeMoro
*/
public class NativeManager {
private List<NativeHandler> nativeHandlers = new ArrayList<NativeHandler>();
public NativeManager() {
}
/**
* Adds an alert.
*
* @param nativeHandler the Alerter to add.
*/
public void addNativeHandler(NativeHandler nativeHandler) {
nativeHandlers.add(nativeHandler);
}
/**
* Removes an alerter.
*
* @param nativeHandler the alerter to remove.
*/
public void removeNativeHandler(NativeHandler nativeHandler) {
nativeHandlers.remove(nativeHandler);
}
/**
* Flash the given window.
*
* @param window the window to flash.
*/
public void flashWindow(Window window) {
final Iterator<NativeHandler> alertNotifier = ModelUtil.reverseListIterator(nativeHandlers.listIterator());
while (alertNotifier.hasNext()) {
final NativeHandler alert = alertNotifier.next();
boolean handle = alert.handleNotification();
if (handle) {
alert.flashWindow(window);
}
}
}
/**
* Flash the given window, but stop flashing when the window takes focus.
*
* @param window the window to start flashing.
*/
public void flashWindowStopOnFocus(Window window) {
final Iterator<NativeHandler> alertNotifiers = ModelUtil.reverseListIterator(nativeHandlers.listIterator());
while (alertNotifiers.hasNext()) {
final NativeHandler alert = alertNotifiers.next();
boolean handle = alert.handleNotification();
if (handle) {
alert.flashWindowStopWhenFocused(window);
}
}
}
/**
* Stop the flashing of the window.
*
* @param window the window to stop flashing.
*/
public void stopFlashing(Window window) {
final Iterator<NativeHandler> alertNotifiers = ModelUtil.reverseListIterator(nativeHandlers.listIterator());
while (alertNotifiers.hasNext()) {
final NativeHandler alert = alertNotifiers.next();
boolean handle = alert.handleNotification();
if (handle) {
alert.stopFlashing(window);
}
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Lua 리 디자인 줄거리 체인result: >lua -e "io.stdout:setvbuf 'no'""Main.lua" ---------- initScene ---------- on EVENTS: 1313262659 | Map: 7 on ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.