Changeset 29572 in osm for applications/editors/josm/plugins/geochat
- Timestamp:
- 2013-05-09T21:34:32+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/geochat
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/geochat/src/geochat/GeoChatPanel.java
r29571 r29572 152 152 /* ================== Notifications in the title ======================= */ 153 153 154 private String cachedTitle = null; 155 private int cachedAlarm = 0; 156 157 @Override 158 public void setTitle( String title ) { 159 setTitle(title, -1); 160 } 161 162 private void setTitle( String title, int alarmLevel ) { 163 boolean changed = false; 164 if( title != null && (cachedTitle == null || !cachedTitle.equals(title)) ) { 165 cachedTitle = title; 166 changed = true; 167 } 168 if( alarmLevel >= 0 && cachedAlarm != alarmLevel ) { 169 cachedAlarm = alarmLevel; 170 changed = true; 171 } 172 if( changed ) { 173 String alarm = cachedAlarm <= 0 ? "" : cachedAlarm == 1 ? "* " : "!!! "; 174 super.setTitle(alarm + cachedTitle); 175 // todo: title becomes cut off 176 } 177 } 178 154 /** 155 * Display number of users and notifications in the panel title. 156 */ 179 157 protected void updateTitleAlarm() { 180 int notifyLevel = chatPanes.getNotifyLevel(); 181 setTitle(null, isDialogInCollapsedView() ? notifyLevel : Math.min(1, notifyLevel)); 182 } 183 158 int alarmLevel = chatPanes.getNotifyLevel(); 159 if( !isDialogInCollapsedView() && alarmLevel > 1 ) 160 alarmLevel = 1; 161 String name = users.isEmpty() ? tr("GeoChat") : 162 trn("GeoChat ({0} user)", "GeoChat ({0} users)", users.size(), users.size()); 163 String alarm = alarmLevel <= 0 ? "" : alarmLevel == 1 ? "* " : "!!! "; 164 setTitle(alarm + name); 165 } 166 167 /** 168 * Track panel collapse events. 169 */ 184 170 @Override 185 171 protected void setIsCollapsed( boolean val ) { … … 238 224 chatPanes.addLineToPublic(tr("User {0} is mapping nearby", uname)); 239 225 } 240 setTitle(trn("GeoChat ({0} user)", "GeoChat ({0} users)", newUsers.size(), newUsers.size()));241 226 this.users = newUsers; 227 updateTitleAlarm(); 242 228 if( userLayerActive && Main.map.mapView != null ) 243 229 Main.map.mapView.repaint();
Note:
See TracChangeset
for help on using the changeset viewer.