br.com.objectos.way.io.xls.Styles Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of way-io Show documentation
Show all versions of way-io Show documentation
CSV, XLS and fixed parsers
The newest version!
/*
* Copyright 2014 Objectos, Fábrica de Software LTDA.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package br.com.objectos.way.io.xls;
import static com.google.common.collect.Lists.newArrayList;
import java.util.List;
/**
* @author [email protected] (Marcio Endo)
*/
public class Styles {
private Styles() {
}
public static Builder centered() {
return builder().centered();
}
public static Builder leftAligned() {
return builder().leftAligned();
}
public static Builder rightAligned() {
return builder().rightAligned();
}
public static Builder bold() {
return builder().bold();
}
public static Builder normalWeight() {
return builder().normalWeight();
}
public static Builder italic() {
return builder().italic();
}
public static Builder strike() {
return builder().strike();
}
public static Builder underline() {
return builder().underline();
}
private static Builder builder() {
return new Builder();
}
public static class Builder {
private final List list = newArrayList();
private Builder() {
}
public Builder centered() {
return add(Alignment.CENTER);
}
public Builder leftAligned() {
return add(Alignment.LEFT);
}
public Builder rightAligned() {
return add(Alignment.RIGHT);
}
public Builder bold() {
return add(FontWeight.BOLD);
}
public Builder normalWeight() {
return add(FontWeight.NORMAL);
}
public Builder italic() {
return add(FontStyle.ITALIC);
}
public Builder strike() {
return add(FontStyle.STRIKE);
}
public Builder underline() {
return add(FontStyle.UNDERLINE);
}
void addAll(List canStyleList) {
canStyleList.addAll(list);
}
private Builder add(CanStyle style) {
list.add(style);
return this;
}
}
}