return new CenterPanel ( sourceButton, false, true );
}
private static Component createPresentationButton ( final Example example )
{
final WebToggleButton presentation = new WebToggleButton ( presentationIcon );
presentation.setRolloverDecoratedOnly ( true );
presentation.setFocusable ( false );
presentation.setEnabled ( example.isPresentationAvailable () );
TooltipManager.setTooltip ( presentation, presentationIcon,
example.isPresentationAvailable () ? "Show presentation" : "There is no presentation available for this component",
TooltipWay.up );
if ( presentation.isEnabled () )
{
presentation.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
if ( presentation.isSelected () )
{
example.startPresentation ();
TooltipManager.setTooltip ( presentation, presentationIcon, "Stop presentation", TooltipWay.up );
}
else
{
example.stopPresentation ();
TooltipManager.setTooltip ( presentation, presentationIcon, "Show presentation", TooltipWay.up );
}
}
} );
example.doWhenPresentationFinished ( new Runnable ()
{
@Override
public void run ()
{
presentation.setSelected ( false );
TooltipManager.setTooltip ( presentation, presentationIcon, "Show presentation", TooltipWay.up );
ThreadUtils.sleepSafely ( 250 );
final WebCustomTooltip end =