
it.tidalwave.netbeans.lookandfeel.action.AbstractLightAction Maven / Gradle / Ivy
The newest version!
/***********************************************************************************************************************
*
* SolidBlue - open source safe data
* Copyright (C) 2011-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* 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.
*
***********************************************************************************************************************
*
* WWW: http://solidblue.java.net
* SCM: https://bitbucket.org/tidalwave/solidblue-src
*
**********************************************************************************************************************/
package it.tidalwave.netbeans.lookandfeel.action;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import it.tidalwave.netbeans.lookandfeel.impl.LightDimmerController;
/*******************************************************************************
*
* @author Fabrizio Giudici
* @version $Id$
*
******************************************************************************/
public class AbstractLightAction extends CallableSystemAction // can't use EnhancedCallableSystemAction because of a dependency loop
{
private final float intensity;
private final String name;
public final static float[] VALUES = { 1f, 0.2f, 0f };
/***************************************************************************
*
*
**************************************************************************/
public AbstractLightAction (final float intensity)
{
String temp = getClass().getName();
final int i = temp.lastIndexOf('.');
if (i >= 0)
{
temp = temp.substring(i + 1);
}
name = temp;
this.intensity = intensity;
}
/***************************************************************************
*
*
**************************************************************************/
@Override
public void performAction()
{
LightDimmerController.getInstance().setIntensitySmoothly(intensity);
}
/***************************************************************************
*
*
**************************************************************************/
@Override
public String getName()
{
return NbBundle.getMessage(getClass(), "CTL_" + name);
}
/***************************************************************************
*
*
**************************************************************************/
@Override
protected String iconResource()
{
putValue("noIconInMenu", Boolean.TRUE);
return super.iconResource();
}
/***************************************************************************
*
*
**************************************************************************/
@Override
public HelpCtx getHelpCtx()
{
return HelpCtx.DEFAULT_HELP;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy