use of com.codename1.rad.models.Attribute in project CodeRAD by shannah.
the class ElementSelector method getDate.
/**
* Gets a date value on this selector. This uses a notation that allows you to target
* the current result, or a subselection.
* @param key The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"
* @param formats DateFormats to attempt to parse date with.
* @return
*/
public Date getDate(String key, DateFormat... formats) {
String o = getString(key, null);
if (o == null) {
return null;
}
String strval = String.valueOf(o);
if (strval.isEmpty()) {
return null;
}
for (DateFormat fmt : formats) {
try {
return fmt.parse(strval);
} catch (Throwable t) {
}
}
throw new RuntimeException("Failed to parse key " + key + " value " + o + " using any of the provided date formatters.");
}
use of com.codename1.rad.models.Attribute in project CodenameOne by codenameone.
the class CSSEngine method applyStyleToUIElement.
// //////
// CSS2 additions end
// /////
/**
* Applies the given CSS directives to the component
*
* @param ui The component representing (part of) the element that the style should be applied to
* @param selector The style attributes relating to this element
* @param element The element the style should be applied to
* @param htmlC The HTMLComponent to which this element belongs to
* @param focus true if the style should be applied only to the selected state iof the ui (a result of pseudo-class selector a:focus etc.)
*/
private void applyStyleToUIElement(Component ui, CSSElement selector, HTMLElement element, HTMLComponent htmlC) {
// count++;
// This is relevant only for non recursive types - otherwise we need to recheck everytime since it depends on the specific UI component class
int styles = getApplicableStyles(ui, selector);
// White spaces
if (HTMLComponent.FIXED_WIDTH) {
// This works well only in fixed width mode (Since we cannot "force" a newline in FlowLayout)
// TODO - enable in FIXED_WIDTH for pre vs. normal/nowrap
int space = selector.getAttrVal(CSSElement.CSS_WHITE_SPACE);
if (space != -1) {
switch(space) {
case WHITE_SPACE_NORMAL:
setWrapRecursive(element, htmlC);
break;
case WHITE_SPACE_NOWRAP:
setNowrapRecursive(element);
break;
case WHITE_SPACE_PRE:
// TODO - Not implemented yet
break;
}
}
}
// Input format
String v = selector.getAttributeById(CSSElement.CSS_WAP_INPUT_FORMAT);
if ((v != null) && ((element.getTagId() == HTMLElement.TAG_TEXTAREA) || (element.getTagId() == HTMLElement.TAG_INPUT)) && (ui instanceof TextArea)) {
v = omitQuotesIfExist(v);
// This may return a new instance of TextField taht has to be updated in the tree. This is alos the reason why input format is the first thing checked - see HTMLInputFormat.applyConstraints
ui = htmlC.setInputFormat((TextArea) ui, v);
element.setAssociatedComponents(ui);
}
// Input emptyOK
int inputRequired = selector.getAttrVal(CSSElement.CSS_WAP_INPUT_REQUIRED);
if ((inputRequired != -1) && ((element.getTagId() == HTMLElement.TAG_TEXTAREA) || (element.getTagId() == HTMLElement.TAG_INPUT)) && (ui instanceof TextArea)) {
if (inputRequired == INPUT_REQUIRED_TRUE) {
htmlC.setInputRequired(((TextArea) ui), true);
} else if (inputRequired == INPUT_REQUIRED_FALSE) {
htmlC.setInputRequired(((TextArea) ui), false);
}
}
// Display
int disp = selector.getAttrVal(CSSElement.CSS_DISPLAY);
switch(disp) {
case DISPLAY_NONE:
if (ui.getParent() != null) {
ui.getParent().removeComponent(ui);
} else {
// special case for display in the BODY tag
if (ui instanceof Container) {
((Container) ui).removeAll();
}
}
return;
case // Animate component (ticker-like)
DISPLAY_MARQUEE:
htmlC.marqueeComponents.addElement(ui);
break;
}
// Visibility
int visibility = selector.getAttrVal(CSSElement.CSS_VISIBILITY);
if (visibility != -1) {
boolean visible = (visibility == VISIBILITY_VISIBLE);
setVisibleRecursive(ui, visible);
if (!visible) {
// Don't waste time on processing hidden elements, though technically the size of the element is still reserved and should be according to style
return;
} else {
// Need to turn on visibility of all component's parents, in case they were declared hidden
setParentsVisible(ui);
}
}
//
// Dimensions
//
// TODO - debug: Width and Height don't always work - for simple components they usually do, but for containers either they don't have any effect or some inner components (with size restrictions) disappear
// We use the entire display width and height as reference since htmlC still doesn't have a preferred size or actual size
// Width
// TODO - Width/Height is disabled currently, since it causes a lot of side effects, making some components disappear
/*
int width=selector.getAttrLengthVal(CSSElement.CSS_WIDTH,ui,Display.getInstance().getDisplayWidth());
// Height
int height=selector.getAttrLengthVal(CSSElement.CSS_HEIGHT,ui,Display.getInstance().getDisplayHeight());
if (!HTMLComponent.PROCESS_HTML_MP1_ONLY) {
int minWidth=selector.getAttrLengthVal(CSSElement.CSS_MIN_WIDTH,ui,Display.getInstance().getDisplayWidth());
int maxWidth=selector.getAttrLengthVal(CSSElement.CSS_MAX_WIDTH,ui,Display.getInstance().getDisplayWidth());
int minHeight=selector.getAttrLengthVal(CSSElement.CSS_MIN_HEIGHT,ui,Display.getInstance().getDisplayHeight());
int maxHeight=selector.getAttrLengthVal(CSSElement.CSS_MAX_HEIGHT,ui,Display.getInstance().getDisplayHeight());
if (width==-1) { // process min/max only if exact was not specified
if ((minWidth!=-1) && (minWidth>ui.getPreferredW())) {
width=minWidth;
}
if ((maxWidth!=-1) && (maxWidth<ui.getPreferredW())) {
width=maxWidth;
}
}
if (height==-1) { // process min/max only if exact was not specified
if ((minHeight!=-1) && (minHeight>ui.getPreferredH())) {
height=minHeight;
}
if ((maxHeight!=-1) && (maxHeight<ui.getPreferredH())) {
height=maxHeight;
}
}
}
if ((width!=-1) || (height!=-1)) {
if (width==-1) {
width=ui.getPreferredW();
}
if (height==-1) {
height=ui.getPreferredH();
}
ui.setPreferredSize(new Dimension(width,height));
}
*/
//
// Colors
//
// Background Color
int bgColor = selector.getAttrVal(CSSElement.CSS_BACKGROUND_COLOR);
if (bgColor != -1) {
if ((styles & STYLE_UNSELECTED) != 0) {
ui.getUnselectedStyle().setBgColor(bgColor);
ui.getUnselectedStyle().setBgTransparency(255);
}
if ((styles & STYLE_SELECTED) != 0) {
ui.getSelectedStyle().setBgColor(bgColor);
ui.getSelectedStyle().setBgTransparency(255);
}
if ((styles & STYLE_PRESSED) != 0) {
((HTMLLink) ui).getPressedStyle().setBgColor(bgColor);
((HTMLLink) ui).getPressedStyle().setBgTransparency(255);
}
}
// Foreground color
int fgColor = selector.getAttrVal(CSSElement.CSS_COLOR);
if (fgColor != -1) {
setColorRecursive(ui, fgColor, selector);
}
// Background Image
v = selector.getAttributeById(CSSElement.CSS_BACKGROUND_IMAGE);
if (v != null) {
String url = getCSSUrl(v);
if (url != null) {
// Setting an alternative bgPainter that can support CSS background properties
CSSBgPainter bgPainter = new CSSBgPainter(ui);
// Background tiling
byte bgType = (byte) selector.getAttrVal(CSSElement.CSS_BACKGROUND_REPEAT);
if (bgType == -1) {
// default value
bgType = Style.BACKGROUND_IMAGE_TILE_BOTH;
}
// Note that we don't set transparency to 255, since the image may have its own transparency/opaque areas - we don't want to block the entire component/container entirely
if ((styles & STYLE_SELECTED) != 0) {
ui.getSelectedStyle().setBgPainter(bgPainter);
ui.getSelectedStyle().setBackgroundType(bgType);
}
if ((styles & STYLE_UNSELECTED) != 0) {
ui.getUnselectedStyle().setBgPainter(bgPainter);
ui.getUnselectedStyle().setBackgroundType(bgType);
}
if ((styles & STYLE_PRESSED) != 0) {
((HTMLLink) ui).getPressedStyle().setBgPainter(bgPainter);
((HTMLLink) ui).getPressedStyle().setBackgroundType(bgType);
}
// The background image itself
if (htmlC.showImages) {
if (htmlC.getDocumentInfo() != null) {
htmlC.getThreadQueue().addBgImage(ui, htmlC.convertURL(url), styles);
} else {
if (DocumentInfo.isAbsoluteURL(url)) {
htmlC.getThreadQueue().addBgImage(ui, url, styles);
} else {
if (htmlC.getHTMLCallback() != null) {
htmlC.getHTMLCallback().parsingError(HTMLCallback.ERROR_NO_BASE_URL, selector.getTagName(), selector.getAttributeName(new Integer(CSSElement.CSS_BACKGROUND_IMAGE)), url, "Ignoring background image file referred in a CSS file/segment (" + url + "), since page was set by setBody/setHTML/setDOM so there's no way to access relative URLs");
}
}
}
}
for (int i = CSSElement.CSS_BACKGROUND_POSITION_X; i <= CSSElement.CSS_BACKGROUND_POSITION_Y; i++) {
int pos = selector.getAttrVal(i);
if (pos != -1) {
bgPainter.setPosition(i, pos);
}
}
// or 'scroll' (default) which means the it moves with scrolling (Like usually in CodenameOne backgrounds)
if (selector.getAttrVal((CSSElement.CSS_BACKGROUND_ATTACHMENT)) == BG_ATTACHMENT_FIXED) {
bgPainter.setFixed();
}
}
}
// TODO - float: none/left/right
// TODO - clear: none/left/right/both
// Margin
Component marginComp = ui;
if (ui instanceof Label) {
// If this is a Label/HTMLLink we do not apply the margin individually to each word, but rather to the whole block
marginComp = ui.getParent();
} else if ((element.getTagId() == HTMLElement.TAG_LI) && (ui.getParent().getLayout() instanceof BorderLayout)) {
marginComp = ui.getParent();
}
for (int i = CSSElement.CSS_MARGIN_TOP; i <= CSSElement.CSS_MARGIN_RIGHT; i++) {
int marginPixels = -1;
if ((i == CSSElement.CSS_MARGIN_TOP) || (i == CSSElement.CSS_MARGIN_BOTTOM)) {
// Here the used component is ui and not marginComp, since we're interested in the font size (which will be corrent in Labels not in their containers)
marginPixels = selector.getAttrLengthVal(i, ui, htmlC.getHeight());
} else {
marginPixels = selector.getAttrLengthVal(i, ui, htmlC.getWidth());
}
if (marginPixels >= 0 && marginComp != null) {
if ((styles & STYLE_SELECTED) != 0) {
marginComp.getSelectedStyle().setMargin(i - CSSElement.CSS_MARGIN_TOP, marginPixels);
// parent when the link focuses
if ((ui instanceof HTMLLink) && (styles == STYLE_SELECTED)) {
((HTMLLink) ui).setParentChangesOnFocus();
}
}
if ((styles & STYLE_UNSELECTED) != 0) {
marginComp.getUnselectedStyle().setMargin(i - CSSElement.CSS_MARGIN_TOP, marginPixels);
}
// Since we don't apply the margin/padding on the component but rather on its parent
// There is no point in setting the PRESSED style since we don't have a pressed event from Button, nor do we have a pressedStyle for containers
// That's why we can't do the same trick as in selected style, and the benefit of this rather "edge" case (That is anyway not implemented in all browsers) seems rather small
// if ((styles & STYLE_PRESSED)!=0) {
// ((HTMLLink)ui).getPressedStyle().setMargin(i-CSSElement.CSS_MARGIN_TOP, marginPixels);
// }
}
}
Component padComp = ui;
if (ui instanceof Label) {
padComp = ui.getParent();
} else if ((element.getTagId() == HTMLElement.TAG_LI) && (ui.getParent().getLayout() instanceof BorderLayout)) {
padComp = ui.getParent();
}
for (int i = CSSElement.CSS_PADDING_TOP; i <= CSSElement.CSS_PADDING_RIGHT; i++) {
int padPixels = -1;
if ((i == CSSElement.CSS_PADDING_TOP) || (i == CSSElement.CSS_PADDING_BOTTOM)) {
padPixels = selector.getAttrLengthVal(i, ui, htmlC.getHeight());
} else {
padPixels = selector.getAttrLengthVal(i, ui, htmlC.getWidth());
}
if (padPixels >= 0) {
// Only positive or 0
if ((styles & STYLE_SELECTED) != 0) {
if (padComp != null) {
padComp.getSelectedStyle().setPadding(i - CSSElement.CSS_PADDING_TOP, padPixels);
}
if ((ui instanceof HTMLLink) && (styles == STYLE_SELECTED)) {
// See comment on margins
((HTMLLink) ui).setParentChangesOnFocus();
}
}
if ((styles & STYLE_UNSELECTED) != 0) {
if (padComp != null) {
padComp.getUnselectedStyle().setPadding(i - CSSElement.CSS_PADDING_TOP, padPixels);
}
}
// See comment in margin on why PRESSED was dropped
// if ((styles & STYLE_PRESSED)!=0) {
// ((HTMLLink)padComp).getPressedStyle().setPadding(i-CSSElement.CSS_PADDING_TOP, padPixels);
// }
}
}
//
// Text
//
// Text Alignment
int align = selector.getAttrVal(CSSElement.CSS_TEXT_ALIGN);
if (align != -1) {
switch(element.getTagId()) {
case HTMLElement.TAG_TD:
case HTMLElement.TAG_TH:
setTableCellAlignment(element, ui, align, true);
break;
case HTMLElement.TAG_TR:
setTableCellAlignmentTR(element, ui, align, true);
break;
case HTMLElement.TAG_TABLE:
setTableAlignment(ui, align, true);
break;
default:
// TODO - this sometimes may collide with the HTML align attribute. If the style of the same tag has alignment it overrides the align attribute, but if it is inherited, the align tag prevails
setTextAlignmentRecursive(ui, align);
}
}
// Vertical align
int valign = selector.getAttrVal(CSSElement.CSS_VERTICAL_ALIGN);
if (valign != -1) {
switch(element.getTagId()) {
case HTMLElement.TAG_TD:
case HTMLElement.TAG_TH:
setTableCellAlignment(element, ui, valign, false);
break;
case HTMLElement.TAG_TR:
setTableCellAlignmentTR(element, ui, valign, false);
break;
// break;
default:
}
}
// Text Transform
int transform = selector.getAttrVal(CSSElement.CSS_TEXT_TRANSFORM);
if (transform != -1) {
setTextTransformRecursive(ui, transform);
}
// Text indentation
int indent = selector.getAttrLengthVal(CSSElement.CSS_TEXT_INDENT, ui, htmlC.getWidth());
if (indent >= 0) {
// Only positive (0 also as it may cancel previous margins)
setTextIndentationRecursive(ui, indent);
}
//
// Font
//
// Font family
String fontFamily = selector.getAttributeById(CSSElement.CSS_FONT_FAMILY);
if (fontFamily != null) {
int index = fontFamily.indexOf(',');
if (index != -1) {
// Currently we ignore font families fall back (i.e. Arial,Helvetica,Sans-serif) since even finding a match for one font is quite expensive performance-wise
fontFamily = fontFamily.substring(0, index);
}
}
// Font Style
int fontStyle = selector.getAttrVal(CSSElement.CSS_FONT_STYLE);
// Font Weight
int fontWeight = selector.getAttrVal(CSSElement.CSS_FONT_WEIGHT);
int fontSize = selector.getAttrLengthVal(CSSElement.CSS_FONT_SIZE, ui, ui.getStyle().getFont().getHeight());
if (fontSize < -1) {
int curSize = ui.getStyle().getFont().getHeight();
if (fontSize == CSSElement.FONT_SIZE_LARGER) {
fontSize = curSize + 2;
} else if (fontSize == CSSElement.FONT_SIZE_SMALLER) {
fontSize = curSize - 2;
}
}
// Since J2ME doesn't support small-caps fonts, when a small-caps font varinat is requested
// the font-family is changed to "smallcaps" which should be loaded to HTMLComponent and the theme as a bitmap font
// If no smallcaps font is found at all, then the family stays the same, but if even only one is found - the best match will be used.
int fontVariant = selector.getAttrVal(CSSElement.CSS_FONT_VARIANT);
if ((fontVariant == FONT_VARIANT_SMALLCAPS) && (htmlC.isSmallCapsFontAvailable())) {
fontFamily = CSSElement.SMALL_CAPS_STRING;
}
// Process font only if once of the font CSS properties was mentioned and valid
if ((fontFamily != null) || (fontSize != -1) || (fontStyle != -1) || (fontWeight != -1)) {
setFontRecursive(htmlC, ui, fontFamily, fontSize, fontStyle, fontWeight, selector);
}
// List style
int listType = -1;
String listImg = null;
Component borderUi = ui;
if ((element.getTagId() == HTMLElement.TAG_LI) || (element.getTagId() == HTMLElement.TAG_UL) || (element.getTagId() == HTMLElement.TAG_OL) || (element.getTagId() == HTMLElement.TAG_DIR) || (element.getTagId() == HTMLElement.TAG_MENU)) {
int listPos = selector.getAttrVal(CSSElement.CSS_LIST_STYLE_POSITION);
if (listPos == LIST_STYLE_POSITION_INSIDE) {
// Padding and not margin since background color should affect also the indented space
ui.getStyle().setPadding(Component.LEFT, ui.getStyle().getMargin(Component.LEFT) + INDENT_LIST_STYLE_POSITION);
Container parent = ui.getParent();
if (parent.getLayout() instanceof BorderLayout) {
borderUi = parent;
}
}
listType = selector.getAttrVal(CSSElement.CSS_LIST_STYLE_TYPE);
listImg = getCSSUrl(selector.getAttributeById(CSSElement.CSS_LIST_STYLE_IMAGE));
}
// Border
Border[] borders = new Border[4];
// Used to prevent drawing a border in the middle of two words in the same segment
boolean leftBorder = false;
// Used to prevent drawing a border in the middle of two words in the same segment
boolean rightBorder = false;
boolean hasBorder = false;
if ((borderUi == ui) && (element.getUi().size() > 1)) {
if (element.getUi().firstElement() == borderUi) {
leftBorder = true;
} else if (element.getUi().lastElement() == borderUi) {
rightBorder = true;
}
} else {
leftBorder = true;
rightBorder = true;
}
for (int i = Component.TOP; i <= Component.RIGHT; i++) {
if ((i == Component.BOTTOM) || (i == Component.TOP) || ((i == Component.LEFT) && (leftBorder)) || ((i == Component.RIGHT) && (rightBorder))) {
borders[i] = createBorder(selector, borderUi, i, styles, BORDER);
if (borders[i] != null) {
hasBorder = true;
}
}
}
if (hasBorder) {
Border curBorder = borderUi.getUnselectedStyle().getBorder();
if (((styles & STYLE_SELECTED) != 0) && ((styles & STYLE_UNSELECTED) == 0)) {
curBorder = borderUi.getSelectedStyle().getBorder();
}
if ((styles & STYLE_PRESSED) != 0) {
curBorder = ((HTMLLink) borderUi).getSelectedStyle().getBorder();
}
// In case this element was assigned a top border for instance, and then by belonging to another tag/class/id it has also a bottom border - this merges the two (and gives priority to the new one)
if ((curBorder != null) && (curBorder.getCompoundBorders() != null)) {
// TODO - This doesn't cover the case of having another border (i.e. table/fieldset?) - Can also assign the non-CSS border to the other corners?
// curBorder.
Border[] oldBorders = curBorder.getCompoundBorders();
for (int i = Component.TOP; i <= Component.RIGHT; i++) {
if (borders[i] == null) {
borders[i] = oldBorders[i];
}
}
}
Border border = Border.createCompoundBorder(borders[Component.TOP], borders[Component.BOTTOM], borders[Component.LEFT], borders[Component.RIGHT]);
if (border != null) {
if ((styles & STYLE_SELECTED) != 0) {
borderUi.getSelectedStyle().setBorder(border);
}
if ((styles & STYLE_UNSELECTED) != 0) {
borderUi.getUnselectedStyle().setBorder(border);
}
if ((styles & STYLE_PRESSED) != 0) {
((HTMLLink) borderUi).getPressedStyle().setBorder(border);
}
if (borderUi.getParent() != null) {
borderUi.getParent().revalidate();
} else if (borderUi instanceof Container) {
((Container) borderUi).revalidate();
}
}
}
//
// Specific elements styling
//
// Access keys
v = selector.getAttributeById(CSSElement.CSS_WAP_ACCESSKEY);
if ((v != null) && (v.length() >= 1) && (// These are the only tags that can accpet an access key
(element.getTagId() == HTMLElement.TAG_INPUT) || (element.getTagId() == HTMLElement.TAG_TEXTAREA) || (element.getTagId() == HTMLElement.TAG_LABEL) || // For A tags this is applied only to the first word, no need to apply it to each word of the link
((element.getTagId() == HTMLElement.TAG_A) && (ui instanceof HTMLLink) && ((HTMLLink) ui).parentLink == null))) {
// The accesskey string may consist fallback assignments (comma seperated) and multiple assignments (space seperated) and any combination of those
// For example: "send *, #" (meaning: assign both the send and * keys, and if failed to assign one of those assign the # key instead)
int index = v.indexOf(',');
boolean assigned = false;
while (index != -1) {
// Handle fallback access keys
String key = v.substring(0, index).trim();
v = v.substring(index + 1);
assigned = processAccessKeys(key, htmlC, ui);
if (assigned) {
// comma denotes fallback, and once we succeeded assigning the accesskey, the others are irrelevant
break;
}
index = v.indexOf(',');
}
if (!assigned) {
processAccessKeys(v.trim(), htmlC, ui);
}
}
if (!HTMLComponent.PROCESS_HTML_MP1_ONLY) {
// Text decoration (In HTML-MP1 the only mandatory decoration is 'none')
int decoration = selector.getAttrVal(CSSElement.CSS_TEXT_DECORATION);
if (decoration == TEXT_DECOR_NONE) {
removeTextDecorationRecursive(ui, selector);
} else if (decoration == TEXT_DECOR_UNDERLINE) {
setTextDecorationRecursive(ui, Style.TEXT_DECORATION_UNDERLINE, selector);
} else if (decoration == TEXT_DECOR_LINETHROUGH) {
setTextDecorationRecursive(ui, Style.TEXT_DECORATION_STRIKETHRU, selector);
} else if (decoration == TEXT_DECOR_OVERLINE) {
setTextDecorationRecursive(ui, Style.TEXT_DECORATION_OVERLINE, selector);
}
// Word spacing
if (!HTMLComponent.FIXED_WIDTH) {
// The relative dimension is 0, since percentage doesn't work with word-spacing in browsers
int wordSpace = selector.getAttrLengthVal(CSSElement.CSS_WORD_SPACING, ui, 0);
if (wordSpace != -1) {
setWordSpacingRecursive(ui, wordSpace);
}
}
// Line height
// Technically the font height should be queried when actually resizing the line (since it may differ for a big block) - but since this would be ery time consuming and also major browsers don't take it into account - we'll do the same
// int lineHeight=selector.getAttrLengthVal(CSSElement.CSS_LINE_HEIGHT, ui, ui.getStyle().getFont().getHeight());
int lineHeight = selector.getAttrLengthVal(CSSElement.CSS_LINE_HEIGHT, ui, ui.getStyle().getFont().getHeight());
if (lineHeight != -1) {
// 100% means normal line height (don't add margin). Sizes below will not work, even they do in regular browsers
lineHeight = Math.max(0, lineHeight - ui.getStyle().getFont().getHeight());
setLineHeightRecursive(ui, lineHeight / 2);
}
// Quotes
String quotesStr = selector.getAttributeById(CSSElement.CSS_QUOTES);
if (quotesStr != null) {
Vector quotes = htmlC.getWords(quotesStr, Component.LEFT, false);
int size = quotes.size();
if ((size == 2) || (size == 4)) {
String[] quotesArr = new String[4];
for (int i = 0; i < size; i++) {
quotesArr[i] = omitQuotesIfExist((String) quotes.elementAt(i));
}
if (size == 2) {
// If only 2 quotes are specified they are used both as primary and secondary
quotesArr[2] = quotesArr[0];
quotesArr[3] = quotesArr[1];
}
setQuotesRecursive(ui, quotesArr);
}
}
// Outline
Border outline = createBorder(selector, borderUi, 0, styles, OUTLINE);
if (outline != null) {
if ((styles & STYLE_SELECTED) != 0) {
addOutlineToStyle(borderUi.getSelectedStyle(), outline);
}
if ((styles & STYLE_UNSELECTED) != 0) {
addOutlineToStyle(borderUi.getUnselectedStyle(), outline);
}
if ((styles & STYLE_PRESSED) != 0) {
addOutlineToStyle(((HTMLLink) borderUi).getPressedStyle(), outline);
}
if (borderUi.getParent() != null) {
borderUi.getParent().revalidate();
} else if (borderUi instanceof Container) {
((Container) borderUi).revalidate();
}
}
// Direction
int dir = selector.getAttrVal(CSSElement.CSS_DIRECTION);
if (dir != -1) {
setDirectionRecursive(ui, dir == DIRECTION_RTL);
}
// Table properties
if (ui instanceof HTMLTable) {
int tableProp = selector.getAttrVal(CSSElement.CSS_BORDER_COLLAPSE);
if (tableProp != -1) {
((HTMLTable) ui).setCollapseBorder(tableProp == BORDER_COLLAPSE_COLLAPSE);
}
tableProp = selector.getAttrVal(CSSElement.CSS_EMPTY_CELLS);
if (tableProp != -1) {
((HTMLTable) ui).setDrawEmptyCellsBorder(tableProp == EMPTY_CELLS_SHOW);
}
// bottom = 0 , top = 1
tableProp = selector.getAttrVal(CSSElement.CSS_CAPTION_SIDE);
if (tableProp != -1) {
Container tableParentCont = ui.getParent();
// should result in 0 when the caption is at the bottom, and 1 when the caption is on top
int tablePos = tableParentCont.getComponentIndex(ui);
if (tableProp != tablePos) {
Component caption = tableParentCont.getComponentAt((tablePos + 1) % 2);
tableParentCont.removeComponent(caption);
tableParentCont.addComponent(tablePos, caption);
}
}
String spacing = selector.getAttributeById(CSSElement.CSS_BORDER_SPACING);
if (spacing != null) {
spacing = spacing.trim();
int index = spacing.indexOf(' ');
int spaceH = 0;
int spaceV = 0;
if (index == -1) {
// one value only
spaceH = CSSElement.convertLengthVal(CSSElement.convertUnitsOrPercentage(spacing), ui, ui.getPreferredW());
spaceV = spaceH;
} else {
String spaceHoriz = spacing.substring(0, index);
String spaceVert = spacing.substring(index + 1);
spaceH = CSSElement.convertLengthVal(CSSElement.convertUnitsOrPercentage(spaceHoriz), ui, ui.getPreferredW());
spaceV = CSSElement.convertLengthVal(CSSElement.convertUnitsOrPercentage(spaceVert), ui, ui.getPreferredH());
}
((HTMLTable) ui).setBorderSpacing(spaceH, spaceV);
}
}
}
// This is since in some cases other elements can come between a OL/UL and its LI items (Though illegal in HTML, it can occur)
if ((listType != -1) || (listImg != null)) {
if (element.getTagId() == HTMLElement.TAG_LI) {
if (ui instanceof Container) {
Container liCont = (Container) ui;
Container liParent = liCont.getParent();
Component firstComp = liParent.getComponentAt(0);
if (firstComp instanceof Container) {
Container bulletCont = (Container) firstComp;
if (bulletCont.getComponentCount() > 0) {
Component listItemCmp = bulletCont.getComponentAt(0);
if (listItemCmp instanceof Component) {
HTMLListItem listItem = ((HTMLListItem) listItemCmp);
listItem.setStyleType(listType);
listItem.setImage(listImg);
}
}
}
}
} else if ((element.getTagId() == HTMLElement.TAG_UL) || (element.getTagId() == HTMLElement.TAG_OL) || (element.getTagId() == HTMLElement.TAG_DIR) || (element.getTagId() == HTMLElement.TAG_MENU)) {
Container ulCont = (Container) ui;
for (int i = 0; i < ulCont.getComponentCount(); i++) {
Component cmp = ulCont.getComponentAt(i);
if (cmp instanceof Container) {
Container liCont = (Container) cmp;
if (liCont.getComponentCount() >= 1) {
cmp = liCont.getComponentAt(0);
if (cmp instanceof Container) {
Container liContFirstLine = (Container) cmp;
if (liContFirstLine.getComponentCount() >= 1) {
cmp = liContFirstLine.getComponentAt(0);
if (cmp instanceof HTMLListItem) {
HTMLListItem listItem = (HTMLListItem) cmp;
listItem.setStyleType(listType);
listItem.setImage(listImg);
}
}
}
}
}
}
}
}
}
use of com.codename1.rad.models.Attribute in project CodenameOne by codenameone.
the class TableLayout method layoutContainer.
/**
* {@inheritDoc}
*/
public void layoutContainer(Container parent) {
try {
verticalSpanningExists = false;
horizontalSpanningExists = false;
// column and row size in pixels
Style s = parent.getStyle();
int top = s.getPaddingTop();
int left = s.getPaddingLeft(parent.isRTL());
int bottom = s.getPaddingBottom();
int right = s.getPaddingRight(parent.isRTL());
boolean rtl = parent.isRTL();
// compute columns width and X position
int[] columnSizes = new int[columns];
boolean[] modifableColumnSize = new boolean[columns];
boolean[] growingColumnSize = new boolean[columns];
columnPositions = new int[columns];
int pWidth = parent.getLayoutWidth() - parent.getSideGap() - left - right;
int cslen = columnSizes.length;
int availableReminder = pWidth;
int growingWidth = 0;
boolean hasGrowingCols = false;
int totalWidth = 0;
int totalModifyablePixels = 0;
for (int iter = 0; iter < cslen; iter++) {
int[] psize = getColumnWidthPixels(iter, pWidth);
columnSizes[iter] = psize[0];
availableReminder -= columnSizes[iter];
totalWidth += columnSizes[iter];
if (psize[1] < 0) {
modifableColumnSize[iter] = true;
totalModifyablePixels += columnSizes[iter];
}
if (psize[1] < -1) {
growingColumnSize[iter] = true;
hasGrowingCols = true;
growingWidth += columnSizes[iter];
}
}
// If there is some space left and some "auto growing" columns, attribute them the availableReminder space
if (hasGrowingCols && availableReminder > 0) {
for (int iter = 0; iter < cslen; iter++) {
if (growingColumnSize[iter]) {
int sp = (int) (((float) columnSizes[iter]) / ((float) growingWidth) * availableReminder);
columnSizes[iter] += sp;
}
}
}
// to correctly display all the components given their preferred width, truncate or shrink the table
if (!parent.isScrollableX() && pWidth < totalWidth) {
if (truncateHorizontally) {
// TODO: see if this is actually necessary to recompute the column size for truncated columns as the drawer should already automatically clip components with pixels out of the drawing boundaries
availableReminder = pWidth;
for (int iter = 0; iter < cslen; iter++) {
columnSizes[iter] = Math.min(columnSizes[iter], Math.max(0, availableReminder));
availableReminder -= columnSizes[iter];
}
} else {
// try to recalculate the columns width so they are distributed sensibly
int totalPixelsToRemove = totalWidth - pWidth;
int totalPixelsNecessary = totalModifyablePixels - totalPixelsToRemove;
// Go over the modifyable columns and remove the right pixels according to the ratio
for (int iter = 0; iter < cslen; iter++) {
if (modifableColumnSize[iter]) {
columnSizes[iter] = (int) (((float) columnSizes[iter]) / ((float) totalModifyablePixels) * totalPixelsNecessary);
}
}
}
}
// Compute X position
int currentX = left;
for (int iter = 0; iter < cslen; iter++) {
if (rtl) {
currentX += columnSizes[iter];
columnPositions[iter] = pWidth - currentX;
} else {
columnPositions[iter] = currentX;
currentX += columnSizes[iter];
}
}
// Compute rows height and Y position
int[] rowSizes = new int[rows];
boolean[] modifableRowSize = new boolean[rows];
boolean[] growingRowSize = new boolean[rows];
rowPositions = new int[rows];
int pHeight = parent.getLayoutHeight() - parent.getBottomGap() - top - bottom;
int rlen = rowSizes.length;
availableReminder = pHeight;
int growingHeight = 0;
boolean hasGrowingRows = false;
int totalHeight = 0;
totalModifyablePixels = 0;
for (int iter = 0; iter < rlen; iter++) {
int[] psize = getRowHeightPixels(iter, pHeight);
rowSizes[iter] = psize[0];
availableReminder -= rowSizes[iter];
totalHeight += rowSizes[iter];
if (psize[0] < 0) {
modifableRowSize[iter] = true;
totalModifyablePixels += rowSizes[iter];
}
if (psize[0] < -1) {
growingRowSize[iter] = true;
hasGrowingRows = true;
growingHeight += rowSizes[iter];
}
}
// If there is some space left and some "auto growing" rows, attribute them the availableReminder space
if (hasGrowingRows && availableReminder > 0) {
for (int iter = 0; iter < rlen; iter++) {
if (growingRowSize[iter]) {
int sp = (int) (((float) rowSizes[iter]) / ((float) growingHeight) * availableReminder);
rowSizes[iter] += sp;
}
}
}
// to correctly display all the components given their preferred height, truncate or shrink the table
if (!parent.isScrollableY() && pHeight < totalHeight) {
if (truncateVertically) {
// TODO: see if this is actually necessary to recompute the row size for truncated rows as the drawer should already automatically clip components with pixels out of the drawing boundaries
availableReminder = pHeight;
for (int iter = 0; iter < rlen; iter++) {
rowSizes[iter] = Math.min(rowSizes[iter], Math.max(0, availableReminder));
availableReminder -= rowSizes[iter];
}
} else {
// try to recalculate the rows height so they are distributed sensibly
int totalPixelsToRemove = totalHeight - pHeight;
int totalPixelsNecessary = totalModifyablePixels - totalPixelsToRemove;
// Go over the modifyable rows and remove the bottom pixels according to the ratio
for (int iter = 0; iter < rlen; iter++) {
if (modifableRowSize[iter]) {
rowSizes[iter] = (int) (((float) rowSizes[iter]) / ((float) totalModifyablePixels) * totalPixelsNecessary);
}
}
}
}
// Compute Y position
int currentY = top;
for (int iter = 0; iter < rlen; iter++) {
rowPositions[iter] = currentY;
currentY += rowSizes[iter];
}
// Place each cell component
int clen = columnSizes.length;
for (int r = 0; r < rlen; r++) {
for (int c = 0; c < clen; c++) {
Constraint con = tablePositions[r * columns + c];
int conX, conY, conW, conH;
if (con != null && con != H_SPAN_CONSTRAINT && con != V_SPAN_CONSTRAINT && con != VH_SPAN_CONSTRAINT) {
Style componentStyle = con.parent.getStyle();
int leftMargin = componentStyle.getMarginLeft(parent.isRTL());
int topMargin = componentStyle.getMarginTop();
// conX = left + leftMargin + columnPositions[c]; // bugfix table with padding not drawn correctly
// conY = top + topMargin + rowPositions[r]; // bugfix table with padding not drawn correctly
conX = leftMargin + columnPositions[c];
conY = topMargin + rowPositions[r];
if (con.spanHorizontal > 1) {
horizontalSpanningExists = true;
int w = columnSizes[c];
for (int sh = 1; sh < con.spanHorizontal; sh++) {
w += columnSizes[Math.min(c + sh, columnSizes.length - 1)];
}
// for RTL we need to move the component to the side so spanning will work
if (rtl) {
int spanEndPos = c + con.spanHorizontal - 1;
if (spanEndPos < 0) {
spanEndPos = 0;
} else if (spanEndPos > clen - 1) {
spanEndPos = clen - 1;
}
conX = left + leftMargin + columnPositions[spanEndPos];
}
conW = w - leftMargin - componentStyle.getMarginRight(parent.isRTL());
} else {
conW = columnSizes[c] - leftMargin - componentStyle.getMarginRight(parent.isRTL());
}
if (con.spanVertical > 1) {
verticalSpanningExists = true;
int h = rowSizes[r];
for (int sv = 1; sv < con.spanVertical; sv++) {
h += rowSizes[Math.min(r + sv, rowSizes.length - 1)];
}
conH = h - topMargin - componentStyle.getMarginBottom();
} else {
conH = rowSizes[r] - topMargin - componentStyle.getMarginBottom();
}
placeComponent(rtl, con, conX, conY, conW, conH);
}
}
}
} catch (ArrayIndexOutOfBoundsException err) {
Log.e(err);
}
}
use of com.codename1.rad.models.Attribute in project CodenameOne by codenameone.
the class AddThemeEntry method initComponents.
/**
* This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
componentName = new javax.swing.JComboBox();
previewPane = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
addTabs = new javax.swing.JTabbedPane();
jPanel3 = new javax.swing.JPanel();
jLabel23 = new javax.swing.JLabel();
imagesCombo = new javax.swing.JComboBox();
addNewImage = new javax.swing.JButton();
jLabel16 = new javax.swing.JLabel();
backgroundType = new javax.swing.JComboBox();
jLabel18 = new javax.swing.JLabel();
gradientStartColor = new javax.swing.JTextField();
changeGradientStartColorButton = new javax.swing.JButton();
gradientEndColor = new javax.swing.JTextField();
changeGradientEndColorButton = new javax.swing.JButton();
jLabel19 = new javax.swing.JLabel();
gradientX = new javax.swing.JSpinner();
gradientY = new javax.swing.JSpinner();
gradientSize = new javax.swing.JSpinner();
deriveBackground = new javax.swing.JCheckBox();
deriveHelp = new javax.swing.JButton();
backgroundHelp = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
colorValueFG = new javax.swing.JTextField();
changeColorButtonFG = new javax.swing.JButton();
deriveForegroundColor = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
colorValueBG = new javax.swing.JTextField();
changeColorButtonBG = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
deriveBackgroundColor = new javax.swing.JCheckBox();
deriveTransparency = new javax.swing.JCheckBox();
jLabel5 = new javax.swing.JLabel();
transparencyValue = new javax.swing.JSpinner();
deriveHelp1 = new javax.swing.JButton();
colorHelp = new javax.swing.JButton();
jLabel15 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel20 = new javax.swing.JLabel();
alignmentCombo = new javax.swing.JComboBox();
deriveAlignment = new javax.swing.JCheckBox();
deriveHelp2 = new javax.swing.JButton();
alignHelp = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
paddingLeft = new javax.swing.JSpinner();
jLabel9 = new javax.swing.JLabel();
paddingRight = new javax.swing.JSpinner();
jLabel10 = new javax.swing.JLabel();
paddingTop = new javax.swing.JSpinner();
jLabel11 = new javax.swing.JLabel();
paddingBottom = new javax.swing.JSpinner();
derivePadding = new javax.swing.JCheckBox();
deriveHelp3 = new javax.swing.JButton();
paddingHelp = new javax.swing.JButton();
paddingLeftUnit = new javax.swing.JComboBox();
paddingRightUnit = new javax.swing.JComboBox();
paddingTopUnit = new javax.swing.JComboBox();
paddingBottomUnit = new javax.swing.JComboBox();
jPanel6 = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
marginLeft = new javax.swing.JSpinner();
jLabel24 = new javax.swing.JLabel();
marginRight = new javax.swing.JSpinner();
jLabel25 = new javax.swing.JLabel();
marginTop = new javax.swing.JSpinner();
jLabel26 = new javax.swing.JLabel();
marginBottom = new javax.swing.JSpinner();
deriveMargin = new javax.swing.JCheckBox();
deriveHelp4 = new javax.swing.JButton();
marginHelp = new javax.swing.JButton();
marginLeftUnit = new javax.swing.JComboBox();
marginRightUnit = new javax.swing.JComboBox();
marginTopUnit = new javax.swing.JComboBox();
marginBottomUnit = new javax.swing.JComboBox();
jPanel8 = new javax.swing.JPanel();
borderLabel = new com.codename1.ui.resource.util.CodenameOneComponentWrapper(new com.codename1.ui.Label("Border"));
customizeBorder = new javax.swing.JButton();
deriveBorder = new javax.swing.JCheckBox();
imageBorderWizard = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
deriveHelp5 = new javax.swing.JButton();
borderHelp = new javax.swing.JButton();
jPanel10 = new javax.swing.JPanel();
baseStyle = new javax.swing.JComboBox();
baseStyleType = new javax.swing.JComboBox();
defineAttribute = new javax.swing.JCheckBox();
deriveHelp6 = new javax.swing.JButton();
jLabel22 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
bitmapFont = new javax.swing.JRadioButton();
systemFont = new javax.swing.JRadioButton();
bitmapFontValue = new javax.swing.JComboBox();
addNewBitmapFont = new javax.swing.JButton();
fontFace = new javax.swing.JComboBox();
fontStyle = new javax.swing.JComboBox();
fontSize = new javax.swing.JComboBox();
deriveFont = new javax.swing.JCheckBox();
textDecorationCombo = new javax.swing.JComboBox();
deriveTextDecoration = new javax.swing.JCheckBox();
jLabel7 = new javax.swing.JLabel();
deriveHelp7 = new javax.swing.JButton();
fontHelp = new javax.swing.JButton();
jLabel12 = new javax.swing.JLabel();
trueTypeFont = new javax.swing.JComboBox();
jLabel13 = new javax.swing.JLabel();
trueTypeFontSizeOption = new javax.swing.JComboBox();
trueTypeFontSizeValue = new javax.swing.JSpinner();
jScrollPane2 = new javax.swing.JScrollPane();
help = new javax.swing.JTextPane();
styleType = new javax.swing.JLabel();
styleHelp = new javax.swing.JButton();
videoTutorial = new javax.swing.JButton();
FormListener formListener = new FormListener();
// NOI18N
setName("Form");
jLabel1.setText("Component");
// NOI18N
jLabel1.setName("jLabel1");
componentName.setEditable(true);
// NOI18N
componentName.setName("componentName");
componentName.setPrototypeDisplayValue("XXXXXXXXXXXXXX");
componentName.addActionListener(formListener);
// NOI18N
previewPane.setName("previewPane");
previewPane.setLayout(new java.awt.BorderLayout());
jLabel6.setText("Preview");
// NOI18N
jLabel6.setName("jLabel6");
// NOI18N
addTabs.setName("addTabs");
// NOI18N
jPanel3.setName("jPanel3");
jPanel3.setOpaque(false);
jLabel23.setText("Image");
// NOI18N
jLabel23.setName("jLabel23");
imagesCombo.setEnabled(false);
// NOI18N
imagesCombo.setName("imagesCombo");
imagesCombo.addActionListener(formListener);
addNewImage.setText("...");
addNewImage.setEnabled(false);
// NOI18N
addNewImage.setName("addNewImage");
addNewImage.addActionListener(formListener);
jLabel16.setText("Type");
// NOI18N
jLabel16.setName("jLabel16");
backgroundType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "IMAGE_SCALED", "IMAGE_SCALED_FILL", "IMAGE_SCALED_FIT", "IMAGE_TILE_BOTH", "IMAGE_TILE_VERTICAL_ALIGN_LEFT", "IMAGE_TILE_VERTICAL_ALIGN_CENTER", "IMAGE_TILE_VERTICAL_ALIGN_RIGHT", "IMAGE_TILE_HORIZONTAL_ALIGN_TOP", "IMAGE_TILE_HORIZONTAL_ALIGN_CENTER", "IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM", "IMAGE_ALIGNED_TOP", "IMAGE_ALIGNED_BOTTOM", "IMAGE_ALIGNED_LEFT", "IMAGE_ALIGNED_RIGHT", "IMAGE_ALIGNED_TOP_LEFT", "IMAGE_ALIGNED_TOP_RIGHT", "IMAGE_ALIGNED_BOTTOM_LEFT", "IMAGE_ALIGNED_BOTTOM_RIGHT", "IMAGE_ALIGNED_CENTER", "GRADIENT_LINEAR_HORIZONTAL", "GRADIENT_LINEAR_VERTICAL", "GRADIENT_RADIAL", "NONE" }));
backgroundType.setEnabled(false);
// NOI18N
backgroundType.setName("backgroundType");
backgroundType.addActionListener(formListener);
jLabel18.setText("Gradient");
// NOI18N
jLabel18.setName("jLabel18");
gradientStartColor.setText("000000");
gradientStartColor.setEnabled(false);
// NOI18N
gradientStartColor.setName("gradientStartColor");
changeGradientStartColorButton.setText("...");
changeGradientStartColorButton.setEnabled(false);
// NOI18N
changeGradientStartColorButton.setName("changeGradientStartColorButton");
changeGradientStartColorButton.addActionListener(formListener);
gradientEndColor.setText("000000");
gradientEndColor.setEnabled(false);
// NOI18N
gradientEndColor.setName("gradientEndColor");
changeGradientEndColorButton.setText("...");
changeGradientEndColorButton.setEnabled(false);
// NOI18N
changeGradientEndColorButton.setName("changeGradientEndColorButton");
changeGradientEndColorButton.addActionListener(formListener);
jLabel19.setText("Gradient X/Y");
// NOI18N
jLabel19.setName("jLabel19");
gradientX.setToolTipText("Gradient Relative X");
gradientX.setEnabled(false);
// NOI18N
gradientX.setName("gradientX");
gradientX.addChangeListener(formListener);
gradientY.setToolTipText("Gradient Relative Y");
gradientY.setEnabled(false);
// NOI18N
gradientY.setName("gradientY");
gradientY.addChangeListener(formListener);
gradientSize.setToolTipText("Gradient Relaitve Size");
gradientSize.setEnabled(false);
// NOI18N
gradientSize.setName("gradientSize");
gradientSize.addChangeListener(formListener);
deriveBackground.setSelected(true);
deriveBackground.setText("Derive");
// NOI18N
deriveBackground.setName("deriveBackground");
deriveBackground.addActionListener(formListener);
deriveHelp.setText("Derive Help");
// NOI18N
deriveHelp.setName("deriveHelp");
deriveHelp.addActionListener(formListener);
backgroundHelp.setText("Background Help");
// NOI18N
backgroundHelp.setName("backgroundHelp");
backgroundHelp.addActionListener(formListener);
jLabel2.setText("Gradient Size");
// NOI18N
jLabel2.setName("jLabel2");
jLabel14.setText("<html><body><b>Notice:</b> If a border is defined the background will have no effect! Set the border<br>property to Empty to override the border of a base style");
// NOI18N
jLabel14.setName("jLabel14");
org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().addContainerGap().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel16).add(jLabel23).add(jLabel18).add(jLabel19).add(jLabel2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(gradientSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(imagesCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 325, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addNewImage)).add(backgroundType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 325, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(gradientStartColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 54, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeGradientStartColorButton).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(gradientEndColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeGradientEndColorButton)).add(jPanel3Layout.createSequentialGroup().add(gradientX, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(gradientY, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))).add(deriveBackground)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 383, Short.MAX_VALUE).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, backgroundHelp).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp)).addContainerGap()));
jPanel3Layout.linkSize(new java.awt.Component[] { gradientEndColor, gradientSize, gradientStartColor, gradientX, gradientY }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel3Layout.linkSize(new java.awt.Component[] { backgroundType, imagesCombo }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel3Layout.linkSize(new java.awt.Component[] { backgroundHelp, deriveHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().add(4, 4, 4).add(deriveHelp).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(backgroundHelp)).add(jPanel3Layout.createSequentialGroup().add(15, 15, 15).add(jLabel14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(18, 18, 18).add(deriveBackground).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel16).add(backgroundType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel23).add(imagesCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(addNewImage)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel18).add(gradientStartColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeGradientStartColorButton).add(changeGradientEndColorButton).add(gradientEndColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel19).add(gradientX, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(gradientY, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel2).add(gradientSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))).addContainerGap(199, Short.MAX_VALUE)));
addTabs.addTab("Background", jPanel3);
// NOI18N
jPanel1.setName("jPanel1");
jPanel1.setOpaque(false);
colorValueFG.setText("000000");
colorValueFG.setEnabled(false);
// NOI18N
colorValueFG.setName("colorValueFG");
changeColorButtonFG.setText("...");
changeColorButtonFG.setEnabled(false);
// NOI18N
changeColorButtonFG.setName("changeColorButtonFG");
changeColorButtonFG.addActionListener(formListener);
deriveForegroundColor.setSelected(true);
deriveForegroundColor.setText("Derive Foreground");
// NOI18N
deriveForegroundColor.setName("deriveForegroundColor");
deriveForegroundColor.addActionListener(formListener);
jLabel3.setText("Background");
// NOI18N
jLabel3.setName("jLabel3");
colorValueBG.setText("000000");
colorValueBG.setEnabled(false);
// NOI18N
colorValueBG.setName("colorValueBG");
changeColorButtonBG.setText("...");
changeColorButtonBG.setEnabled(false);
// NOI18N
changeColorButtonBG.setName("changeColorButtonBG");
changeColorButtonBG.addActionListener(formListener);
jLabel4.setText("Foreground");
// NOI18N
jLabel4.setName("jLabel4");
deriveBackgroundColor.setSelected(true);
deriveBackgroundColor.setText("Derive Background");
// NOI18N
deriveBackgroundColor.setName("deriveBackgroundColor");
deriveBackgroundColor.addActionListener(formListener);
deriveTransparency.setSelected(true);
deriveTransparency.setText("Derive Transparency");
// NOI18N
deriveTransparency.setName("deriveTransparency");
deriveTransparency.addActionListener(formListener);
jLabel5.setText("Transparency");
// NOI18N
jLabel5.setName("jLabel5");
transparencyValue.setEnabled(false);
// NOI18N
transparencyValue.setName("transparencyValue");
transparencyValue.addChangeListener(formListener);
deriveHelp1.setText("Derive Help");
// NOI18N
deriveHelp1.setName("deriveHelp1");
deriveHelp1.addActionListener(formListener);
colorHelp.setText("Color Help");
// NOI18N
colorHelp.setName("colorHelp");
colorHelp.addActionListener(formListener);
jLabel15.setText("<html><body><b>Notice:</b> If a border is defined the background will have no effect! Set the border<br>property to Empty to override the border of a base style");
// NOI18N
jLabel15.setName("jLabel15");
jLabel21.setText("<html><body><b>Notice:</b> some types of backgrounds might override the background color.<br/>Transparency should be 255 to achieve full opacity");
// NOI18N
jLabel21.setName("jLabel21");
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel4).add(jLabel3).add(jLabel5)).add(12, 12, 12).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().add(colorValueFG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeColorButtonFG)).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false).add(org.jdesktop.layout.GroupLayout.LEADING, transparencyValue).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup().add(colorValueBG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeColorButtonBG)))).add(0, 735, Short.MAX_VALUE)).add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(deriveForegroundColor).add(deriveBackgroundColor).add(deriveTransparency).add(jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 464, Short.MAX_VALUE).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp1).add(org.jdesktop.layout.GroupLayout.TRAILING, colorHelp)))).addContainerGap()));
jPanel1Layout.linkSize(new java.awt.Component[] { colorHelp, deriveHelp1 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(20, 20, 20).add(deriveForegroundColor).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(colorValueFG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeColorButtonFG).add(jLabel4)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(deriveBackgroundColor).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(colorValueBG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeColorButtonBG).add(jLabel3)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(deriveTransparency).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel5).add(transparencyValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).add(jPanel1Layout.createSequentialGroup().add(deriveHelp1).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(colorHelp))).addContainerGap(181, Short.MAX_VALUE)));
addTabs.addTab("Color", jPanel1);
// NOI18N
jPanel2.setName("jPanel2");
jPanel2.setOpaque(false);
jLabel20.setText("Alignment");
// NOI18N
jLabel20.setName("jLabel20");
alignmentCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Left", "Right", "Center" }));
alignmentCombo.setEnabled(false);
// NOI18N
alignmentCombo.setName("alignmentCombo");
alignmentCombo.addActionListener(formListener);
deriveAlignment.setSelected(true);
deriveAlignment.setText("Derive");
// NOI18N
deriveAlignment.setName("deriveAlignment");
deriveAlignment.addActionListener(formListener);
deriveHelp2.setText("Derive Help");
// NOI18N
deriveHelp2.setName("deriveHelp2");
deriveHelp2.addActionListener(formListener);
alignHelp.setText("Alignment Help");
// NOI18N
alignHelp.setName("alignHelp");
alignHelp.addActionListener(formListener);
org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().add(deriveAlignment).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 779, Short.MAX_VALUE).add(deriveHelp2)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup().add(jLabel20).add(9, 9, 9).add(alignmentCombo, 0, 774, Short.MAX_VALUE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(alignHelp))).addContainerGap()));
jPanel2Layout.linkSize(new java.awt.Component[] { alignHelp, deriveHelp2 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveAlignment).add(deriveHelp2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel20).add(alignmentCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(alignHelp)).addContainerGap(394, Short.MAX_VALUE)));
addTabs.addTab("Alignment", jPanel2);
// NOI18N
jPanel5.setName("jPanel5");
jPanel5.setOpaque(false);
jLabel8.setText("Left");
// NOI18N
jLabel8.setName("jLabel8");
paddingLeft.setEnabled(false);
// NOI18N
paddingLeft.setName("paddingLeft");
paddingLeft.addChangeListener(formListener);
jLabel9.setText("Right");
// NOI18N
jLabel9.setName("jLabel9");
paddingRight.setEnabled(false);
// NOI18N
paddingRight.setName("paddingRight");
paddingRight.addChangeListener(formListener);
jLabel10.setText("Top");
// NOI18N
jLabel10.setName("jLabel10");
paddingTop.setEnabled(false);
// NOI18N
paddingTop.setName("paddingTop");
paddingTop.addChangeListener(formListener);
jLabel11.setText("Bottom");
// NOI18N
jLabel11.setName("jLabel11");
paddingBottom.setEnabled(false);
// NOI18N
paddingBottom.setName("paddingBottom");
paddingBottom.addChangeListener(formListener);
derivePadding.setSelected(true);
derivePadding.setText("Derive");
// NOI18N
derivePadding.setName("derivePadding");
derivePadding.addActionListener(formListener);
deriveHelp3.setText("Derive Help");
// NOI18N
deriveHelp3.setName("deriveHelp3");
deriveHelp3.addActionListener(formListener);
paddingHelp.setText("Padding Help");
// NOI18N
paddingHelp.setName("paddingHelp");
paddingHelp.addActionListener(formListener);
paddingLeftUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
paddingLeftUnit.setName("paddingLeftUnit");
paddingLeftUnit.addActionListener(formListener);
paddingRightUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
paddingRightUnit.setName("paddingRightUnit");
paddingRightUnit.addActionListener(formListener);
paddingTopUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
paddingTopUnit.setName("paddingTopUnit");
paddingTopUnit.addActionListener(formListener);
paddingBottomUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
paddingBottomUnit.setName("paddingBottomUnit");
paddingBottomUnit.addActionListener(formListener);
org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5Layout.createSequentialGroup().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(jPanel5Layout.createSequentialGroup().add(10, 10, 10).add(derivePadding)).add(jPanel5Layout.createSequentialGroup().addContainerGap().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel8).add(jLabel9).add(jLabel10).add(jLabel11)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(paddingLeft, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE).add(paddingRight).add(paddingTop).add(paddingBottom)).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(jPanel5Layout.createSequentialGroup().add(7, 7, 7).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).add(jPanel5Layout.createSequentialGroup().addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(paddingLeftUnit, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 553, Short.MAX_VALUE).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingHelp).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp3)).addContainerGap()));
jPanel5Layout.linkSize(new java.awt.Component[] { deriveHelp3, paddingHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5Layout.createSequentialGroup().addContainerGap().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(derivePadding).add(deriveHelp3)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel8).add(paddingLeft, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel9).add(paddingRight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel10).add(paddingTop, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel11).add(paddingBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(288, Short.MAX_VALUE)));
jPanel5Layout.linkSize(new java.awt.Component[] { paddingBottom, paddingLeft, paddingRight, paddingTop }, org.jdesktop.layout.GroupLayout.VERTICAL);
addTabs.addTab("Padding", jPanel5);
// NOI18N
jPanel6.setName("jPanel6");
jPanel6.setOpaque(false);
jLabel17.setText("Left");
// NOI18N
jLabel17.setName("jLabel17");
marginLeft.setEnabled(false);
// NOI18N
marginLeft.setName("marginLeft");
marginLeft.addChangeListener(formListener);
jLabel24.setText("Right");
// NOI18N
jLabel24.setName("jLabel24");
marginRight.setEnabled(false);
// NOI18N
marginRight.setName("marginRight");
marginRight.addChangeListener(formListener);
jLabel25.setText("Top");
// NOI18N
jLabel25.setName("jLabel25");
marginTop.setEnabled(false);
// NOI18N
marginTop.setName("marginTop");
marginTop.addChangeListener(formListener);
jLabel26.setText("Bottom");
// NOI18N
jLabel26.setName("jLabel26");
marginBottom.setEnabled(false);
// NOI18N
marginBottom.setName("marginBottom");
marginBottom.addChangeListener(formListener);
deriveMargin.setSelected(true);
deriveMargin.setText("Derive");
// NOI18N
deriveMargin.setName("deriveMargin");
deriveMargin.addActionListener(formListener);
deriveHelp4.setText("Derive Help");
// NOI18N
deriveHelp4.setName("deriveHelp4");
deriveHelp4.addActionListener(formListener);
marginHelp.setText("Margin Help");
// NOI18N
marginHelp.setName("marginHelp");
marginHelp.addActionListener(formListener);
marginLeftUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
marginLeftUnit.setName("marginLeftUnit");
marginLeftUnit.addActionListener(formListener);
marginRightUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
marginRightUnit.setName("marginRightUnit");
marginRightUnit.addActionListener(formListener);
marginTopUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
marginTopUnit.setName("marginTopUnit");
marginTopUnit.addActionListener(formListener);
marginBottomUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
// NOI18N
marginBottomUnit.setName("marginBottomUnit");
marginBottomUnit.addActionListener(formListener);
org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().addContainerGap().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel17).add(jLabel24).add(jLabel25).add(jLabel26)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(marginBottom).add(marginTop).add(marginRight).add(marginLeft, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(marginBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(454, 660, Short.MAX_VALUE)).add(jPanel6Layout.createSequentialGroup().add(marginLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(marginHelp).addContainerGap()))).add(jPanel6Layout.createSequentialGroup().add(10, 10, 10).add(deriveMargin).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 793, Short.MAX_VALUE).add(deriveHelp4).addContainerGap()));
jPanel6Layout.linkSize(new java.awt.Component[] { deriveHelp4, marginHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel6Layout.linkSize(new java.awt.Component[] { marginBottomUnit, marginLeftUnit, marginRightUnit, marginTopUnit }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().addContainerGap().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveMargin).add(deriveHelp4)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(marginLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginLeft, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel17).add(marginHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel24).add(marginRight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel25).add(marginTop, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel26).add(marginBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(316, Short.MAX_VALUE)));
jPanel6Layout.linkSize(new java.awt.Component[] { marginBottom, marginLeft, marginRight, marginTop }, org.jdesktop.layout.GroupLayout.VERTICAL);
jPanel6Layout.linkSize(new java.awt.Component[] { marginBottomUnit, marginLeftUnit, marginRightUnit, marginTopUnit }, org.jdesktop.layout.GroupLayout.VERTICAL);
addTabs.addTab("Margin", jPanel6);
// NOI18N
jPanel8.setName("jPanel8");
jPanel8.setOpaque(false);
borderLabel.setText("Border");
// NOI18N
borderLabel.setName("borderLabel");
customizeBorder.setText("...");
customizeBorder.setEnabled(false);
// NOI18N
customizeBorder.setName("customizeBorder");
customizeBorder.addActionListener(formListener);
deriveBorder.setSelected(true);
deriveBorder.setText("Derive");
// NOI18N
deriveBorder.setName("deriveBorder");
deriveBorder.addActionListener(formListener);
imageBorderWizard.setText("Image Border Wizard");
// NOI18N
imageBorderWizard.setName("imageBorderWizard");
imageBorderWizard.addActionListener(formListener);
jScrollPane1.setBorder(null);
// NOI18N
jScrollPane1.setName("jScrollPane1");
jScrollPane1.setOpaque(false);
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
jTextArea1.setText("Please notice when using the image border wizard to generate images you are in effect creating additional images in the theme. This means that if you use this wizard you MUST NOT cancel this dialog since the images created by the wizard would remain! You would need to go and delete them (try the \"delete unused images\" option in the menu).\nHaving too many images in the theme can be expensive so try to reuse the same images for multiple component types rather than recreate these images over and over again.");
jTextArea1.setWrapStyleWord(true);
jTextArea1.setBorder(null);
// NOI18N
jTextArea1.setName("jTextArea1");
jTextArea1.setOpaque(false);
jScrollPane1.setViewportView(jTextArea1);
deriveHelp5.setText("Derive Help");
// NOI18N
deriveHelp5.setName("deriveHelp5");
deriveHelp5.addActionListener(formListener);
borderHelp.setText("Border Help");
// NOI18N
borderHelp.setName("borderHelp");
borderHelp.addActionListener(formListener);
org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
jPanel8.setLayout(jPanel8Layout);
jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().addContainerGap().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 939, Short.MAX_VALUE).add(imageBorderWizard).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().add(deriveBorder).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 681, Short.MAX_VALUE)).add(jPanel8Layout.createSequentialGroup().add(borderLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE).add(23, 23, 23))).add(61, 61, 61).add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup().add(customizeBorder).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(borderHelp)).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp5)))).addContainerGap()));
jPanel8Layout.linkSize(new java.awt.Component[] { borderHelp, deriveHelp5 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().addContainerGap().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveBorder).add(deriveHelp5)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(borderLabel).add(customizeBorder).add(borderHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(imageBorderWizard).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE).addContainerGap()));
addTabs.addTab("Border", jPanel8);
// NOI18N
jPanel10.setName("jPanel10");
jPanel10.setOpaque(false);
baseStyle.setEditable(true);
baseStyle.setEnabled(false);
// NOI18N
baseStyle.setName("baseStyle");
baseStyleType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Unselected", "Selected", "Pressed", "Disabled" }));
baseStyleType.setEnabled(false);
// NOI18N
baseStyleType.setName("baseStyleType");
defineAttribute.setSelected(true);
defineAttribute.setText("Override Attribute");
// NOI18N
defineAttribute.setName("defineAttribute");
defineAttribute.addActionListener(formListener);
deriveHelp6.setText("Derive Help");
// NOI18N
deriveHelp6.setName("deriveHelp6");
deriveHelp6.addActionListener(formListener);
jLabel22.setText("Please note that deriving to/from builtin components e.g. Button, TextField etc. is unreliable due to cyclic dependencies");
// NOI18N
jLabel22.setName("jLabel22");
org.jdesktop.layout.GroupLayout jPanel10Layout = new org.jdesktop.layout.GroupLayout(jPanel10);
jPanel10.setLayout(jPanel10Layout);
jPanel10Layout.setHorizontalGroup(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().addContainerGap().add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().add(defineAttribute).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 739, Short.MAX_VALUE).add(deriveHelp6)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel10Layout.createSequentialGroup().add(baseStyle, 0, 843, Short.MAX_VALUE).add(18, 18, 18).add(baseStyleType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(jPanel10Layout.createSequentialGroup().add(jLabel22).add(0, 0, Short.MAX_VALUE))).addContainerGap()));
jPanel10Layout.setVerticalGroup(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().addContainerGap().add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(defineAttribute).add(deriveHelp6)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(baseStyle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(baseStyleType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(jLabel22).addContainerGap(360, Short.MAX_VALUE)));
addTabs.addTab("Derive", jPanel10);
// NOI18N
jPanel7.setName("jPanel7");
jPanel7.setOpaque(false);
buttonGroup1.add(bitmapFont);
bitmapFont.setText("Bitmap Fonts (deprecated!)");
bitmapFont.setEnabled(false);
// NOI18N
bitmapFont.setName("bitmapFont");
bitmapFont.addActionListener(formListener);
buttonGroup1.add(systemFont);
systemFont.setSelected(true);
systemFont.setText("Standard Font");
systemFont.setEnabled(false);
// NOI18N
systemFont.setName("systemFont");
systemFont.addActionListener(formListener);
bitmapFontValue.setEnabled(false);
// NOI18N
bitmapFontValue.setName("bitmapFontValue");
bitmapFontValue.setPrototypeDisplayValue("XXXXXXXXXXXXXXXX");
bitmapFontValue.addActionListener(formListener);
addNewBitmapFont.setText("...");
addNewBitmapFont.setEnabled(false);
// NOI18N
addNewBitmapFont.setName("addNewBitmapFont");
addNewBitmapFont.addActionListener(formListener);
fontFace.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SYSTEM", "MONOSPACE", "PROPORTIONAL" }));
fontFace.setEnabled(false);
// NOI18N
fontFace.setName("fontFace");
fontFace.addActionListener(formListener);
fontStyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD ITALIC" }));
fontStyle.setEnabled(false);
// NOI18N
fontStyle.setName("fontStyle");
fontStyle.addActionListener(formListener);
fontSize.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "MEDIUM", "SMALL", "LARGE" }));
fontSize.setEnabled(false);
// NOI18N
fontSize.setName("fontSize");
fontSize.addActionListener(formListener);
deriveFont.setSelected(true);
deriveFont.setText("Derive Font");
// NOI18N
deriveFont.setName("deriveFont");
deriveFont.addActionListener(formListener);
textDecorationCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Underline", "Strike Through,", "3D Text Raised", "3D Text Lowered", "3D Shadow North" }));
textDecorationCombo.setEnabled(false);
// NOI18N
textDecorationCombo.setName("textDecorationCombo");
textDecorationCombo.addActionListener(formListener);
deriveTextDecoration.setSelected(true);
deriveTextDecoration.setText("Derive Text Decoration");
// NOI18N
deriveTextDecoration.setName("deriveTextDecoration");
deriveTextDecoration.addActionListener(formListener);
jLabel7.setText("Text Decoration");
// NOI18N
jLabel7.setName("jLabel7");
deriveHelp7.setText("Derive Help");
// NOI18N
deriveHelp7.setName("deriveHelp7");
deriveHelp7.addActionListener(formListener);
fontHelp.setText("Font Help");
// NOI18N
fontHelp.setName("fontHelp");
fontHelp.addActionListener(formListener);
jLabel12.setText("True Type");
jLabel12.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
// NOI18N
jLabel12.setName("jLabel12");
trueTypeFont.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
trueTypeFont.setEnabled(false);
// NOI18N
trueTypeFont.setName("trueTypeFont");
trueTypeFont.addActionListener(formListener);
jLabel13.setText("True Type Size");
// NOI18N
jLabel13.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
// NOI18N
jLabel13.setName("jLabel13");
trueTypeFontSizeOption.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small", "Medium", "Large", "Millimeters", "Pixels", "rem", "vw", "vh", "vmin", "vmax" }));
trueTypeFontSizeOption.setSelectedIndex(1);
trueTypeFontSizeOption.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
trueTypeFontSizeOption.setEnabled(false);
// NOI18N
trueTypeFontSizeOption.setName("trueTypeFontSizeOption");
trueTypeFontSizeOption.addActionListener(formListener);
trueTypeFontSizeValue.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
trueTypeFontSizeValue.setEnabled(false);
// NOI18N
trueTypeFontSizeValue.setName("trueTypeFontSizeValue");
trueTypeFontSizeValue.addChangeListener(formListener);
org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
jPanel7.setLayout(jPanel7Layout);
jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(org.jdesktop.layout.GroupLayout.LEADING, deriveFont).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel7Layout.createSequentialGroup().add(systemFont).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(bitmapFont))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(fontHelp).add(deriveHelp7)).addContainerGap()).add(jPanel7Layout.createSequentialGroup().add(deriveTextDecoration).addContainerGap(812, Short.MAX_VALUE)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(jPanel7Layout.createSequentialGroup().add(jLabel7).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(textDecorationCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel13).add(jLabel12).add(fontFace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 157, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(trueTypeFont, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(trueTypeFontSizeOption, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(fontStyle, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(fontSize, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(trueTypeFontSizeValue))).add(org.jdesktop.layout.GroupLayout.LEADING, bitmapFontValue, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addNewBitmapFont).add(387, 387, 387)))));
jPanel7Layout.linkSize(new java.awt.Component[] { bitmapFont, systemFont }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel7Layout.linkSize(new java.awt.Component[] { deriveHelp7, fontHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(jPanel7Layout.createSequentialGroup().add(deriveFont).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(bitmapFont).add(systemFont))).add(jPanel7Layout.createSequentialGroup().add(deriveHelp7).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(fontHelp))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(fontFace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(fontSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(fontStyle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel12).add(trueTypeFont, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(9, 9, 9).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(trueTypeFontSizeValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(trueTypeFontSizeOption, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel13)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(addNewBitmapFont).add(bitmapFontValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(deriveTextDecoration).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel7).add(textDecorationCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(227, Short.MAX_VALUE)));
addTabs.addTab("Font", jPanel7);
// NOI18N
jScrollPane2.setName("jScrollPane2");
// NOI18N
help.setContentType("text/html");
help.setEditable(false);
// NOI18N
help.setName("help");
jScrollPane2.setViewportView(help);
addTabs.addTab("Help", jScrollPane2);
styleType.setText("Unselected");
// NOI18N
styleType.setName("styleType");
styleHelp.setText("Component Help");
// NOI18N
styleHelp.setName("styleHelp");
styleHelp.addActionListener(formListener);
videoTutorial.setText("Video Tutorial");
// NOI18N
videoTutorial.setName("videoTutorial");
videoTutorial.addActionListener(formListener);
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(org.jdesktop.layout.GroupLayout.LEADING, previewPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(org.jdesktop.layout.GroupLayout.LEADING, addTabs).add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup().add(jLabel1).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(componentName, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(18, 18, 18).add(styleType).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(styleHelp).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(videoTutorial)).add(org.jdesktop.layout.GroupLayout.LEADING, jLabel6)).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel1).add(componentName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(styleType).add(styleHelp).add(videoTutorial)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addTabs).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel6).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(previewPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
}
use of com.codename1.rad.models.Attribute in project CodenameOne by codenameone.
the class RADStatusViewSample method start.
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Hi World", BoxLayout.y());
Tag TAG_ONLINE = new Tag("online");
class User extends Entity {
}
entityTypeBuilder(User.class).Boolean(TAG_ONLINE).string(Thing.name).factory(cls -> {
return new User();
}).build();
/**
* A view that displays the status (online/offline) of an entity using
* the TAG_ONLINE tag.
*/
class StatusView extends AbstractEntityView {
// ViewNode. Not used;
ViewNode node;
// Flag to indicate the current state online/offline of the view
private boolean online;
// Label used
private Label label = new Label();
/**
* Creates a new StatusView for user model.
*/
StatusView(User user) {
super(user);
this.node = new ViewNode(new Attribute[] {});
setLayout(new BorderLayout());
$(this).setMargin(0).setPadding(0);
this.add(CENTER, label);
update();
}
@Override
public void update() {
// Check to see if the model is online.
boolean modelOnline = !getEntity().isFalsey(TAG_ONLINE);
if (modelOnline != online) {
// Model state has changed since last update
online = modelOnline;
if (online) {
label.setText("Online");
label.setUIID("OnlineLabel");
FontImage.setMaterialIcon(label, FontImage.MATERIAL_CONNECTED_TV);
} else {
label.setText("Offline");
label.setUIID("OfflineLabel");
FontImage.setMaterialIcon(label, FontImage.MATERIAL_OFFLINE_BOLT);
}
Form f = getComponentForm();
if (f != null) {
// Changing the text in this case may change the layout size
// of the status view here, so it is best to just issue a revalidate
// for the whole form. If the status change didn't change
// the layout size, then we could have just skipped this step.
f.revalidateWithAnimationSafety();
}
}
}
@Override
public void commit() {
// Don't need to implement commit() because this view doesn't
// "update" the model - it only shows model stats.
}
@Override
public Node getViewNode() {
return node;
}
}
// Create a new user
User user = new User();
// Create a status view for the user
StatusView statusView = new StatusView(user);
// Add a UI switch to toggle user state between online and offline
Switch onlineSwitch = new Switch("Online");
onlineSwitch.addChangeListener(e -> {
// Set the user TAG_ONLINE status. This will trigger a property
// change in the model and update the view.
user.set(TAG_ONLINE, onlineSwitch.isOn());
});
hi.add(onlineSwitch);
hi.add(statusView);
hi.show();
}
Aggregations