Beispiel #1
0
  private JPanel footerPanel(
      MessageWriter writer, ChatFriend chatFriend, ScheduledExecutorService schedExecService) {
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBackground(BACKGROUND_COLOR);

    downloadlink = new HyperlinkButton(new DownloadFromFriendLibraryAction());
    downloadlink.setFont(linkFont);
    downloadlink.setEnabled(chatFriend.isSignedInToLimewire());

    toolbar = new JXPanel(new MigLayout("insets 0 0 0 5, gap 10, alignx right, aligny 50%"));
    ResizeUtils.forceHeight(toolbar, 22);

    toolbar.setBackgroundPainter(
        new GenericBarPainter<JXPanel>(
            new GradientPaint(0, 0, toolbarTopColor, 0, 1, toolbarBottomColor),
            toolbarBorderColor,
            PainterUtils.TRASPARENT,
            toolbarBorderColor,
            PainterUtils.TRASPARENT));

    if (hasFeature(NoSaveFeature.ID)) {
      ensureNoSaveLinkExists();
    }

    toolbar.add(downloadlink);

    inputPanel = new ResizingInputPanel(writer, schedExecService);
    inputPanel.setBorder(BorderFactory.createEmptyBorder());
    panel.add(toolbar, BorderLayout.NORTH);
    panel.add(inputPanel, BorderLayout.CENTER);

    return panel;
  }
Beispiel #2
0
 private void updateNoSaveLink(NoSave noSave) {
   noSaveState = noSave;
   nosaveLink.setText(
       "<html><u>"
           + (noSaveState == NoSave.ENABLED ? I18n.tr("On the Record") : I18n.tr("Off the Record"))
           + "</u></html>");
 }
Beispiel #3
0
 /**
  * Update availability of friend associated with this conversation.
  *
  * @param update type of update.
  */
 public void friendAvailableUpdate(FriendEvent.Type update) {
   switch (update) {
     case ADDED:
       currentChatState = ChatState.active;
       displayMessages(false);
       if ((nosaveLink != null) && hasFeature(NoSaveFeature.ID)) {
         nosaveLink.setVisible(true);
       }
       break;
     case REMOVED:
       displayMessages(true);
       if (nosaveLink != null) {
         nosaveLink.setVisible(false);
       }
       break;
   }
 }
Beispiel #4
0
 /**
  * Called to indicate a new feature addition/removal.
  *
  * @param feature the feature being updated
  * @param action whether the feature is added or removed.
  */
 public void featureUpdate(Feature feature, FeatureEvent.Type action) {
   if (feature.getID().equals(LimewireFeature.ID)) {
     if (action == FeatureEvent.Type.ADDED) {
       downloadlink.setEnabled(true);
     } else if (action == FeatureEvent.Type.REMOVED) {
       downloadlink.setEnabled(chatFriend.isSignedInToLimewire());
     }
   } else if (feature.getID().equals(NoSaveFeature.ID)) {
     if (action == FeatureEvent.Type.ADDED) {
       ensureNoSaveLinkExists();
       NoSave status = ((NoSaveStatus) feature.getFeature()).getStatus();
       if (status != noSaveState) {
         NoSaveStatusMessage msg = new NoSaveStatusMessage(friendId, Message.Type.SERVER, status);
         messageBroadcaster.broadcast(new ChatMessageEvent(msg));
       }
     }
   }
 }
Beispiel #5
0
  private void ensureNoSaveLinkExists() {
    if (nosaveLink == null) {
      NoSaveToggleAction action = new NoSaveToggleAction();
      nosaveLink = new HyperlinkButton(action);
      nosaveLink.setFont(linkFont);

      // initialize nosave state
      NoSaveFeature nosaveFeature = (NoSaveFeature) getFeature(NoSaveFeature.ID);
      updateNoSaveLink(nosaveFeature.getFeature().getStatus());

      toolbar.add(nosaveLink, 0);
    }
  }