final int dialogButtonBasePosition = width / 4;
final float colorSliderBasePosition = (float) (width / 1.60);
final float comboboxBasePosition = (float) (width / 1.75);
/***********************************************************************
* Border *
***********************************************************************/
final SVGElement border = (SVGElement) getElementById("border");
border.setFloatTrait("width", width - 20);
border.setFloatTrait("x", 10);
/***********************************************************************
* Tab rect (section that contains the tab name) *
***********************************************************************/
// Get tab rect elements
final SVGElement buttonTabRect =
(SVGElement) getElementById("buttontabrect");
final SVGElement sliderTabRect =
(SVGElement) getElementById("slidertabrect");
final SVGElement listTabRect =
(SVGElement) getElementById("listtabrect");
final SVGElement textTabRect =
(SVGElement) getElementById("texttabrect");
// Set tab rect width
buttonTabRect.setFloatTrait("width", tabWidth);
sliderTabRect.setFloatTrait("width", tabWidth);
listTabRect.setFloatTrait("width", tabWidth);
textTabRect.setFloatTrait("width", tabWidth);
// Set tab rect x position
buttonTabRect.setFloatTrait("x", 20);
sliderTabRect.setFloatTrait("x", tabWidth + 25);
listTabRect.setFloatTrait("x", tabWidth * 2 + 30);
textTabRect.setFloatTrait("x", tabWidth * 3 + 35);
/***********************************************************************
* Tab name text *
***********************************************************************/
// Get tab name text elements
final SVGElement buttonTabNameText =
(SVGElement) getElementById("buttontabnametext");
final SVGElement sliderTabNameText =
(SVGElement) getElementById("slidertabnametext");
final SVGElement listTabNameText =
(SVGElement) getElementById("listtabnametext");
final SVGElement textTabNameText =
(SVGElement) getElementById("texttabnametext");
// Set tab name text x position
buttonTabNameText.setFloatTrait("x", 22);
sliderTabNameText.setFloatTrait("x", tabWidth + 27);
listTabNameText.setFloatTrait("x", tabWidth * 2 + 32);
textTabNameText.setFloatTrait("x", tabWidth * 3 + 37);
/***********************************************************************
* Tab enabled (erased border underneath selected tab) *
***********************************************************************/
// Get tab enabled elements
final SVGElement buttonTabEnabled =
(SVGElement) getElementById("buttontabenabled");
final SVGElement sliderTabEnabled =
(SVGElement) getElementById("slidertabenabled");
final SVGElement listTabEnabled =
(SVGElement) getElementById("listtabenabled");
final SVGElement textTabEnabled =
(SVGElement) getElementById("texttabenabled");
// Set tab enabled widths
buttonTabEnabled.setFloatTrait("width", tabWidth);
sliderTabEnabled.setFloatTrait("width", tabWidth);
listTabEnabled.setFloatTrait("width", tabWidth);
textTabEnabled.setFloatTrait("width", tabWidth);
// Set tab enabled x positions
buttonTabEnabled.setFloatTrait("x", 20);
sliderTabEnabled.setFloatTrait("x", tabWidth + 25);
listTabEnabled.setFloatTrait("x", tabWidth * 2 + 30);
textTabEnabled.setFloatTrait("x", tabWidth * 3 + 35);
/***********************************************************************
* Buttons tab *
***********************************************************************/
// Get button 1 elements
final SVGElement button1Rect =
(SVGElement) getElementById("button1rect");
final SVGElement button1Text =
(SVGElement) getElementById("button1text");
// Set button 1 positions
button1Rect.setFloatTrait("x", width / 2 - 50);
button1Text.setFloatTrait("x", width / 2 - 33);
/***********************************************************************
* Sliders tab *
***********************************************************************/
// Get slider 1 elements
final SVGElement slider1Bar = (SVGElement) getElementById("slider1bar");
final SVGElement slider1Control =
(SVGElement) getElementById("slider1control");
final SVGElement progressBarRect =
(SVGElement) getElementById("progressbarrect");
final SVGElement progressBarStatusValue =
(SVGElement) getElementById("progressbarstatusvalue");
final SVGElement progressBarStatusPercent =
(SVGElement) getElementById("progressbarstatuspercent");
final SVGElement progressBarLine =
(SVGElement) getElementById("progressbarline");
final SVGElement progressBarText =
(SVGElement) getElementById("progressbartext");
// Get current value of progress bar
final String percentStr = progressBarStatusValue.getTrait("#text");
final Integer percentInteger = Integer.valueOf(percentStr);
final int percent = percentInteger.intValue();
// Set position of slider 1 bar and control
slider1Control.setFloatTrait("cx", slider1BasePosition + percent);
slider1Bar.setFloatTrait("x1", slider1BasePosition);
slider1Bar.setFloatTrait("x2", slider1BasePosition + 100);
// Set position of slider 1 progress bar elements
progressBarLine.setFloatTrait("x1", slider1BasePosition);
progressBarLine.setFloatTrait("x2", slider1BasePosition + percent);
progressBarRect.setFloatTrait("x", slider1BasePosition);
progressBarText.setFloatTrait("x", slider1BasePosition);
progressBarStatusValue.setFloatTrait("x", slider1BasePosition + 105);
progressBarStatusPercent.setFloatTrait("x", slider1BasePosition + 120);
// Get color slider elements
final SVGElement slider2Bar = (SVGElement) getElementById("slider2bar");
final SVGElement slider2Control =
(SVGElement) getElementById("slider2control");
final SVGElement slider2Text =
(SVGElement) getElementById("slider2text");
final SVGElement slider3Bar = (SVGElement) getElementById("slider3bar");
final SVGElement slider3Control =
(SVGElement) getElementById("slider3control");
final SVGElement slider3Text =
(SVGElement) getElementById("slider3text");
final SVGElement slider4Bar = (SVGElement) getElementById("slider4bar");
final SVGElement slider4Control =
(SVGElement) getElementById("slider4control");
final SVGElement slider4Text =
(SVGElement) getElementById("slider4text");
// Calculate relative position of slider 2
final String slider2PositionString = slider2Control.getTrait("cx");
final Float slider2PositionFloat = Float.valueOf(slider2PositionString);
final float slider2Position = slider2PositionFloat.floatValue();
final String slider2BarX1PostionStr = slider2Bar.getTrait("x1");
final Float slider2BarX1PositionFloat =
Float.valueOf(slider2BarX1PostionStr);
final float slider2BarX1Position =
slider2BarX1PositionFloat.floatValue();
final float slider2RelativePosition =
slider2Position - slider2BarX1Position;
// Calculate relative position of slider 3
final String slider3PositionString = slider3Control.getTrait("cx");
final Float slider3PositionFloat = Float.valueOf(slider3PositionString);
final float slider3Position = slider3PositionFloat.floatValue();
final String slider3BarX1PostionStr = slider3Bar.getTrait("x1");
final Float slider3BarX1PositionFloat =
Float.valueOf(slider3BarX1PostionStr);
final float slider3BarX1Position =
slider3BarX1PositionFloat.floatValue();
final float slider3RelativePosition =
slider3Position - slider3BarX1Position;
// Calculate relative position of slider 4
final String slider4PositionString = slider4Control.getTrait("cx");
final Float slider4PositionFloat = Float.valueOf(slider4PositionString);
final float slider4Position = slider4PositionFloat.floatValue();
final String slider4BarX1PostionStr = slider4Bar.getTrait("x1");
final Float slider4BarX1PositionFloat =
Float.valueOf(slider4BarX1PostionStr);
final float slider4BarX1Position =
slider4BarX1PositionFloat.floatValue();
final float slider4RelativePosition =
slider4Position - slider4BarX1Position;
// Set position of color slider controls
slider2Control.setFloatTrait("cx", colorSliderBasePosition
+ slider2RelativePosition);
slider3Control.setFloatTrait("cx", colorSliderBasePosition
+ slider3RelativePosition);
slider4Control.setFloatTrait("cx", colorSliderBasePosition
+ slider4RelativePosition);
// Set position of color slider bars
slider2Bar.setFloatTrait("x1", colorSliderBasePosition);
slider2Bar.setFloatTrait("x2", colorSliderBasePosition + 60);
slider3Bar.setFloatTrait("x1", colorSliderBasePosition);
slider3Bar.setFloatTrait("x2", colorSliderBasePosition + 60);
slider4Bar.setFloatTrait("x1", colorSliderBasePosition);
slider4Bar.setFloatTrait("x2", colorSliderBasePosition + 60);
// Set position of color slider text
slider2Text.setFloatTrait("x", colorSliderBasePosition - 45);
slider3Text.setFloatTrait("x", colorSliderBasePosition - 45);
slider4Text.setFloatTrait("x", colorSliderBasePosition - 45);
// Set position of colorbox
final SVGElement colorBox = (SVGElement) getElementById("colorbox");
colorBox.setFloatTrait("x", colorSliderBasePosition);
/***********************************************************************
* Lists tab *
***********************************************************************/
// List rect
final SVGElement listRect = (SVGElement) getElementById("listrect");
listRect.setFloatTrait("x", width / 14);
// Get list item rect elements
final SVGElement listItem1Rect =
(SVGElement) getElementById("listitem1rect");
final SVGElement listItem2Rect =
(SVGElement) getElementById("listitem2rect");
final SVGElement listItem3Rect =
(SVGElement) getElementById("listitem3rect");
final SVGElement listItem4Rect =
(SVGElement) getElementById("listitem4rect");
final SVGElement listItem5Rect =
(SVGElement) getElementById("listitem5rect");
// Set list item rect positions
listItem1Rect.setFloatTrait("x", listBasePosition);
listItem2Rect.setFloatTrait("x", listBasePosition);
listItem3Rect.setFloatTrait("x", listBasePosition);
listItem4Rect.setFloatTrait("x", listBasePosition);
listItem5Rect.setFloatTrait("x", listBasePosition);
// Get list item text elements
final SVGElement listItem1Text =
(SVGElement) getElementById("listitem1text");
final SVGElement listItem2Text =
(SVGElement) getElementById("listitem2text");
final SVGElement listItem3Text =
(SVGElement) getElementById("listitem3text");
final SVGElement listItem4Text =
(SVGElement) getElementById("listitem4text");
final SVGElement listItem5Text =
(SVGElement) getElementById("listitem5text");
// Set list item text positions
listItem1Text.setFloatTrait("x", listBasePosition);
listItem2Text.setFloatTrait("x", listBasePosition);
listItem3Text.setFloatTrait("x", listBasePosition);
listItem4Text.setFloatTrait("x", listBasePosition);
listItem5Text.setFloatTrait("x", listBasePosition);
// Get combo box rect and text elements
final SVGElement comboBoxRect =
(SVGElement) getElementById("comboboxrect");
final SVGElement comboBoxRect1 =
(SVGElement) getElementById("comboboxrect1");
final SVGElement comboBoxRect2 =
(SVGElement) getElementById("comboboxrect2");
final SVGElement comboBoxRect3 =
(SVGElement) getElementById("comboboxrect3");
final SVGElement comboBoxItemText1 =
(SVGElement) getElementById("comboboxitemtext1");
final SVGElement comboBoxItemText2 =
(SVGElement) getElementById("comboboxitemtext2");
final SVGElement comboBoxItemText3 =
(SVGElement) getElementById("comboboxitemtext3");
final SVGElement currentComboBoxRect =
(SVGElement) getElementById("currentcomboboxrect");
final SVGElement currentComboBoxText =
(SVGElement) getElementById("currentcomboboxitemtext");
final SVGElement button2Rect =
(SVGElement) getElementById("button2rect");
final SVGElement button2Text =
(SVGElement) getElementById("button2text");
// Set combo box rect and text positions
comboBoxRect.setFloatTrait("x", comboboxBasePosition);
comboBoxRect1.setFloatTrait("x", comboboxBasePosition);
comboBoxRect2.setFloatTrait("x", comboboxBasePosition);
comboBoxRect3.setFloatTrait("x", comboboxBasePosition);
comboBoxItemText1.setFloatTrait("x", comboboxBasePosition + 50);
comboBoxItemText2.setFloatTrait("x", comboboxBasePosition + 50);
comboBoxItemText3.setFloatTrait("x", comboboxBasePosition + 50);
currentComboBoxRect.setFloatTrait("x", comboboxBasePosition);
currentComboBoxText.setFloatTrait("x", comboboxBasePosition + 50);
button2Rect.setFloatTrait("x", width / 2 - 50);
button2Text.setFloatTrait("x", width / 2 - 33);
// Get combo box arrow elements
final SVGElement comboBoxArrowRect =
(SVGElement) getElementById("comboboxarrowrect");
final SVGElement comboBoxArrowUp =
(SVGElement) getElementById("comboboxarrowup");
final SVGElement comboBoxArrowDown =
(SVGElement) getElementById("comboboxarrowdown");
// Create points string for up and down arrows
final float point1x = comboboxBasePosition + 105;
final float point2x = comboboxBasePosition + 110;
final float point3x = comboboxBasePosition + 115;
final String point1xString = Float.toString(point1x);
final String point2xString = Float.toString(point2x);
final String point3xString = Float.toString(point3x);
final String upArrowPointsString =
point1xString + ", 82, " + point2xString + ",77, "
+ point3xString + ",82";
final String downArrowPointsString =
point1xString + ", 77, " + point2xString + ",82, "
+ point3xString + ",77";
// Set combo box arrow positions
comboBoxArrowRect.setFloatTrait("x", comboboxBasePosition + 100);
comboBoxArrowUp.setTrait("points", upArrowPointsString);
comboBoxArrowDown.setTrait("points", downArrowPointsString);
// Get dialog box elements
final SVGElement dialogBoxRect =
(SVGElement) getElementById("dialogboxrect");
final SVGElement dialogBoxText1 =
(SVGElement) getElementById("dialogboxtext1");
final SVGElement dialogBoxText2 =
(SVGElement) getElementById("dialogboxtext2");
final SVGElement dialogBoxButtonRect =
(SVGElement) getElementById("dialogboxbuttonrect");
final SVGElement dialogBoxButtonText =
(SVGElement) getElementById("dialogboxbuttontext");
// Set dialog box positions
dialogBoxRect.setFloatTrait("x", dialogBasePosition);
dialogBoxText1.setFloatTrait("x", dialogBasePosition + 40);
dialogBoxText2.setFloatTrait("x", dialogBasePosition + 40);
dialogBoxButtonRect.setFloatTrait("x", dialogButtonBasePosition);
dialogBoxButtonText.setFloatTrait("x", dialogButtonBasePosition + 5);
/***********************************************************************
* Text tab *
***********************************************************************/
// Get text box elements
final SVGElement textBoxLabelText =
(SVGElement) getElementById("textboxlabeltext");
final SVGElement textBoxRect =
(SVGElement) getElementById("textboxrect");
final SVGElement textBoxText =
(SVGElement) getElementById("textboxtext");
final SVGElement textBoxCursor =
(SVGElement) getElementById("textboxcursor");
// Calculate position of cursor relative to text field
final String textBoxRectPositionString = textBoxRect.getTrait("x");
final Float textBoxRectPositionFloat =
Float.valueOf(textBoxRectPositionString);
final float textBoxRectPosition = textBoxRectPositionFloat.floatValue();
final String textBoxCursorPostionStr = textBoxCursor.getTrait("x");
final Float textBoxCursorPositionFloat =
Float.valueOf(textBoxCursorPostionStr);
final float textBoxCursorPosition =
textBoxCursorPositionFloat.floatValue();
final float textBoxCursorRelativePosition =
textBoxCursorPosition - textBoxRectPosition;
// Set text box positions
textBoxCursor.setFloatTrait("x", textboxBasePosition - 90
+ textBoxCursorRelativePosition);
textBoxLabelText.setFloatTrait("x", textboxBasePosition - 90);
textBoxRect.setFloatTrait("x", textboxBasePosition - 90);
textBoxText.setFloatTrait("x", textboxBasePosition - 85);