Java Code Examples for de.vandermeer.asciitable.AsciiTable#setTextAlignment()

The following examples show how to use de.vandermeer.asciitable.AsciiTable#setTextAlignment() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AT_08b_TargetTranslator_HTML.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	String text = "A sentence with some normal text, not specific to HTML. " +
			"Now for some characters that require conversion: # % & < >. " +
			"And some more: © § ¤. " +
			"And even more: Ē ē Ĕ ĕ Ė ė Ę ę Ě ě. " +
			"And some arrows as well: ← ↑ → ↓ ↔ ↕"
	;

	AsciiTable at = new AsciiTable();
	at.addRule();
	at.addRow(text, text).getCells().get(1).getContext().setTargetTranslator(new Text2Html());
	at.addRule();
	at.setTextAlignment(TextAlignment.LEFT);

	System.out.println(at.render());
	// end::example[]
}
 
Example 2
Source File: AT_09b_ConditionalLinebreak.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
	public void showOutput(){
		// tag::example[]
		String text = "line 1<br>" +
			"line 2<br/>" +
			"line three \n still line three"
		;
//		String text = new LoremIpsum().getParagraphs(1) + "\r\n\n<br><br><br>" + new LoremIpsum().getParagraphs(1);

		AsciiTable at = new AsciiTable();
		at.addRule();
		at.addRow(text);
		at.addRule();
		at.setTextAlignment(TextAlignment.LEFT);
		System.out.println(at.render(50));
		// end::example[]
	}
 
Example 3
Source File: AT_04a_Padding_Table.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	AsciiTable at = new AsciiTable();
	at.addRule();
	at.addRow("row 1 col 1", "row 1 col 2");
	at.addRule();
	at.addRow("row 2 col 1", "row 2 col 2");
	at.addRule();

	at.setPaddingTopChar('v');
	at.setPaddingBottomChar('^');
	at.setPaddingLeftChar('>');
	at.setPaddingRightChar('<');
	at.setTextAlignment(TextAlignment.CENTER);
	at.setPadding(1);
	System.out.println(at.render(33));
	// end::example[]
}
 
Example 4
Source File: AT_08a_TargetTranslator_Latex.java    From asciitable with Apache License 2.0 6 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	String text = "A sentence with some normal text, not specific to LaTeX. " +
		"Now for some characters that require conversion: # % &. " +
		"And some more: © § ¤. " +
		"And even more: È É Ê Ë. " +
		"And some arrows as well: ← ↑ → ↓ ↔"
	;

	AsciiTable at = new AsciiTable();
	at.addRule();
	at.addRow(text, text).getCells().get(1).getContext().setTargetTranslator(new Text2Latex());
	at.addRule();
	at.setTextAlignment(TextAlignment.LEFT);

	System.out.println(at.render());
	// end::example[]
}
 
Example 5
Source File: AT_03a_AlignmentTable.java    From asciitable with Apache License 2.0 5 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	AsciiTable at = new AsciiTable();
	String text = new LoremIpsum().getWords(9);
	at.addRule();
	at.addRow(text, text, text);
	at.addRule();
	at.addRow(text, text, text);
	at.addRule();
	at.setTextAlignment(TextAlignment.RIGHT);
	System.out.println(at.render(76));
	// end::example[]
}
 
Example 6
Source File: AT_09c_ListWithLinebreaks.java    From asciitable with Apache License 2.0 5 votes vote down vote up
@Override
public void showOutput(){
	// tag::example[]
	AsciiTable at = new AsciiTable();
	at.addRule();
	at.addRow("column with a list using conditional line breaks", " * list item one<br> * list item two<br> * list item three");
	at.addRule();
	at.setTextAlignment(TextAlignment.LEFT);
	at.getRenderer().setCWC(new CWC_FixedWidth().add(20).add(25));
	System.out.println(at.render(50));
	// end::example[]
}
 
Example 7
Source File: AT_09d_AsciiList.java    From asciitable with Apache License 2.0 4 votes vote down vote up
@Override
	public void showOutput(){
		ItemizeList il = new ItemizeList();
		il.addItem("il 1 item 1 some text");
		il.addItem("il 1 item 2 some text");
		ItemizeList il2 = new ItemizeList();
		il2.addItem("il 2 item 1 text");
		il2.addItem("il 2 item 2 text");
//		il.addItem(il2);
//		il.setPreLabelIndent(0);
//		il.setListStyle(NestedItemizeStyles.ALL_STAR_INCREMENTAL);

		EnumerateList el = new EnumerateList();
		el.addItem("el 1 item 1 some text");
		el.addItem("el 1 item 2 some text");
		EnumerateList el2 = new EnumerateList();
		el2.addItem("el 2 item 1 text");
		el2.addItem("el 2 item 2 text");
//		el.addItem(el2);
//		el.setPreLabelIndent(0);
//		el.setListStyle(NestedEnumerateStyles.all_alpha_ascii);

		Checklist cl = new Checklist();
		cl.addItem("cl 1 item 1 some text", false);
		cl.addItem("cl 1 item 2 some text", true);
//		cl.setPreLabelIndent(0);
//		cl.setListStyle(NestedCheckStyles.ALL_SQUARE_BRACKET_BLANK_X);
System.err.println(il.render(25));
System.err.println(el.render(25));
System.err.println(cl.render(27));
		AsciiTable at = new AsciiTable();
		at.addRule();
		at.addRow(il, el, cl).setPaddingLeftRight(1);
		at.addRule();
		at.addRow(il, el, cl).setPaddingLeftRight(3);
		at.addRule();
		at.setTextAlignment(TextAlignment.LEFT);
		at.getRenderer().setCWC(new CWC_FixedWidth().add(25).add(25).add(27));
//		System.out.println(at.render());
		// end::example[]
	}