Пример #1
0
 public void mouseClicked(MouseEvent e) {
   JEditorPane editor = (JEditorPane) e.getSource();
   if (editor.isEditable() && SwingUtilities.isLeftMouseButton(e)) {
     if (e.getClickCount() == 2) {
       editor.setEditable(false);
       super.mouseClicked(e);
       editor.setEditable(true);
     }
   }
 }
Пример #2
0
 @SuppressWarnings("unused")
 public void mouseMoved(MouseEvent e) {
   JEditorPane editor = (JEditorPane) e.getSource();
   if (editor.isEditable()) {
     boolean isNeedCursorChange = false;
     editor.setEditable(false);
     isNeedCursorChange = true;
     super.mouseMoved(e);
     isNeedCursorChange = false;
     editor.setEditable(true);
     isNeedCursorChange = true;
   }
 }
Пример #3
0
  public List<Row> getAttributes(
      Allocatable allocatable, LinkController controller, boolean excludeAdditionalInfos) {
    ArrayList<Row> att = new ArrayList<Row>();
    att.addAll(super.getClassificationAttributes(allocatable, excludeAdditionalInfos, controller));
    final Locale locale = getLocale();
    User owner = allocatable.getOwner();
    User lastChangeBy = allocatable.getLastChangedBy();
    if (owner != null) {
      final String ownerName = owner.getName(locale);
      String ownerText = encode(ownerName);
      if (controller != null) ownerText = controller.createLink(owner, ownerName);

      att.add(new Row(getString("resource.owner"), ownerText));
    }
    if (lastChangeBy != null && (owner == null || !lastChangeBy.equals(owner))) {
      final String lastChangedName = lastChangeBy.getName(locale);
      String lastChangeByText = encode(lastChangedName);
      if (controller != null)
        lastChangeByText = controller.createLink(lastChangeBy, lastChangedName);
      att.add(new Row(getString("last_changed_by"), lastChangeByText));
    }

    return att;
  }
Пример #4
0
  public List<Row> getAttributes(
      Reservation reservation,
      LinkController controller,
      User user,
      boolean excludeAdditionalInfos) {
    ArrayList<Row> att = new ArrayList<Row>();
    att.addAll(getClassificationAttributes(reservation, excludeAdditionalInfos, controller));
    User owner = reservation.getOwner();
    final Locale locale = getLocale();
    if (owner != null) {
      final String ownerName = owner.getName(locale);
      String ownerText = encode(ownerName);
      if (controller != null) ownerText = controller.createLink(owner, ownerName);
      att.add(new Row(getString("reservation.owner"), ownerText));
    }
    User lastChangeBy = reservation.getLastChangedBy();
    if (lastChangeBy != null && (owner == null || !lastChangeBy.equals(owner))) {
      final String lastChangedName = lastChangeBy.getName(locale);
      String lastChangeByText = encode(lastChangedName);
      if (controller != null)
        lastChangeByText = controller.createLink(lastChangeBy, lastChangedName);
      att.add(new Row(getString("last_changed_by"), lastChangeByText));
    }

    Allocatable[] resources = reservation.getResources();
    String resourceList = allocatableList(reservation, resources, user, controller);
    if (resourceList.length() > 0) {
      att.add(new Row(getString("resources"), resourceList));
    }
    Allocatable[] persons = reservation.getPersons();
    String personList = allocatableList(reservation, persons, user, controller);
    if (personList.length() > 0) {
      att.add(new Row(getString("persons"), personList));
    }
    return att;
  }
Пример #5
0
 private String allocatableList(
     Reservation reservation, Allocatable[] allocatables, User user, LinkController controller) {
   StringBuffer buf = new StringBuffer();
   for (int i = 0; i < allocatables.length; i++) {
     Allocatable allocatable = allocatables[i];
     if (user != null && !allocatable.canReadOnlyInformation(user)) continue;
     if (controller != null) controller.createLink(allocatable, getName(allocatable), buf);
     else encode(getName(allocatable), buf);
     addRestriction(reservation, allocatable, buf);
     if (i < allocatables.length - 1) {
       buf.append(",");
     }
   }
   return buf.toString();
 }