Package devplugin

Examples of devplugin.ProgramFieldType


  private ProgramFieldType[] getAvailableTypes() {
    ArrayList<ProgramFieldType> typeList = new ArrayList<ProgramFieldType>();

    Iterator<ProgramFieldType> typeIter = ProgramFieldType.getTypeIterator();
    while (typeIter.hasNext()) {
      ProgramFieldType type = typeIter.next();

      if ((type.getFormat() != ProgramFieldType.BINARY_FORMAT) && (type != ProgramFieldType.INFO_TYPE)
          && (type != ProgramFieldType.PICTURE_DESCRIPTION_TYPE) && (type != ProgramFieldType.PICTURE_COPYRIGHT_TYPE)) {
        typeList.add(type);
      }
    }
View Full Code Here


      = new MutableProgram(channel, date, startTime / 60, startTime % 60, true);
     
    int fieldCount = frame.getProgramFieldCount();
    for (int i = 0; i < fieldCount; i++) {
      field = frame.getProgramFieldAt(i);
      ProgramFieldType type = field.getType();
      if (type.getFormat() == ProgramFieldType.BINARY_FORMAT) {
        program.setBinaryField(type, field.getBinaryData());
      }
      else if (type.getFormat() == ProgramFieldType.TEXT_FORMAT) {
        program.setTextField(type, field.getTextData());
      }
      else if (type.getFormat() == ProgramFieldType.INT_FORMAT) {
        program.setIntField(type, field.getIntData());
      }
      else if (type.getFormat() == ProgramFieldType.TIME_FORMAT) {
        program.setTimeField(type, field.getTimeData());
      }
    }

    program.setProgramLoadingIsComplete();
View Full Code Here

      if ((mObjectValues[i] == null) != (program.mObjectValues[i] == null)) {
        return false;
      }
    }
    for (Iterator<ProgramFieldType> iterator = ProgramFieldType.getTypeIterator(); iterator.hasNext();) {
      ProgramFieldType fieldType = iterator.next();
      int format = fieldType.getFormat();
      if (format == ProgramFieldType.TEXT_FORMAT || format == ProgramFieldType.BINARY_FORMAT) {
        Object thisValue = getObjectValueField(fieldType);
        Object otherValue = program.getObjectValueField(fieldType);
        if (thisValue!= null && !thisValue.equals(otherValue)) {
          return false;
View Full Code Here

    private ArrayList<ProgramFieldType> mFieldTypes;

    public ProgramFieldIterator(final MutableProgram program) {
      mFieldTypes = new ArrayList<ProgramFieldType>(20);
      for (Iterator<ProgramFieldType> iterator = ProgramFieldType.getTypeIterator(); iterator.hasNext();) {
        ProgramFieldType fieldType = iterator.next();
        int format = fieldType.getFormat();
        if (format == ProgramFieldType.INT_FORMAT) {
          if (program.getIntField(fieldType) != -1) {
            mFieldTypes.add(fieldType);
          }
        }
View Full Code Here

    }

    addSeparator(doc, buffer);

    for (Object id : fieldArr) {
      ProgramFieldType type = null;

      if (id instanceof String) {
        if (((String) id).matches("\\d+")) {
          try {
            type = ProgramFieldType
                .getTypeForId(Integer.parseInt((String) id, 10));
          } catch (Exception e) {
            // Empty Catch
          }
        }

        if (type == null) {
          int length = prog.getLength();
          if (length > 0 && ((String) id).trim().length() > 0) {

            buffer
                .append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer.append(mLocalizer.msg("duration",
                "Program duration/<br>-end"));
            buffer.append("</b></td><td style=\"color:rgb("+ foreground.getRed() + "," + foreground.getGreen() + "," + foreground.getBlue() + "); font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\">");

            openPara(buffer, "time");

            String msg = mLocalizer.msg("minutes", "{0} min", length);
            buffer.append(msg).append(" (");
            buffer.append(mLocalizer.msg("until", "until {0}", prog.getEndTimeString()));

            int netLength = prog
                .getIntField(ProgramFieldType.NET_PLAYING_TIME_TYPE);
            if (netLength != -1) {
              msg = mLocalizer.msg("netMinuted", "{0} min net", netLength);
              buffer.append(" - ").append(msg);
            }
            buffer.append(')');

            closePara(buffer);

            buffer.append("</td></tr>");
            addSeparator(doc, buffer);
          }
        }
      } else if(id instanceof CompoundedProgramFieldType) {
        CompoundedProgramFieldType value = (CompoundedProgramFieldType) id;
        String entry = value.getFormattedValueForProgram(prog);

        if(entry != null) {
          startInfoSection(buffer, value.getName());
          buffer.append(HTMLTextHelper.convertTextToHtml(entry, false));

          addSeparator(doc,buffer);
        }
      }
      else {
        type = (ProgramFieldType) id;

        if (type == ProgramFieldType.DESCRIPTION_TYPE) {
          String description = checkDescription(prog.getDescription());
          if (description != null
              && description.length() > 0) {
            addEntry(doc, buffer, prog, ProgramFieldType.DESCRIPTION_TYPE, true,
                showHelpLinks, showPersonLinks);
          } else {
            addEntry(doc, buffer, prog, ProgramFieldType.SHORT_DESCRIPTION_TYPE,
                true, showHelpLinks,
                  showPersonLinks);
          }
        } else if (type == ProgramFieldType.INFO_TYPE) {
          int info = prog.getInfo();
          if ((info != -1) && (info != 0)) {
            buffer
                .append("<tr><td valign=\"top\" style=\"color:gray; font-size:");

            buffer.append(mBodyFontSize);

            buffer.append("\"><b>");
            buffer
                .append(type.getLocalizedName());
            buffer
                .append("</b></td><td valign=\"middle\" style=\"font-size:5\">");

            openPara(buffer, "info");
            // Workaround: Without the &nbsp; the component are not put in one
            // line.
            buffer.append("&nbsp;");

            int[] infoBitArr = ProgramInfoHelper.getInfoBits();
            Icon[] infoIconArr = ProgramInfoHelper.getInfoIcons();
            String[] infoMsgArr = ProgramInfoHelper.getInfoIconMessages();

            for (int i = 0; i < infoBitArr.length; i++) {
              if (ProgramInfoHelper.bitSet(info, infoBitArr[i])) {
                JLabel iconLabel;

                if (infoIconArr[i] != null) {
                  iconLabel = new JLabel(infoIconArr[i]);
                }
                else {
                  iconLabel = new JLabel(infoMsgArr[i]);
                }

                iconLabel.setToolTipText(infoMsgArr[i]);
                buffer.append(doc.createCompTag(iconLabel));

                buffer.append("&nbsp;&nbsp;");
              }
            }

            closePara(buffer);

            buffer.append("</td></tr>");
            addSeparator(doc, buffer);
          }
        } else if (type == ProgramFieldType.URL_TYPE) {
          addEntry(doc, buffer, prog, ProgramFieldType.URL_TYPE, true,
              showHelpLinks, showPersonLinks);
        }
        else if (type == ProgramFieldType.ACTOR_LIST_TYPE) {
          ArrayList<String> knownNames = new ArrayList<String>();
          String[] recognizedActors = ProgramUtilities.getActorNames(prog);
          if (recognizedActors != null) {
            knownNames.addAll(Arrays.asList(recognizedActors));
          }
          String actorField = prog.getTextField(type);
          if (actorField != null) {
            ArrayList<String>[] lists = ProgramUtilities.splitActors(prog);
            if (lists == null) {
              lists = splitActorsSimple(prog);
            }
            if (lists != null && lists[0].size() > 0) {
              startInfoSection(buffer, type.getLocalizedName());
              buffer.append("<table border=\"0\" cellpadding=\"0\" style=\"font-family:");
              buffer.append(bodyFont);
              buffer.append(";\">");
              for (int i=0; i < lists[0].size(); i++) {
                String[] parts = new String[2];
View Full Code Here

        ProgramFieldType.VPS_TYPE,
        ProgramFieldType.CUSTOM_TYPE,
        getDurationTypeString()}));
    // append missing fields (which may have been added in recent versions)
    for (Iterator<ProgramFieldType> iterator = ProgramFieldType.getTypeIterator(); iterator.hasNext();) {
      ProgramFieldType type = iterator.next();
      // exclude binary information which need special handling anyway
      if (type.getFormat() == ProgramFieldType.BINARY_FORMAT) {
        continue;
      }
      if (!list.contains(type)) {
        list.add(type);
      }
View Full Code Here

  public static final ProgramFieldType[] getSearchableFieldTypes() {
    if (mSearchableFieldTypes == null) {
      ArrayList<ProgramFieldType> list = new ArrayList<ProgramFieldType>();
      Iterator<ProgramFieldType> iter = ProgramFieldType.getTypeIterator();
      while (iter.hasNext()) {
        ProgramFieldType type = iter.next();
        if (type.getFormat() != ProgramFieldType.BINARY_FORMAT
            && type != ProgramFieldType.PICTURE_COPYRIGHT_TYPE
            && type != ProgramFieldType.INFO_TYPE
            && type != ProgramFieldType.CUSTOM_TYPE) {
          // We can search all fields but binaries
          list.add(type);
View Full Code Here

  private void checkFieldReader() {
    if (mCurrentFieldReader == null) {
      mCurrentField++;

      if (mCurrentField < mInfoFieldArr.length) {
        ProgramFieldType fieldType = mInfoFieldArr[mCurrentField];
       
        String fieldValue = null;
        if (fieldType.getFormat() == ProgramFieldType.TEXT_FORMAT) {
          fieldValue = mProgram.getTextField(fieldType);
         
          if (fieldType == ProgramFieldType.SHORT_DESCRIPTION_TYPE) {
            // Special treatment for the short description:
            // If the short and the long description are shown
            // and the short description is just the cutted version of the
            // long description then don't show the short description
           
            if (containsDescription(mInfoFieldArr)) {
              String description = mProgram.getDescription();
              if (isShortVersion(fieldValue, description)) {
                fieldValue = null;
              }
            }
          }
        }
        else if (fieldType.getFormat() == ProgramFieldType.TIME_FORMAT) {
          fieldValue = mProgram.getTimeFieldAsString(fieldType);
        }
        else if (fieldType.getFormat() == ProgramFieldType.INT_FORMAT) {
          fieldValue = mProgram.getIntFieldAsString(fieldType);
        }
       
        if (fieldValue == null) {
          // This field has no value -> Go on with the next one
View Full Code Here

        writer.println();
        writer.print("Program ID: ");
        writer.println(frame.getId());
        for (int fieldIdx = 0; fieldIdx < frame.getProgramFieldCount(); fieldIdx++) {
          ProgramField field = frame.getProgramFieldAt(fieldIdx);
          ProgramFieldType type = field.getType();
          writer.print("  ");
          writer.print(type.getName());
          writer.print(": ");
         
          if (type == ProgramFieldType.INFO_TYPE) {
            int info = field.getIntData();
            writer.println(programInfoToString(info));
          } else {
            if (field.getBinaryData() == null) {
              writer.println("(delete)");
            } else {
              switch (type.getFormat()) {
                case ProgramFieldType.TEXT_FORMAT:
                  writer.println(field.getTextData());
                  break;
                case ProgramFieldType.INT_FORMAT:
                  writer.println(field.getIntData());
View Full Code Here

   * @param fieldArr
   * @return concatenated string for use in regex search
   */
  private String getProgramFieldsText(Program prog, ProgramFieldType[] fieldArr) {
    if (fieldArr.length == 1) {
      ProgramFieldType fieldType = fieldArr[0];
      if (fieldType.getFormat() == ProgramFieldType.TEXT_FORMAT) {
        return prog.getTextField(fieldType);
      }
      else if (fieldType.getFormat() == ProgramFieldType.INT_FORMAT) {
        return prog.getIntFieldAsString(fieldType);
      }
      else if (fieldType.getFormat() == ProgramFieldType.TIME_FORMAT) {
        if (fieldType == ProgramFieldType.START_TIME_TYPE) {
          return prog.getTimeString();
        }
        else if (fieldType == ProgramFieldType.END_TIME_TYPE) {
          return prog.getEndTimeString();
        }
        else {
          return prog.getTimeFieldAsString(fieldType);
        }
      }
    }

    StrBuilder buffer = new StrBuilder();
    for (ProgramFieldType fieldType : fieldArr) {
      // Get the field value as String
      String value = null;
      if (fieldType != null) {
        if (fieldType.getFormat() == ProgramFieldType.TEXT_FORMAT) {
          value = prog.getTextField(fieldType);
        }
        else if (fieldType.getFormat() == ProgramFieldType.INT_FORMAT) {
          value = prog.getIntFieldAsString(fieldType);
        }
        else if (fieldType.getFormat() == ProgramFieldType.TIME_FORMAT) {
          if (fieldType == ProgramFieldType.START_TIME_TYPE) {
            value = prog.getTimeString();
          }
          else if (fieldType == ProgramFieldType.END_TIME_TYPE) {
            value = prog.getEndTimeString();
View Full Code Here

TOP

Related Classes of devplugin.ProgramFieldType

Copyright © 2018 www.massapicom. 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.