コード例 #1
0
 private void _buttonShowHideOnMap_actionPerformed(ActionEvent actionEvent) {
   if (Settings.getInstance()
       .getDTO()
       .isHiddenContact(_itemVO.getServiceItemID(), _itemVO.getService()))
     Settings.getInstance().getDTO().showContact(_itemVO.getServiceItemID(), _itemVO.getService());
   else
     Settings.getInstance().getDTO().hideContact(_itemVO.getServiceItemID(), _itemVO.getService());
   ((MapViewPanel) getParentPanel()).buildMarkers();
   windowVisible();
 }
コード例 #2
0
 private void _buttonAddRemoveToRoute_actionPerformed(ActionEvent actionEvent) {
   if (Settings.getInstance()
       .getDTO()
       .isHiddenContact(_itemVO.getServiceItemID(), _itemVO.getService())) {
     Settings.getInstance().getDTO().showContact(_itemVO.getServiceItemID(), _itemVO.getService());
     ((MapViewPanel) getParentPanel()).buildMarkers();
   }
   _buttonAddRemoveToRoute.setEnabled(false);
   ((MapViewPanel) getParentPanel()).addRoute(_itemVO);
 }
コード例 #3
0
 private void _buttonLocateOnMap_actionPerformed(ActionEvent actionEvent) {
   if (Settings.getInstance()
       .getDTO()
       .isHiddenContact(_itemVO.getServiceItemID(), _itemVO.getService())) {
     Settings.getInstance().getDTO().showContact(_itemVO.getServiceItemID(), _itemVO.getService());
     ((MapViewPanel) getParentPanel()).buildMarkers();
   }
   ((MapViewPanel) getParentPanel()).setMapCenter(_itemVO.getPosition());
   getParentPanel().discardAllWindows();
 }
コード例 #4
0
 private void _buttonGotoSocialNetworkPage_actionPerformed(ActionEvent actionEvent) {
   WebBrowser.openURL(
       "data:text/html;base64,"
           + (new Base64())
               .encodeBase64URLSafeString(
                   ("<h1>Going to "
                           + _itemVO.getService().toUpperCase()
                           + " page of "
                           + _itemVO.getName()
                           + "...</h1>")
                       .getBytes()));
 }
コード例 #5
0
 private void _buttonSendVoiceNote_actionPerformed(ActionEvent actionEvent) {
   try {
     if (API.getInstance().getSocial().canMessageSend(_itemVO.getService()))
       getParentPanel().showWindow(new VoiceNoteSendWindow(_itemVO, null, null));
     else
       getParentPanel()
           .showWindow(
               new WarningWindow(
                   "Cannot send message",
                   "The service \""
                       + _itemVO.getService()
                       + "\" does not let you send private messages to \""
                       + _itemVO.getName()
                       + "\". Please select another contact.",
                   30,
                   "send-message-contact-list-can-not-send.wav"));
   } catch (APICommunicationException apiCommunicationException) {
     Debug.displayStack(this, apiCommunicationException);
   } catch (APIProtocolException apiProtocolException) {
     Debug.displayStack(this, apiProtocolException);
   }
 }
コード例 #6
0
 private void _listContactList_valueChanged(ListSelectionEvent listSelectionEvent) {
   try {
     if (!listSelectionEvent.getValueIsAdjusting()) {
       ItemVO contactItemVO = (ItemVO) _listContactList.getSelectedValue();
       if (API.getInstance().getSocial().canMessageSend(contactItemVO.getService())) {
         if (_messageType == MessageType.TEXT)
           getParentPanel()
               .discardAndShowWindow(
                   new MessageSendWindow(
                       (ItemVO) _listContactList.getSelectedValue(), _itemVO, null));
         else if (_messageType == MessageType.VOICE)
           getParentPanel()
               .discardAndShowWindow(
                   new VoiceNoteSendWindow(
                       (ItemVO) _listContactList.getSelectedValue(), _itemVO, null));
       } else {
         getParentPanel()
             .showWindow(
                 new WarningWindow(
                     "Cannot send message",
                     "The service \""
                         + contactItemVO.getService()
                         + "\" does not let you send private messages to \""
                         + contactItemVO.getName()
                         + "\". Please select another contact.",
                     30,
                     "send-message-contact-list-can-not-send.wav"));
         _listContactList.clearSelection();
       }
     }
   } catch (APICommunicationException apiCommunicationException) {
     Debug.displayStack(this, apiCommunicationException);
   } catch (APIProtocolException apiProtocolException) {
     Debug.displayStack(this, apiProtocolException);
   }
 }
