Beispiel #1
0
  @Override
  public void init() {

    // linking this property with the behavior defined in the XML
    volume = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior("volume"));
    volume.addListener(
        new RangedIntBehaviorLogic.Listener() {
          @Override
          public void onLowerBoundValue(Config params, boolean fireCommand) {
            // turnPowerOff(params);
            onRangeValue(volume.getMin(), params, fireCommand);
          }

          @Override
          public void onUpperBoundValue(Config params, boolean fireCommand) {
            // turnPowerOn(params);
            onRangeValue(volume.getMax(), params, fireCommand);
          }

          @Override
          public void onRangeValue(int rangeValue, Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetVolume(rangeValue, params);
            } else {
              setVolume(rangeValue);
            }
          }
        });
    registerBehavior(volume);

    // linking this property with the behavior defined in the XML
    channel = new RangedIntBehaviorLogic((RangedIntBehavior) getPojo().getBehavior("channel"));

    channel.addListener(
        new RangedIntBehaviorLogic.Listener() {
          @Override
          public void onLowerBoundValue(Config params, boolean fireCommand) {
            onRangeValue(channel.getMin(), params, fireCommand);
          }

          @Override
          public void onUpperBoundValue(Config params, boolean fireCommand) {
            onRangeValue(channel.getMax(), params, fireCommand);
          }

          @Override
          public void onRangeValue(int rangeValue, Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetChannel(rangeValue, params);
            } else {
              setChannel(rangeValue);
            }
          }
        });
    registerBehavior(channel);

    // linking this property with the behavior defined in the XML
    input = new ListBehaviorLogic((ListBehavior) getPojo().getBehavior("input"));
    input.addListener(
        new ListBehaviorLogic.Listener() {
          @Override
          public void selectedChanged(Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetInput(params);
            } else {
              setInput(params.getProperty("value"));
            }
          }
        });
    registerBehavior(input);

    // linking this powered property with the muted behavior defined in the XML
    muted = new BooleanBehaviorLogic((BooleanBehavior) getPojo().getBehavior("muted"));
    muted.addListener(
        new BooleanBehaviorLogic.Listener() {
          @Override
          public void onTrue(Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetMuteOn(params);
            } else {
              setMuteOn();
            }
          }

          @Override
          public void onFalse(Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetMuteOff(params);
            } else {
              setMuteOff();
            }
          }
        });
    registerBehavior(muted);

    // linking this powered property with the avSelection behavior defined in the XML
    avSelection = new ListBehaviorLogic((ListBehavior) getPojo().getBehavior("avselection"));
    avSelection.addListener(
        new ListBehaviorLogic.Listener() {
          @Override
          public void selectedChanged(Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetAVSelection(params);
            } else {
              setAVSelection(params.getProperty("value"));
            }
          }
        });
    registerBehavior(avSelection);

    // linking this powered property with the screenMode behavior defined in the XML
    screenMode = new ListBehaviorLogic((ListBehavior) getPojo().getBehavior("screenMode"));
    screenMode.addListener(
        new ListBehaviorLogic.Listener() {
          // TODO: in the kuro the screen modes available depends of the source.
          @Override
          public void selectedChanged(Config params, boolean fireCommand) {
            if (fireCommand) {
              executeSetScreenMode(params);
            } else {
              setScreenMode(params.getProperty("value"));
            }
          }
        });
    registerBehavior(screenMode);
    super.init();
  }
Beispiel #2
0
 public void setAVSelection(String value) {
   if (!avSelection.getSelected().equals(value)) {
     avSelection.setSelected(value);
     setChanged(true);
   }
 }
Beispiel #3
0
 public void setScreenMode(String value) {
   if (!screenMode.getSelected().equals(value)) {
     screenMode.setSelected(value);
     setChanged(true);
   }
 }
Beispiel #4
0
 public void setInput(String value) {
   if (!input.getSelected().equals(value)) {
     input.setSelected(value);
     setChanged(true);
   }
 }