org.tizen.injector.sensor.light_1.0.0.201310291329

16:50:07.622 INFO  jd.cli.Main - Decompiling org.tizen.injector.sensor.light_1.0.0.201310291329.jar
package org.tizen.injector.sensor.light;

import org.tizen.injector.provider.AbstractInjectorItem;
import org.tizen.injector.sensor.light.page.LightPage;

public class Light
  extends AbstractInjectorItem
{
  protected void addPages()
  {
    addPage(new LightPage(this, "Light"));
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.Light
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.sensor.light.page;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Text;

class LightPage$1
  implements SelectionListener
{
  LightPage$1(LightPage paramLightPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent)
  {
    int i = LightPage.access$0(this$0).getSelection();
    LightPage.access$1(this$0, i);
    LightPage.access$2(this$0).setText(Integer.toString(LightPage.access$3(this$0)));
  }
  
  public void widgetDefaultSelected(SelectionEvent paramSelectionEvent) {}
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.page.LightPage.1
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.sensor.light.page;

import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;

class LightPage$2
  implements MouseListener
{
  LightPage$2(LightPage paramLightPage) {}
  
  public void mouseDoubleClick(MouseEvent paramMouseEvent) {}
  
  public void mouseDown(MouseEvent paramMouseEvent) {}
  
  public void mouseUp(MouseEvent paramMouseEvent)
  {
    LightPage.access$4(this$0);
    this$0.sendMessage(1, LightPage.access$5(this$0));
    this$0.sendMessage(2, LightPage.access$3(this$0));
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.page.LightPage.2
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.sensor.light.page;

import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;

class LightPage$3
  implements KeyListener
{
  LightPage$3(LightPage paramLightPage) {}
  
  public void keyPressed(KeyEvent paramKeyEvent) {}
  
  public void keyReleased(KeyEvent paramKeyEvent)
  {
    LightPage.access$4(this$0);
    this$0.sendMessage(1, LightPage.access$5(this$0));
    this$0.sendMessage(2, LightPage.access$3(this$0));
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.page.LightPage.3
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.sensor.light.page;

import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Text;
import org.tizen.injector.InjectorDialog;

class LightPage$4
  implements SelectionListener
{
  LightPage$4(LightPage paramLightPage) {}
  
  public void widgetSelected(SelectionEvent paramSelectionEvent) {}
  
  public void widgetDefaultSelected(SelectionEvent paramSelectionEvent)
  {
    String str = LightPage.access$2(this$0).getText().trim();
    if ((str == null) || (str.length() == 0)) {
      return;
    }
    try
    {
      if ((LightPage.checkNumberFormat(str)) || (Double.parseDouble(str) <= 0.0D) || (Double.parseDouble(str) > 65535.0D)) {
        throw null;
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      localShell = LightPage.access$6(this$0).getShell();
      InjectorDialog.openInfoDialog(localShell, InjectorDialog.TITLE, "Please enter an positive integer number of units.\nLux can be entered in the range of 1 to 65535.");
      LightPage.access$2(this$0).setText(Integer.toString(LightPage.access$3(this$0)));
      return;
    }
    catch (Exception localException)
    {
      Shell localShell = LightPage.access$6(this$0).getShell();
      InjectorDialog.openInfoDialog(localShell, InjectorDialog.TITLE, "Please enter an positive integer number of units.\nLux can be entered in the range of 1 to 65535.");
      LightPage.access$2(this$0).setText(Integer.toString(LightPage.access$3(this$0)));
      return;
    }
    LightPage.access$1(this$0, Integer.parseInt(str));
    LightPage.access$0(this$0).setSelection(LightPage.access$3(this$0));
    LightPage.access$4(this$0);
    this$0.sendMessage(1, LightPage.access$5(this$0));
    this$0.sendMessage(2, LightPage.access$3(this$0));
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.page.LightPage.4
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.tizen.injector.sensor.light.page;

import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Slider;
import org.eclipse.swt.widgets.Text;
import org.tizen.common.connection.ConnectionPlugin;
import org.tizen.common.connection.ConnectionPlugin.ISelectionListener;
import org.tizen.injector.InjectorDialog;
import org.tizen.injector.protocol.sensor.TestSensorMessage;
import org.tizen.injector.provider.AbstractInjectorItem;
import org.tizen.injector.provider.AbstractInjectorPage;
import org.tizen.injector.socket.TelephonySocket;
import org.tizen.injector.util.FormPageUtil;
import org.tizen.injector.view.InjectorView;
import org.tizen.sdblib.IDevice;
import org.tizen.sdblib.service.FileEntry;

public class LightPage
  extends AbstractInjectorPage
  implements ConnectionPlugin.ISelectionListener
{
  private Text sliderText;
  private Text luxText;
  private Button injectLux;
  private Slider slider;
  private final String sensorNumber = "3\n";
  private final String lightLevel = "Level";
  private int luxData = 65535;
  private int levelData = 10;
  private IDevice currentDevice;
  
  public LightPage(AbstractInjectorItem paramAbstractInjectorItem, String paramString)
  {
    super(paramAbstractInjectorItem, paramString);
  }
  
  public static boolean checkNumberFormat(String paramString)
  {
    Pattern localPattern = Pattern.compile("[^0-9]");
    Matcher localMatcher = localPattern.matcher(paramString);
    return localMatcher.find();
  }
  
  protected void createContents()
  {
    InjectorView.getDefault().addSelectionListener(this);
    currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
    Composite localComposite = formUtil.createComposite(parent, 4);
    GridData localGridData = new GridData(4, 4, false, true);
    widthHint = 560;
    localComposite.setLayoutData(localGridData);
    formUtil.createLabel(localComposite, "Lux  ");
    slider = formUtil.createSlider(localComposite);
    localGridData = new GridData(0, 16777216, false, true);
    widthHint = 460;
    slider.setLayoutData(localGridData);
    setDefaultSlider(slider);
    slider.setSelection(luxData);
    slider.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        int i = slider.getSelection();
        luxData = i;
        luxText.setText(Integer.toString(luxData));
      }
      
      public void widgetDefaultSelected(SelectionEvent paramAnonymousSelectionEvent) {}
    });
    slider.addMouseListener(new MouseListener()
    {
      public void mouseDoubleClick(MouseEvent paramAnonymousMouseEvent) {}
      
      public void mouseDown(MouseEvent paramAnonymousMouseEvent) {}
      
      public void mouseUp(MouseEvent paramAnonymousMouseEvent)
      {
        LightPage.this.setLevelData();
        sendMessage(1, levelData);
        sendMessage(2, luxData);
      }
    });
    slider.addKeyListener(new KeyListener()
    {
      public void keyPressed(KeyEvent paramAnonymousKeyEvent) {}
      
      public void keyReleased(KeyEvent paramAnonymousKeyEvent)
      {
        LightPage.this.setLevelData();
        sendMessage(1, levelData);
        sendMessage(2, luxData);
      }
    });
    luxData = slider.getSelection();
    luxText = formUtil.createText(localComposite, luxData);
    luxText.setTextLimit(5);
    luxText.addSelectionListener(new SelectionListener()
    {
      public void widgetSelected(SelectionEvent paramAnonymousSelectionEvent) {}
      
      public void widgetDefaultSelected(SelectionEvent paramAnonymousSelectionEvent)
      {
        String str = luxText.getText().trim();
        if ((str == null) || (str.length() == 0)) {
          return;
        }
        try
        {
          if ((LightPage.checkNumberFormat(str)) || (Double.parseDouble(str) <= 0.0D) || (Double.parseDouble(str) > 65535.0D)) {
            throw null;
          }
        }
        catch (NumberFormatException localNumberFormatException)
        {
          localShell = parent.getShell();
          InjectorDialog.openInfoDialog(localShell, InjectorDialog.TITLE, "Please enter an positive integer number of units.\nLux can be entered in the range of 1 to 65535.");
          luxText.setText(Integer.toString(luxData));
          return;
        }
        catch (Exception localException)
        {
          Shell localShell = parent.getShell();
          InjectorDialog.openInfoDialog(localShell, InjectorDialog.TITLE, "Please enter an positive integer number of units.\nLux can be entered in the range of 1 to 65535.");
          luxText.setText(Integer.toString(luxData));
          return;
        }
        luxData = Integer.parseInt(str);
        slider.setSelection(luxData);
        LightPage.this.setLevelData();
        sendMessage(1, levelData);
        sendMessage(2, luxData);
      }
    });
    boolean bool = checkDeviceConnectedAlready();
    if (bool) {
      connect();
    }
  }
  
  private void setLevelData()
  {
    levelData = (luxData / 6554 % 10 + 1);
  }
  
  private void setDefaultSlider(Slider paramSlider)
  {
    paramSlider.setMinimum(1);
    paramSlider.setMaximum(65536);
    paramSlider.setIncrement(1);
    paramSlider.setThumb(1);
  }
  
  private boolean checkDeviceConnectedAlready()
  {
    return currentDevice != null;
  }
  
  protected void registerReceivers() {}
  
  public void sendMessage(int paramInt1, int paramInt2)
  {
    TestSensorMessage localTestSensorMessage = new TestSensorMessage(paramInt1, paramInt2);
    try
    {
      injectorSocket.sendSensor("3\n" + localTestSensorMessage.getMessage());
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
  
  public void connect()
  {
    currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
    setLevelData();
    sendMessage(1, levelData);
    sendMessage(2, luxData);
  }
  
  public void disconnect() {}
  
  protected void finalize()
    throws Throwable
  {
    InjectorView.getDefault().removeSelectionListener(this);
    super.finalize();
  }
  
  public void selectionChanged(FileEntry paramFileEntry)
  {
    if (paramFileEntry == null)
    {
      disconnect();
    }
    else
    {
      String str = paramFileEntry.getDevice().getSerialNumber();
      if (currentDevice == null)
      {
        if (str != null) {
          connect();
        }
      }
      else if (currentDevice.getSerialNumber() != str)
      {
        disconnect();
        connect();
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.tizen.injector.sensor.light.page.LightPage
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd