Changeset 3863 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
- Timestamp:
- 2011-02-07T09:35:27+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
r3843 r3863 2 2 package org.openstreetmap.josm.gui.mappaint; 3 3 4 import static org.openstreetmap.josm.tools.I18n.trn; 5 4 6 import java.io.File; 7 import java.io.IOException; 8 import java.io.InputStream; 9 import java.util.ArrayList; 10 import java.util.Collection; 11 import java.util.Collections; 12 import java.util.List; 13 14 import javax.swing.ImageIcon; 5 15 6 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 7 17 import org.openstreetmap.josm.gui.preferences.SourceEntry; 18 import org.openstreetmap.josm.tools.ImageProvider; 8 19 9 20 abstract public class StyleSource extends SourceEntry { 10 public boolean hasError = false; 21 22 private List<Throwable> errors = new ArrayList<Throwable>(); 11 23 public File zipIcons; 12 24 … … 22 34 23 35 abstract public void loadStyleSource(); 36 37 abstract public InputStream getSourceInputStream() throws IOException; 38 39 public void logError(Throwable e) { 40 errors.add(e); 41 } 42 43 public Collection<Throwable> getErrors() { 44 return Collections.unmodifiableCollection(errors); 45 } 46 47 protected void clearErrors() { 48 errors.clear(); 49 } 50 51 private ImageIcon pencil = ImageProvider.get("dialogs/mappaint", "pencil"); 52 53 protected ImageIcon getSourceIcon() { 54 return pencil; 55 } 56 57 final public ImageIcon getIcon() { 58 if (getErrors().isEmpty()) 59 return getSourceIcon(); 60 else 61 return ImageProvider.overlay(getSourceIcon(), 62 "dialogs/mappaint/error_small", 63 ImageProvider.OverlayPosition.SOUTHEAST); 64 } 65 66 public String getToolTipText() { 67 if (errors.isEmpty()) 68 return null; 69 else 70 return trn("There was an error when loading this style. Select ''Info'' from the right click menu for details.", 71 "There were {0} errors when loading this style. Select ''Info'' from the right click menu for details.", 72 errors.size(), errors.size()); 73 } 24 74 }
Note:
See TracChangeset
for help on using the changeset viewer.