예제 #1
0
 public void refreshWidget(FormEntryPrompt fep, int changeFlags) {
   ImageItem newImItem = ExpandedWidget.getImageItem(fep, scrHeight - 16, scrWidth - 16);
   if (newImItem != null) {
     detachImage();
     fullPrompt.add(newImItem);
     imItem = newImItem;
   }
   if (multimediaController != null) {
     multimediaController.playAudioOnLoad(fep);
   }
   prompt.setText(fep.getLongText());
 }
예제 #2
0
  /* (non-Javadoc)
   * @see de.enough.polish.ui.ContainerView#focusItem(int, de.enough.polish.ui.Item, int, de.enough.polish.ui.Style)
   */
  public Style focusItem(int focIndex, Item item, int direction, Style focStyle) {
    if (this.referenceXCenterPositions == null
        || this.referenceXCenterPositions.length != this.parentContainer.size()) {
      this.focusedStyle = focStyle;
      this.focusedDirection = direction;
      this.focusedIndex = focIndex;
      this.focusedItem = item;
      return item.getStyle();
    } else {
      int difference = this.referenceFocusedIndex - focIndex;
      Item[] myItems = this.parentContainer.getItems();
      int[] targetXPositions;
      int[] targetYPositions = null;
      // #if polish.midp2
      int[] targetAlphas;
      int[] currentAlphas;
      // #endif
      if (this.targetXCenterPositions == null
          || this.targetXCenterPositions.length != myItems.length) {
        targetXPositions = new int[myItems.length];
        if (this.referenceYCenterPositions != null) {
          targetYPositions = new int[myItems.length];
        }
        // #if polish.midp2
        targetAlphas = new int[myItems.length];
        currentAlphas = new int[myItems.length];
        // #endif
      } else {
        targetXPositions = this.targetXCenterPositions;
        if (this.referenceYCenterPositions != null) {
          targetYPositions = this.targetYCenterPositions;
        }
        // #if polish.midp2
        targetAlphas = this.targetTranslucencies;
        currentAlphas = this.currentTranslucencies;
        // #endif
      }
      if (this.referenceXCenterPositions.length != targetXPositions.length) {
        return item.getStyle();
      }
      for (int i = 0; i < myItems.length; i++) {
        int nextIndex = i + difference;
        if (nextIndex < 0) {
          nextIndex = myItems.length + nextIndex;
        } else if (nextIndex >= myItems.length) {
          nextIndex -= myItems.length;
        }
        targetXPositions[i] = this.referenceXCenterPositions[nextIndex];
        if (targetYPositions != null) {
          targetYPositions[i] = this.referenceYCenterPositions[nextIndex];
        }
        // #if polish.midp2
        targetAlphas[i] = calculateAlpha(getDistance(i, focIndex, myItems.length), myItems.length);
        // System.out.println("targetAlpha[" + i + "]=" + targetAlphas[i]);
        currentAlphas[i] = this.endTranslucency;
        // #endif
      }
      this.targetXCenterPositions = targetXPositions;
      if (targetYPositions != null) {
        this.targetYCenterPositions = targetYPositions;
      }
      // #if polish.midp2
      this.targetTranslucencies = targetAlphas;
      this.currentTranslucencies = currentAlphas;
      // #endif
    }
    Style itemStyle;
    if (!item.isFocused) {
      itemStyle = super.focusItem(focIndex, item, direction, focStyle);
    } else {
      itemStyle = item.getStyle();
    }

    this.focusedBackground = removeItemBackground(item);
    this.focusedBorder = removeItemBorder(item);
    if (this.isRemoveText) {
      if (this.isShowTextInTitle) {
        Screen scr = getScreen();
        if (scr != null) {
          scr.setTitle(this.labels[focIndex]);
        }
      } else {
        StringItem focLabel = this.focusedLabel;
        if (focLabel != null) {
          int previousHeight = focLabel.itemHeight;
          focLabel.setText(this.labels[focIndex]);
          if (focLabel.getStyle() != item.getStyle()
          // #if polish.css.fisheyeview-text-style
          // # && (this.focusedLabelStyle == null)
          // #endif
          ) {
            focLabel.setStyle(item.getStyle());
            removeItemBackground(focLabel);
            removeItemBorder(focLabel);
          }
          if (focLabel.getAvailableHeight() != 0) {
            int currentHeight =
                focLabel.getItemHeight(
                    focLabel.getAvailableWidth(),
                    focLabel.getAvailableWidth(),
                    focLabel.getAvailableHeight());
            if (currentHeight != previousHeight) {
              this.contentHeight += (currentHeight - previousHeight);
              this.parentContainer.setInitialized(false);
            }
          }
        }
      }
    }
    return itemStyle;
  }