public void setHomeworld() { TextHelper th = new TextHelper(); String homeworldPrompt = "Select a homeworld:\n1. Feral World | 2. Forge World | 3. Highborn | 4. Hive World | 5. Shrine World | 6. Voidborn"; int selection = th.getIntegerInRange(homeworldPrompt, 1, 6); switch (selection) { case 1: world = World.FERAL_WORLD; break; case 2: world = World.FORGE_WORLD; break; case 3: world = World.HIGHBORN; break; case 4: world = World.HIVE_WORLD; break; case 5: world = World.SHRINE_WORLD; break; case 6: world = World.VOIDBORN; break; default: world = World.FERAL_WORLD; break; } setHomeworldValues(); }
public void print() { TextHelper th = new TextHelper(); th.printImperialAquila(); StringBuilder s = new StringBuilder(); s.append("Homeworld: " + this.getName() + "\n"); s.append("Fate Threshold: " + this.getFate() + "\n"); s.append("Homeworld Bonus: " + this.getHomeworldBonus() + "\n"); s.append("Signature Mental Trauma: " + this.getTrauma() + "\n"); s.append("Recommended Backgrounds: " + this.printRecBackgrounds() + "\n"); s.append("Characteristics:\n" + this.printCharacteristics() + "\n"); }
public void initiate(Graphics graphics) { if (data == null || graphics == null) { throw new IllegalArgumentException(); } getRegion().setMinX(getX()); getRegion().setMinY(getY()); getRegion().setWidth(getWidth()); getRegion().setHeight(getHeight()); com.geargames.common.Render render = Render.getInstance(); byte oldFontId = 0; if (font == null) { fontMetric = CustomFontMetric.getInstance(); oldFontId = render.getFont(); render.setFont(customFontId); } else { fontMetric = AwtFontMetric.getInstance(); } indexes = TextHelper.indexData(data, getRegion(), graphics, fontMetric, format); strings = new Vector(indexes.length / 2 + 1); if (!isEllipsis()) { motionListener = ScrollHelper.createVerticalMotionListener( vericalMotionListener, stubMotionListener, getRegion(), indexes.length / 2, rawHeight, format); } else { motionListener = ScrollHelper.createStubMotionListener( stubMotionListener, getRegion(), indexes.length / 2, rawHeight, format); } setStrictlyClipped(isEllipsis()); if (font == null) { render.setFont(oldFontId); } else graphics.setFont(font, false); String string; for (int i = 0; i < getItemsAmount(); i++) { if (!isEllipsis() || i + 1 != getRegion().getHeight() / getRawHeight()) { if (i != getItemsAmount() - 1) { string = data.substring(indexes[i * 2], indexes[(i + 1) * 2]).concat(NEW_STRING); } else { string = data.substring(indexes[i * 2], indexes[(i + 1) * 2]); } } else { if (i != getItemsAmount() - 1) { string = data.substring(indexes[i * 2], indexes[(i + 1) * 2] - 3).concat("..."); } else { string = data.substring(indexes[i * 2], indexes[(i + 1) * 2]).concat(NEW_STRING); } } strings.addElement(string); } setInitiated(true); }
public static String imsi() { String imsi = null; try { imsi = ((TelephonyManager) ContextManager.systemService(Context.TELEPHONY_SERVICE)) // .getSubscriberId(); } catch (Exception e) { } return TextHelper.ensureNotNull(imsi); }
public static String wifiMac() { String mac = null; try { mac = ((WifiManager) ContextManager.systemService(Context.WIFI_SERVICE)) // .getConnectionInfo() .getMacAddress(); } catch (Exception e) { } return TextHelper.ensureNotNull(mac); }
/** * This implementation processes paragraph attributes that are relevant to the <p> tag, as * well as delegates to the parent class to process text leaft attributes that are also relevant * to the <p> tag. * * <p>Paragraph attributes include: * * <ul> * <li><b>textAlign</b> (String): [left, center, right, justify] The alignment of the text * relative to the text box edges. Default is left. * <li><b>textAlignLast</b> (String): [left, center, right, justify]: The alignment of the last * line of the paragraph, applies if textAlign is justify. Default is left. * <li><b>textIndent</b> (Number): The indentation of the first line of text in a paragraph. The * indent is relative to the left margin. Measured in pixels. Default is 0. Can be negative. * <li><b>marginLeft</b> (Number): The indentation applied to the left edge. Measured in pixels. * Default is 0. * <li><b>marginRight</b> (Number): The indentation applied to the right edge. Measured in * pixels. Default is 0. * <li><b>marginTop</b> (Number): This is the "space before" the paragraph. Default is 0. * Minimum is 0. * <li><b>marginBottom</b> (Number): This is the "spaceAfter" the paragraph. Default is 0. * Minimum is 0. * <li><b>direction</b> (String): [ltr, rtl] Controls the dominant writing direction for the * paragraphs (left-to-right or right-to-left), Default is ltr. * <li><b>blockProgression</b> (String): [tb, rl] Controls the direction in which lines are * stacked. * </ul> * * @param name the attribute name * @param value the attribute value * @see AbstractTextNode#setAttribute(String, String) */ @Override public void setAttribute(String name, String value) { if (FXG_TEXTALIGN_ATTRIBUTE.equals(name)) { textAlign = TextHelper.getTextAlign(this, value); } else if (FXG_TEXTALIGNLAST_ATTRIBUTE.equals(name)) { textAlignLast = TextHelper.getTextAlign(this, value); } else if (FXG_TEXTINDENT_ATTRIBUTE.equals(name)) { textIndent = DOMParserHelper.parseDouble( this, value, name, TEXTINDENT_MIN_INCLUSIVE, TEXTINDENT_MAX_INCLUSIVE, textIndent); } else if (FXG_PARAGRAPHSTARTINDENT_ATTRIBUTE.equals(name)) { paragraphStartIndent = DOMParserHelper.parseDouble( this, value, name, PARAGRAPH_INDENT_MIN_INCLUSIVE, PARAGRAPH_INDENT_MAX_INCLUSIVE, paragraphStartIndent); } else if (FXG_PARAGRAPHENDINDENT_ATTRIBUTE.equals(name)) { paragraphEndIndent = DOMParserHelper.parseDouble( this, value, name, PARAGRAPH_INDENT_MIN_INCLUSIVE, PARAGRAPH_INDENT_MAX_INCLUSIVE, paragraphEndIndent); } else if (FXG_PARAGRAPHSPACEBEFORE_ATTRIBUTE.equals(name)) { paragraphSpaceBefore = DOMParserHelper.parseDouble( this, value, name, PARAGRAPH_SPACE_MIN_INCLUSIVE, PARAGRAPH_SPACE_MAX_INCLUSIVE, paragraphSpaceBefore); } else if (FXG_PARAGRAPHSPACEAFTER_ATTRIBUTE.equals(name)) { paragraphSpaceAfter = DOMParserHelper.parseDouble( this, value, name, PARAGRAPH_SPACE_MIN_INCLUSIVE, PARAGRAPH_SPACE_MAX_INCLUSIVE, paragraphSpaceAfter); } else if (FXG_DIRECTION_ATTRIBUTE.equals(name)) { direction = TextHelper.getDirection(this, value); } else if (FXG_JUSTIFICATIONRULE_ATTRIBUTE.equals(name)) { justificationRule = TextHelper.getJustificationRule(this, value); } else if (FXG_JUSTIFICATIONSTYLE_ATTRIBUTE.equals(name)) { justificationStyle = TextHelper.getJustificationStyle(this, value); } else if (FXG_TEXTJUSTIFY_ATTRIBUTE.equals(name)) { textJustify = TextHelper.getTextJustify(this, value); } else if (FXG_LEADINGMODEL_ATTRIBUTE.equals(name)) { leadingModel = TextHelper.getLeadingModel(this, value); } else if (FXG_TABSTOPS_ATTRIBUTE.equals(name)) { tabStops = value; } else { super.setAttribute(name, value); return; } // Remember attribute was set on this node. rememberAttribute(name, value); }