LegalityLabel instance with the specified text
* and the given DeckValidator.
*
* @param text The text to be displayed by the label.
* @param validator The DeckValidator to check against.
*/
public LegalityLabel(String text, DeckValidator validator) {
super(text);
this.validator = validator;
setBackground(COLOR_UNKNOWN);
setForeground(COLOR_TEXT);
setHorizontalAlignment(SwingConstants.CENTER);
setMinimumSize(DIM_MINIMUM);
setMaximumSize(DIM_MAXIMUM);
setName(text); // NOI18N
setOpaque(true);
setPreferredSize(DIM_PREFERRED);
}
/**
* Creates a LegalityLabel instance with the given DeckValidator and uses its
* shortName as the text.
*
* @param validator The DeckValidator to check against.
*/
public LegalityLabel(DeckValidator validator) {
this(validator.getShortName(), validator);
}
/**
* Creates a LegalityLabel instance with no DeckValidator or text.
* This is used by the Netbeans GUI Editor.
*/
public LegalityLabel() {
super();
setBackground(COLOR_UNKNOWN);
setForeground(COLOR_TEXT);
setHorizontalAlignment(SwingConstants.CENTER);
setMinimumSize(DIM_MINIMUM);
setMaximumSize(DIM_MAXIMUM);
setOpaque(true);
setPreferredSize(DIM_PREFERRED);
}
/**
* Creates hide button to close legality panel (must be same size as label)
*/
public static JButton createHideButton() {
JButton button = new JButton("Hide");
button.setHorizontalAlignment(SwingConstants.CENTER);
button.setMinimumSize(DIM_MINIMUM);
button.setMaximumSize(DIM_MAXIMUM);
button.setPreferredSize(DIM_PREFERRED);
return button;
}
public String getErrorMessage() {
return errorMessage;
}
public DeckValidator getValidator() {
return validator;
}
public void setValidator(DeckValidator validator) {
this.validator = validator;
revalidateDeck();
}
protected String escapeHtml(String string) {
return HtmlEscape.escapeHtml(string, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_HEXA, HtmlEscapeLevel.LEVEL_0_ONLY_MARKUP_SIGNIFICANT_EXCEPT_APOS);
}
protected String formatInvalidTooltip(java.util.ListDeck is INVALID
" + "The following problems have been found (click to select problem cards):" + "| %s | %s |
Deck is PARTLY VALID
" + "The following problems have been found (click to select problem cards):" + "| %s | %s |