if (composite.getBackground() != null) { buffer.append(COLOR_MAP.get(composite.getBackground()));
public Style.Composite leaveStyle() { if (stack == null || stack.isEmpty()) { throw new IllegalStateException("Cannot leave non existing style"); } Style.Composite last = stack.removeLast(); if (stack.size() > 0) { // Compute merged Style.Composite merged = getMerged(); // Compute diff with removed Boolean bold = foo(last.getBold(), merged.getBold()); Boolean underline = foo(last.getUnderline(), merged.getUnderline()); Boolean blink = foo(last.getBlink(), merged.getBlink()); // For now we assume that black is the default background color // and white is the default foreground color Color fg = foo(last.getForeground(), merged.getForeground(), Color.def); Color bg = foo(last.getBackground(), merged.getBackground(), Color.def); // Style.Composite bilto = Style.style(bold, underline, blink, fg, bg); // append(bilto); } else { append(Style.reset); } return last; }
public Style merge(Style s) throws NullPointerException { if (s == null) { throw new NullPointerException(); } if (s == reset) { return reset; } else { Style.Composite that = (Composite)s; Boolean bold = Utils.notNull(that.getBold(), getBold()); Boolean underline = Utils.notNull(that.getUnderline(), getUnderline()); Boolean blink = Utils.notNull(that.getBlink(), getBlink()); Color foreground = Utils.notNull(that.getForeground(), getForeground()); Color background = Utils.notNull(that.getBackground(), getBackground()); return style(bold, underline, blink, foreground, background); } }
if (composite.getBackground() != null) { buffer.append(COLOR_MAP.get(composite.getBackground()));
public void write(Style style) throws IOException { if (style == Style.reset) { termIO.resetAttributes(); termIO.write(""); } else { // if (style instanceof Style.Composite) { Style.Composite composite = (Style.Composite)style; if (composite.getBold() != null) { termIO.setBold(composite.getBold()); } if (composite.getUnderline() != null) { termIO.setUnderlined(composite.getUnderline()); } if (composite.getBlink() != null) { termIO.setBlink(composite.getBlink()); } Color fg = composite.getForeground(); if (fg != null) { termIO.setForegroundColor(30 + fg.code); } Color bg = composite.getBackground(); if (bg != null) { termIO.setBackgroundColor(30 + bg.code); } } else { termIO.resetAttributes(); } } }
public void write(Style style) throws IOException { if (style == Style.reset) { termIO.resetAttributes(); termIO.write(""); } else { // if (style instanceof Style.Composite) { Style.Composite composite = (Style.Composite)style; if (composite.getBold() != null) { termIO.setBold(composite.getBold()); } if (composite.getUnderline() != null) { termIO.setUnderlined(composite.getUnderline()); } if (composite.getBlink() != null) { termIO.setBlink(composite.getBlink()); } Color fg = composite.getForeground(); if (fg != null) { termIO.setForegroundColor(30 + fg.code); } Color bg = composite.getBackground(); if (bg != null) { termIO.setBackgroundColor(30 + bg.code); } } else { termIO.resetAttributes(); } } }
public Style.Composite leaveStyle() { if (stack == null || stack.isEmpty()) { throw new IllegalStateException("Cannot leave non existing style"); } Style.Composite last = stack.removeLast(); if (stack.size() > 0) { // Compute merged Style.Composite merged = getMerged(); // Compute diff with removed Boolean bold = foo(last.getBold(), merged.getBold()); Boolean underline = foo(last.getUnderline(), merged.getUnderline()); Boolean blink = foo(last.getBlink(), merged.getBlink()); // For now we assume that black is the default background color // and white is the default foreground color Color fg = foo(last.getForeground(), merged.getForeground(), Color.def); Color bg = foo(last.getBackground(), merged.getBackground(), Color.def); // Style.Composite bilto = Style.style(bold, underline, blink, fg, bg); // safeAppend(bilto); } else { safeAppend(Style.reset); } return last; }
public Style.Composite leaveStyle() { if (stack == null || stack.isEmpty()) { throw new IllegalStateException("Cannot leave non existing style"); } Style.Composite last = stack.removeLast(); if (stack.size() > 0) { // Compute merged Style.Composite merged = getMerged(); // Compute diff with removed Boolean bold = foo(last.getBold(), merged.getBold()); Boolean underline = foo(last.getUnderline(), merged.getUnderline()); Boolean blink = foo(last.getBlink(), merged.getBlink()); // For now we assume that black is the default background color // and white is the default foreground color Color fg = foo(last.getForeground(), merged.getForeground(), Color.def); Color bg = foo(last.getBackground(), merged.getBackground(), Color.def); // Style.Composite bilto = Style.style(bold, underline, blink, fg, bg); // append(bilto); } else { append(Style.reset); } return last; }
public Style.Composite leaveStyle() { if (stack == null || stack.isEmpty()) { throw new IllegalStateException("Cannot leave non existing style"); } Style.Composite last = stack.removeLast(); if (stack.size() > 0) { // Compute merged Style.Composite merged = getMerged(); // Compute diff with removed Boolean bold = foo(last.getBold(), merged.getBold()); Boolean underline = foo(last.getUnderline(), merged.getUnderline()); Boolean blink = foo(last.getBlink(), merged.getBlink()); // For now we assume that black is the default background color // and white is the default foreground color Color fg = foo(last.getForeground(), merged.getForeground(), Color.def); Color bg = foo(last.getBackground(), merged.getBackground(), Color.def); // Style.Composite bilto = Style.style(bold, underline, blink, fg, bg); // append(bilto); } else { append(Style.reset); } return last; }
public Style merge(Style s) throws NullPointerException { if (s == null) { throw new NullPointerException(); } if (s == reset) { return reset; } else { Style.Composite that = (Composite)s; Boolean bold = Utils.notNull(that.getBold(), getBold()); Boolean underline = Utils.notNull(that.getUnderline(), getUnderline()); Boolean blink = Utils.notNull(that.getBlink(), getBlink()); Color foreground = Utils.notNull(that.getForeground(), getForeground()); Color background = Utils.notNull(that.getBackground(), getBackground()); return style(bold, underline, blink, foreground, background); } }
public Style merge(Style s) throws NullPointerException { if (s == null) { throw new NullPointerException(); } if (s == reset) { return reset; } else { Style.Composite that = (Composite)s; Boolean bold = Utils.notNull(that.getBold(), getBold()); Boolean underline = Utils.notNull(that.getUnderline(), getUnderline()); Boolean blink = Utils.notNull(that.getBlink(), getBlink()); Color foreground = Utils.notNull(that.getForeground(), getForeground()); Color background = Utils.notNull(that.getBackground(), getBackground()); return style(bold, underline, blink, foreground, background); } }
public Style merge(Style s) throws NullPointerException { if (s == null) { throw new NullPointerException(); } if (s == reset) { return reset; } else { Style.Composite that = (Composite)s; Boolean bold = Utils.notNull(that.getBold(), getBold()); Boolean underline = Utils.notNull(that.getUnderline(), getUnderline()); Boolean blink = Utils.notNull(that.getBlink(), getBlink()); Color foreground = Utils.notNull(that.getForeground(), getForeground()); Color background = Utils.notNull(that.getBackground(), getBackground()); return style(bold, underline, blink, foreground, background); } }
public void write(Style style) throws IOException { if (style == Style.reset) { termIO.resetAttributes(); termIO.write(""); } else { // if (style instanceof Style.Composite) { Style.Composite composite = (Style.Composite)style; if (composite.getBold() != null) { termIO.setBold(composite.getBold()); } if (composite.getUnderline() != null) { termIO.setUnderlined(composite.getUnderline()); } if (composite.getBlink() != null) { termIO.setBlink(composite.getBlink()); } Color fg = composite.getForeground(); if (fg != null) { termIO.setForegroundColor(30 + fg.code); } Color bg = composite.getBackground(); if (bg != null) { termIO.setBackgroundColor(30 + bg.code); } } else { termIO.resetAttributes(); } } }