コード例 #7
0
 protected void windowVisible() {
   if (Settings.getInstance()
       .getDTO()
       .isHiddenContact(_itemVO.getServiceItemID(), _itemVO.getService()))
     _buttonShowHideOnMap.setIcons(
         "button-contact-show-on-the-map-up.png",
         "button-contact-show-on-the-map-down.png",
         "button-contact-show-on-the-map-disabled.png");
   else
     _buttonShowHideOnMap.setIcons(
         "button-contact-hide-on-the-map-up.png",
         "button-contact-hide-on-the-map-down.png",
         "button-contact-hide-on-the-map-disabled.png");
   _buttonLocateOnMap.setEnabled(_itemVO.getDisplay() == ItemDisplay.GEO);
   _buttonAddRemoveToRoute.setEnabled(_itemVO.getDisplay() == ItemDisplay.GEO);
   _buttonShowHideOnMap.setEnabled(_itemVO.getDisplay() == ItemDisplay.GEO);
   _buttonSendMessage.setEnabled(_allowSendMessage);
 }
コード例 #8
0
 private void jbInit() throws Exception {
   this.setSize(new Dimension(560, 293));
   _buttonSendMessage.setLocation(130, 70);
   _buttonSendMessage.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _buttonSendMessage_actionPerformed(actionEvent);
         }
       });
   /*-
   _buttonSendVoiceNote.setLocation(200, 70);
   _buttonSendVoiceNote.addActionListener(new ActionListener()
   {
     public void actionPerformed(ActionEvent actionEvent)
     {
       _buttonSendVoiceNote_actionPerformed(actionEvent);
     }
   });
   -*/
   _buttonLocateOnMap.setLocation(200, 70);
   _buttonLocateOnMap.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _buttonLocateOnMap_actionPerformed(actionEvent);
         }
       });
   _buttonAddRemoveToRoute.setLocation(270, 70);
   _buttonAddRemoveToRoute.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _buttonAddRemoveToRoute_actionPerformed(actionEvent);
         }
       });
   _buttonShowHideOnMap.setLocation(340, 70);
   _buttonShowHideOnMap.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _buttonShowHideOnMap_actionPerformed(actionEvent);
         }
       });
   /*-
   _buttonGotoSocialNetworkPage.setLocation(480, 70);
   _buttonGotoSocialNetworkPage.addActionListener(new ActionListener()
   {
     public void actionPerformed(ActionEvent actionEvent)
     {
       _buttonGotoSocialNetworkPage_actionPerformed(actionEvent);
     }
   });
   -*/
   _scrollPaneUserFeed.setBounds(20, 135, 515, 108);
   _scrollPaneUserFeed.addScrollDownButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneUserFeed.scrollDown(_scrollPaneUserFeed.getHeight() / 4);
         }
       });
   _scrollPaneUserFeed.addScrollUpButtonActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent actionEvent) {
           _scrollPaneUserFeed.scrollUp(_scrollPaneUserFeed.getHeight() / 4);
         }
       });
   _htmlPaneUserFeed.addHyperlinkListener(
       new HyperlinkListener() {
         public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
           _htmlPaneUserFeed_hyperlinkUpdate(hyperlinkEvent);
         }
       });
   _scrollPaneUserFeed.addToViewport(_htmlPaneUserFeed);
   _labelDescription.setBounds(new Rectangle(140, 15, 455, 40));
   _labelDescription.setVerticalAlignment(SwingConstants.TOP);
   _labelDescription.setVerticalTextPosition(SwingConstants.TOP);
   setTitle("Contact details of " + _itemVO.getName());
   /*- Fix it
   setDataSourceLogo(Resources.getInstance().getImageIcon(Session.getInstance().getServiceDetails(_itemVO.getService().toLowerCase()).getServiceIconURI()));
   setDataSourceURL("http://www." + _itemVO.getService().toLowerCase() + ".com/");
   -*/
   _imagePanelContactPicture.setLocation(20, 15);
   _imagePanelContactPicture.setOpaque(false);
   BufferedImage bufferedImage =
       ImageFetcher.getInstance().getImage(_itemVO.getIconURL(), 96, 96, null);
   if (bufferedImage != null) _imagePanelContactPicture.setImage(bufferedImage);
   _labelDescription.setText("<html>" + _itemVO.getDescription().trim() + "</html>");
   _panelContent.add(_labelDescription, null);
   _panelContent.add(_scrollPaneUserFeed, null);
   /*-
   _panelContent.add(_buttonGotoSocialNetworkPage, null);
   -*/
   _panelContent.add(_buttonShowHideOnMap, null);
   _panelContent.add(_buttonAddRemoveToRoute, null);
   _panelContent.add(_buttonLocateOnMap, null);
   /*-
   _panelContent.add(_buttonSendVoiceNote, null);
   -*/
   _panelContent.add(_buttonSendMessage, null);
   _panelContent.add(_imagePanelContactPicture, null);
   ItemVO[] feedItems =
       API.getInstance().getSocial().feedGet(_itemVO.getService(), _itemVO.getServiceItemID());
   StringBuffer stringBuffer =
       new StringBuffer(
           "<html><body alink=\"#FF0000\" link=\"#EEFFEE\" text=\"#FFFFFF\" vlink=\"#EEFFEE\"><p>");
   if (!_itemVO.getDescription().trim().equals("")) {
     stringBuffer.append("<b>About :</b>");
     stringBuffer.append(
         _itemVO
             .getDescription()
             .trim()
             .replaceAll(
                 "(http[s]?:\\/\\/[^\\s]+)", "<a style=\"color: #3BB9FF;\" href=\"$1\">$1</a>"));
     stringBuffer.append("</p><hr/>");
   }
   for (int index = 0; index < feedItems.length; index++) {
     stringBuffer.append("<b>");
     InfoMessageGetTypeVO infoVO = (InfoMessageGetTypeVO) feedItems[index].getInfo();
     Format formatterDate =
         new SimpleDateFormat(Settings.getInstance().getDTO().getDateFormatPattern().getPattern());
     Format formatterTime =
         new SimpleDateFormat(Settings.getInstance().getDTO().getTimeFormatPattern().getPattern());
     stringBuffer.append(formatterDate.format(infoVO.getDateSent()).toString());
     stringBuffer.append(" ");
     stringBuffer.append(formatterTime.format(infoVO.getDateSent()).toString());
     stringBuffer.append(" : </b>");
     stringBuffer.append(
         feedItems[index]
             .getDescription()
             .trim()
             .replaceAll(
                 "(http[s]?:\\/\\/[^\\s]+)", "<a style=\"color: #3BB9FF;\" href=\"$1\">$1</a>"));
     stringBuffer.append("</p>");
     if (index != feedItems.length - 1) stringBuffer.append("<hr/>");
   }
   stringBuffer.append("</body></html>");
   _htmlPaneUserFeed.setText(stringBuffer.toString());
   if (Settings.getInstance().getDTO().isTTSContactFeed())
     new Thread(
             new Runnable() {
               public void run() {
                 try {
                   TTSPlayer.getInstance()
                       .loadPlayfile(
                           API.getInstance()
                               .getVoice()
                               .tts(
                                   (Settings.getInstance().getDTO().isTTSCardHeader()
                                           ? _itemVO.getName() + ", "
                                           : "")
                                       + _infoVO.getStatusMessage().trim())
                               .getAudioURI());
                 } catch (Exception exception) {
                   Debug.displayStack(this, exception);
                 }
               }
             })
         .start();
 }