void setEnabled(boolean enabled, boolean isMember) {
   mTextArea.setEnabled(enabled);
   Color textBG = enabled ? Color.WHITE : Color.LIGHT_GRAY;
   mTextArea.setBackground(textBG);
   mOverlay.setBackground(textBG);
   mOverlayLabel.setText(isMember ? Tr.tr("You are not a member of this group") : "");
 }
Beispiel #2
0
 public void setPageInfo(int count) {
   if (currentPage == 0) {
     currentPage = count;
   }
   totalPage = count;
   pageTotal.setText(currentPage + " / " + totalPage + " page");
 }
  private void reloadMembers() {
    GroupMemberListModel model = (GroupMemberListModel) listModels.get(namedObject.getEntity());

    List<? extends QQStranger> members = getMembers();

    if (model == null) {
      model = new GroupMemberListModel(new UserListComparator());
      for (QQStranger m : members) {
        model.addElement(new UserListElement(new UIUser(m)));

        // 下载头像, 只下载一次,后面是手动更新
        if (isLoadFace) {
          IMEventService events = getContext().getSerivce(IMService.Type.EVENT);
          events.broadcast(new IMEvent(IMEventType.USER_FACE_REQUEST, m));
        }
      }
      listModels.put(namedObject.getEntity(), model);
    }

    model.sort(); // 根据状态排序
    membersCount.setText("Members (" + getOnlineCount(members) + "/" + members.size() + ")");
    if (model != memberList.getModel()) {
      memberList.setModel(model);
    }
    model.updateAll();
    // 停止进度条
    progressOverlay.setShowLoad(false);
  }
  @Override
  public void changed(float totalRest, float totalWork) {
    txtHoursOfRest24Hrs.setText(Float.toString(totalRest));
    txtHoursOfWork24Hrs.setText(Float.toString(totalWork));

    Calendar cal = Calendar.getInstance();
    cal.setTime(currentDate);

    int month = cal.get(Calendar.MONTH);

    StringBuilder sb = new StringBuilder();
    sb.append("<html><ul>");

    if (currentCrew != null) {

      try {

        EntryTime time = new EntryTime();
        time.setSchedule(timeSheet.getSchedule());

        double totalWorkHours = 24 - time.getTotalRestHours();

        errorReportEntry = new ErrorReportEntry();
        errorReportEntry.setEntryDate(getDate(currentDate));
        errorReportEntry.setCrew(currentCrew);

        errorReportEntry.setRestIn24hours(time.getTotalRestHours());
        errorReportEntry.setWorkIn24hours(totalWorkHours);

        if (time.getTotalRestHours() < 10) {
          sb.append("<li>Total period of REST > 10 Hours</li>");

          errorReportEntry.setRestGreater10hrs(true);
        }

        if (totalWorkHours > 14) {
          sb.append("<li>Total period of WORK &lt; 14 Hours</li>");

          errorReportEntry.setWorkLess14hrs(true);
        }

        errorReport = new ErrorReport(currentCrew, null, month, cal.get(Calendar.YEAR));
        errorReport.generateReport();

        if (errorReport.getEntryTimeList().size() >= cal.get(Calendar.DAY_OF_MONTH) - 1) {
          errorReport
              .getEntryTimeList()
              .get(cal.get(Calendar.DAY_OF_MONTH) - 1)
              .setSchedule(timeSheet.getSchedule());
          errorReport.refresh();
        }

        if (errorReport.getContainMoreThan2RestPeriods(cal.get(Calendar.DAY_OF_MONTH)) == true) {
          sb.append("<li>Total number of REST periods are more than 2</li>");

          errorReportEntry.setTotalRestPeriods(
              errorReport.getRestPeriodCounter(cal.get(Calendar.DAY_OF_MONTH)));
        }

        if (!errorReport.contain6HourContinuousRest(cal.get(Calendar.DAY_OF_MONTH))) {
          sb.append("<li>At least one period of rest must be of 6 hours in length</li>");

          errorReportEntry.setOneRestPeriod6hrs(true);
        }

        double restHoursIn24Hours = errorReport.get24HourRestHours(cal.get(Calendar.DAY_OF_MONTH));
        if (restHoursIn24Hours < 10) {
          sb.append("<li>Any 24-hour Total Period of REST &gt; 10 Hours</li>");

          errorReportEntry.setAnyRest24hours(restHoursIn24Hours);

          errorReportEntry.setTotalRest24hrsGreater10hrs(true);
        }

        double restHoursIn7Days = errorReport.get7DayRestHours(cal.get(Calendar.DAY_OF_MONTH));
        if (restHoursIn7Days < 77) {
          sb.append("<li>Any 7-days Total Period of REST &gt; 77 Hours</li>");

          errorReportEntry.setRest7days(restHoursIn7Days);

          errorReportEntry.setTotalRest7daysGreater77hrs(true);
        }

        double last3DayTotalRestHours =
            errorReport.getLast3DayTotalRestHours(cal.get(Calendar.DAY_OF_MONTH));
        if (last3DayTotalRestHours < 36) {
          sb.append("<li>Rest hours in last 3 days are &lt; 36 Hours</li>");
        }
        errorReportEntry.setRestHour3daysGreater36hrs(last3DayTotalRestHours);

      } catch (Exception e) {
      }
    }

    sb.append("</ul></html>");

    lblNonConformities.setText(sb.toString());
    lblNonConformities.repaint();
  }
  /**
   * Returns list cell renderer component.
   *
   * @param list tree
   * @param value cell value
   * @param index cell index
   * @param isSelected whether cell is selected or not
   * @param cellHasFocus whether cell has focus or not
   * @return cell renderer component
   */
  @Override
  public Component getListCellRendererComponent(
      final JList list,
      final Object value,
      final int index,
      final boolean isSelected,
      final boolean cellHasFocus) {
    super.getListCellRendererComponent(list, "", index, isSelected, cellHasFocus);

    final FileElement element = (FileElement) value;
    final File file = element.getFile();

    // Proper margin
    setMargin(isTilesView() ? tileCellMargin : iconCellMargin);

    // Renderer icon
    String imageSize = null;
    if (iconLabel.isEnabled()) {
      // Thumbnail loading
      synchronized (thumbnailsLock) {
        if (!element.isThumbnailQueued() && !element.isDisabledThumbnailQueued()) {
          queueThumbnailLoad(element, false);
        }
      }

      // Image thumbnail
      final ImageIcon thumbnail = element.getEnabledThumbnail();
      iconLabel.setIcon(thumbnail);

      // Image description
      if (thumbnail != null) {
        imageSize = thumbnail.getDescription();
      }
    } else {
      // Disabled thumbnail loading
      synchronized (thumbnailsLock) {
        if (!element.isDisabledThumbnailQueued()) {
          queueThumbnailLoad(element, true);
        }
      }

      // Image disabled thumbnail
      iconLabel.setDisabledIcon(element.getDisabledThumbnail());
    }

    // Updating file description elements
    if (fileList.getEditedCell() != index) {
      // Settings description
      final FileDescription fileDescription = FileUtils.getFileDescription(file, imageSize);
      nameLabel.setText(fileDescription.getName());

      // Updating tile view additional description
      if (isTilesView()) {
        descriptionLabel.setText(fileDescription.getDescription());

        // Updating size label
        if (fileDescription.getSize() != null) {
          sizeLabel.setText(fileDescription.getSize());
        } else {
          sizeLabel.setText(null);
        }
      } else {
        descriptionLabel.setText(null);
        sizeLabel.setText(null);
      }
    } else {
      nameLabel.setText(null);
      descriptionLabel.setText(null);
      sizeLabel.setText(null);
    }

    return this;
  }
Beispiel #6
0
 /** Updates title label text. */
 protected void updateTitleLabel() {
   titleLabel.setText(titleFormat.format(shownDate));
 }
Beispiel #7
0
 private void updateFileName() {
   fileName.setIcon(getDisplayIcon(file));
   fileName.setText(getDisplayName(file));
 }