mirror of https://github.com/zlatinb/muwire
count the width of link labels before any html escaping
parent
681e0420cd
commit
87f4eae0c9
|
@ -18,7 +18,7 @@ class CollectionLinkLabel extends MuLinkLabel {
|
||||||
StringBuffer sb = new StringBuffer()
|
StringBuffer sb = new StringBuffer()
|
||||||
SizeFormatter.format(link.totalSize, sb)
|
SizeFormatter.format(link.totalSize, sb)
|
||||||
|
|
||||||
return HTMLSanitizer.escape(link.name) + " (" + link.numFiles + " " + trans("FILES") +
|
return link.name + " (" + link.numFiles + " " + trans("FILES") +
|
||||||
" " + sb.toString() + trans("BYTES_SHORT") + ")"
|
" " + sb.toString() + trans("BYTES_SHORT") + ")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@ class FileLinkLabel extends MuLinkLabel {
|
||||||
StringBuffer sb = new StringBuffer()
|
StringBuffer sb = new StringBuffer()
|
||||||
SizeFormatter.format(link.fileSize, sb)
|
SizeFormatter.format(link.fileSize, sb)
|
||||||
|
|
||||||
HTMLSanitizer.escape(link.name) + " (" + sb.toString() + trans("BYTES_SHORT") + ")"
|
link.name + " (" + sb.toString() + trans("BYTES_SHORT") + ")"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.muwire.gui.chat
|
package com.muwire.gui.chat
|
||||||
|
|
||||||
|
import com.muwire.gui.HTMLSanitizer
|
||||||
import com.muwire.gui.UISettings
|
import com.muwire.gui.UISettings
|
||||||
import com.muwire.core.mulinks.MuLink
|
import com.muwire.core.mulinks.MuLink
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ abstract class MuLinkLabel extends JLabel {
|
||||||
this.settings = settings
|
this.settings = settings
|
||||||
|
|
||||||
String visibleText = getVisibleText()
|
String visibleText = getVisibleText()
|
||||||
String nbspd = visibleText.replaceAll(" ", " ")
|
String escaped = HTMLSanitizer.escape(visibleText)
|
||||||
setText("<html>$nbspd</html>")
|
setText("<html>$escaped</html>")
|
||||||
|
|
||||||
int preferredX = 0, preferredY = 24
|
int preferredX = 0, preferredY = 24
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue