Package org.jampa.preferences.pages

Source Code of org.jampa.preferences.pages.OSDPage

/*
* Jampa
* Copyright (C) 2008-2009 J. Devauchelle and contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 3 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*/

package org.jampa.preferences.pages;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jampa.Activator;
import org.jampa.gui.translations.Messages;
import org.jampa.preferences.PreferenceConstants;

public class OSDPage extends  FieldEditorPreferencePage implements IWorkbenchPreferencePage {

  private BooleanFieldEditor _useOSD;
  private BooleanFieldEditor _onlyShowMinimized;
  private IntegerFieldEditor _OSDDelay;
  private BooleanFieldEditor _useAlpha;
 
  public OSDPage() {
    super(GRID);
    setPreferenceStore(Activator.getDefault().getPreferenceStore());
    setDescription(Messages.getString("OSDPage.Title")); //$NON-NLS-1$ 
  }
 
  @Override
  public void init(IWorkbench workbench) {       
  }
 
  protected void initialize() {
    super.initialize();
    setAllEnableValue(_useOSD.getBooleanValue());
  }
 
  public void propertyChange(PropertyChangeEvent event) {   
    if (event.getSource().equals(_useOSD)) {
      setAllEnableValue(_useOSD.getBooleanValue());
    }
  }
 
  public void setAllEnableValue(boolean value) {
    _onlyShowMinimized.setEnabled(value, getFieldEditorParent());
  }
 
  @Override
  protected void createFieldEditors() {   
    Label horizontalLine;
    Label descLabel;
   
    horizontalLine = new Label(getFieldEditorParent(), SWT.NONE);
    horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
 
    descLabel = new Label(getFieldEditorParent(), SWT.NONE);
    descLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
    descLabel.setText(Messages.getString("OSDPage.OSDActivations"));
   
    _useOSD = new BooleanFieldEditor(PreferenceConstants.OSD_SHOW,
        Messages.getString("OSDPage.UseOSD"), //$NON-NLS-1$
        getFieldEditorParent());
    addField(_useOSD);
   
    _onlyShowMinimized = new BooleanFieldEditor(PreferenceConstants.OSD_ONLY_SHOW_MINIMIZED,
        Messages.getString("OSDPage.OnlyShowMinimized"), //$NON-NLS-1$
        getFieldEditorParent());
    addField(_onlyShowMinimized);
   
    addField(new BooleanFieldEditor(PreferenceConstants.OSD_SHOW_ON_PODCAST_UPDATE,
        Messages.getString("OSDPage.ShowOnPodcastUpdate"), //$NON-NLS-1$
        getFieldEditorParent()));
   
    addField(new BooleanFieldEditor(PreferenceConstants.OSD_SHOW_ON_PODCAST_DOWNLOAD_END,
        Messages.getString("OSDPage.ShowOnPodcastDownloadEnd"), //$NON-NLS-1$
        getFieldEditorParent()));
   
    horizontalLine = new Label(getFieldEditorParent(), SWT.NONE);
    horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
   
    descLabel = new Label(getFieldEditorParent(), SWT.NONE);
    descLabel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
    descLabel.setText(Messages.getString("OSDPage.OSDParameters"));
   
    _useAlpha = new BooleanFieldEditor(PreferenceConstants.OSD_USE_ALPHA,
        Messages.getString("OSDPage.UseAlpha"), //$NON-NLS-1$
        getFieldEditorParent());
    addField(_useAlpha);
   
    _OSDDelay = new IntegerFieldEditor(PreferenceConstants.OSD_DELAY,
        Messages.getString("OSDPage.OSDDelay"), //$NON-NLS-1$
        getFieldEditorParent());
    addField(_OSDDelay);        
  }
 
  protected void performDefaults() {
    super.performDefaults();
    setAllEnableValue(_useOSD.getBooleanValue());
  }
 
}
TOP

Related Classes of org.jampa.preferences.pages.OSDPage

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.