Skip to content

Commit

Permalink
Apply checkstyle politics
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomYdn committed Apr 7, 2015
1 parent 890a5d4 commit 17d9439
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 36 deletions.
77 changes: 77 additions & 0 deletions check_style.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--keep the file in project root although NetBeans 8.0.2 doesn't find it there and allow to add additional project files (don't skip a proper project structure in favour of IDE deficies)-->
<module name="Checker">
<module name="TreeWalker">
<!-- Checks the Javadoc of a method or constructor. -->
<module name="JavadocMethod">
<property name="scope" value="public"/>
<property name="severity" value="warning"/>
</module>
<!-- Checks Javadoc comments for class and interface definitions. -->
<module name="JavadocType">
<property name="scope" value="public"/>
<property name="severity" value="warning"/>
</module>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sourceforge.net/config_naming.html -->
<!-- Sun Naming Conventions -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<module name="TypeName">
<property name="format"
value="^I[a-zA-Z0-9]*$"/>
<property name="tokens"
value="INTERFACE_DEF"/>
</module>
<module name="InterfaceTypeParameterName"/>
<module name="MethodTypeParameterName"/>
<module name="ClassTypeParameterName"/>
<module name="AnonInnerLength">
<property name="max" value="60"/>
</module>
<module name="ArrayTypeStyle"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HideUtilityClassConstructor"/>
<module name="MethodLength"/>
<module name="LineLength">
<property name="max" value="180"/>
</module>
<module name="NestedIfDepth">
<property name="max" value="6"/>
</module>
<module name="NestedTryDepth"/>
<module name="StringLiteralEquality"/>
<module name="TodoComment">
<property name="severity" value="warning"/>
</module>
<module name="UncommentedMain">
<property name="excludedClasses" value="StartStandalone$"/>
</module>
<!-- Specify method parameters code conventions -->
<!--<module name="MethodParamPad">
Whitespace is required after method name
<property name="option" value="space" />
Check only methods and constructors declarations
<property name="tokens" value="METHOD_DEF, CTOR_DEF" />
</module> -->
<!-- Checks the policy on the padding of parentheses; i.e. whether a space is required after a left parenthesis and before a
right parenthesis, or such spaces are forbidden. -->
<!--<module name="ParenPad">
Whitespace required before ')' and after ')'
<property name="option" value="space"/>
</module> -->
</module>
<module name="Translation"/>
<module name="UniqueProperties"/>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ private void prepareResults(OClass oClass)
{
OQueryDataProvider<ODocument> provider = new OQueryDataProvider<ODocument>("select from "+oClass.getName()+" where any() containstext :text");
provider.setParameter("text", getModel());
OrienteerDataTable<ODocument, String> table = new OrienteerDataTable<ODocument, String>("results", oClassIntrospector.getColumnsFor(oClass, true, DisplayMode.VIEW.asModel()), provider, 20);
OrienteerDataTable<ODocument, String> table =
new OrienteerDataTable<ODocument, String>("results", oClassIntrospector.getColumnsFor(oClass, true, DisplayMode.VIEW.asModel()), provider, 20);
table.addCommand(new AbstractCheckBoxEnabledCommand<ODocument>(new ResourceModel("command.select"), table)
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ public void component(MarkupContainer object,
}, new ClassVisitFilter(IMetaContext.class));
}

public <V2> AbstractMetaPanel<T, C, V2> getMetaComponent(C critery)
public <W> AbstractMetaPanel<T, C, W> getMetaComponent(C critery)
{
return getMetaComponent(getMetaContext(), critery);
}

public <V2> V2 getMetaComponentValue(C critery)
public <W> W getMetaComponentValue(C critery)
{
AbstractMetaPanel<T, C, V2> otherMetaPanel = getMetaComponent(critery);
AbstractMetaPanel<T, C, W> otherMetaPanel = getMetaComponent(critery);
return otherMetaPanel!=null?otherMetaPanel.getValueObject():null;
}

Expand Down Expand Up @@ -158,9 +158,9 @@ private void convertInput(FormComponent<V> formComponent)
}
}

public <V2> V2 getMetaComponentEnteredValue(C critery)
public <W> W getMetaComponentEnteredValue(C critery)
{
AbstractMetaPanel<T, C, V2> otherMetaPanel = getMetaComponent(critery);
AbstractMetaPanel<T, C, W> otherMetaPanel = getMetaComponent(critery);
if(otherMetaPanel==null) return null;
return otherMetaPanel!=null?otherMetaPanel.getEnteredValue():null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public EmbeddedMapViewPanel(String id, final IModel<ODocument> documentModel, fi
final DefaultVisualizer visualizer = DefaultVisualizer.INSTANCE;
final OType oType = propertyModel.getObject().getLinkedType();
IModel<Set<Map.Entry<String, V>>> entriesModel = new PropertyModel<Set<Map.Entry<String,V>>>(getModel(), "entrySet()");
ListView<Map.Entry<String, V>> listView = new ListView<Map.Entry<String, V>>("items", new CollectionAdapterModel<Map.Entry<String, V>, Set<Map.Entry<String, V>>>(entriesModel)) {
ListView<Map.Entry<String, V>> listView =
new ListView<Map.Entry<String, V>>("items", new CollectionAdapterModel<Map.Entry<String, V>, Set<Map.Entry<String, V>>>(entriesModel)) {

@Override
protected void populateItem(ListItem<Map.Entry<String, V>> item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public LinksPropertyDataTablePanel(String id, IModel<ODocument> documentModel, O
IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel();

ISortableDataProvider<ODocument, String> provider = oClassIntrospector.prepareDataProviderForProperty(property, documentModel);
OrienteerDataTable<ODocument, String> table = new OrienteerDataTable<ODocument, String>("table", oClassIntrospector.getColumnsFor(linkedClass, true, modeModel), provider, 20);
OrienteerDataTable<ODocument, String> table =
new OrienteerDataTable<ODocument, String>("table", oClassIntrospector.getColumnsFor(linkedClass, true, modeModel), provider, 20);
table.setCaptionModel(new OPropertyNamingModel(property));
SecurityBehavior securityBehaviour = new SecurityBehavior(documentModel, OrientPermission.UPDATE);
if(!isCalculable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ public boolean apply(OProperty input) {
};

private static final long serialVersionUID = 1L;
private static final List<String> CLUSTER_SELECTIONS = Arrays.asList(new String[]{ODefaultClusterSelectionStrategy.NAME, ORoundRobinClusterSelectionStrategy.NAME, OBalancedClusterSelectionStrategy.NAME});
private static final List<String> CLUSTER_SELECTIONS =
Arrays.asList(new String[]{ODefaultClusterSelectionStrategy.NAME, ORoundRobinClusterSelectionStrategy.NAME, OBalancedClusterSelectionStrategy.NAME});

public static class ListClassesModel extends LoadableDetachableModel<List<OClass>>
{
/**
*
*/
private static final long serialVersionUID = 1L;
private static final Ordering<OClass> ordering = Ordering.natural().nullsFirst().onResultOf(new Function<OClass, String>() {
private static final Ordering<OClass> ORDERING = Ordering.natural().nullsFirst().onResultOf(new Function<OClass, String>() {

@Override
public String apply(OClass input) {
Expand All @@ -89,7 +90,7 @@ public String apply(OClass input) {
@Override
protected List<OClass> load() {
Collection<OClass> classes = OrientDbWebSession.get().getDatabase().getMetadata().getSchema().getClasses();
return ordering.sortedCopy(classes);
return ORDERING.sortedCopy(classes);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,9 @@ protected void onConfigure() {

}.setNullValid(false).setRequired(true);
case PROP_INVERSE:
IModel<OClass> linkedClassModel = (IModel<OClass>)getMetaComponentEnteredValueModel(OPropertyPrototyper.LINKED_CLASS);
return new DropDownChoice<OProperty>(id, (IModel<OProperty>)getModel(),
new ListOPropertiesModel((IModel<OClass>)getMetaComponentEnteredValueModel(OPropertyPrototyper.LINKED_CLASS), null)
new ListOPropertiesModel(linkedClassModel, null)
{
@Override
protected Predicate<? super OProperty> getFilterPredicate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ public UIVisualizersRegistry()
{
registerUIComponentFactory(DefaultVisualizer.INSTANCE);
registerUIComponentFactory(new SimpleVisualizer("textarea", MultiLineLabel.class, TextArea.class, OType.STRING));
registerUIComponentFactory(new SimpleVisualizer("table", true, LinksPropertyDataTablePanel.class, LinksPropertyDataTablePanel.class, OType.LINKLIST, OType.LINKSET, OType.LINKBAG));
registerUIComponentFactory(new SimpleVisualizer("table", true, LinksPropertyDataTablePanel.class,
LinksPropertyDataTablePanel.class,
OType.LINKLIST,
OType.LINKSET,
OType.LINKBAG));
registerUIComponentFactory(new ListboxVisualizer());
registerUIComponentFactory(new PasswordVisualizer());
registerUIComponentFactory(new HTMLVisualizer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ public <V> Component createComponent(String id, DisplayMode mode,
case LINKSET:
return new LinksCollectionViewPanel<OIdentifiable, Collection<OIdentifiable>>(id, documentModel, property);
case DATE:
return DateLabel.forDatePattern(id, (IModel<Date>) valueModel, ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.LONG, Session.get().getLocale())).toPattern());
String datePattern =((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.LONG, Session.get().getLocale())).toPattern();
return DateLabel.forDatePattern(id, (IModel<Date>) valueModel, datePattern);
case DATETIME:
return DateLabel.forDatePattern(id, (IModel<Date>) valueModel, ((SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG, Session.get().getLocale())).toPattern());
String dateTimePattern = ((SimpleDateFormat) DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG, Session.get().getLocale())).toPattern();
return DateLabel.forDatePattern(id, (IModel<Date>) valueModel, dateTimePattern);
case BOOLEAN:
return new BooleanViewPanel(id, (IModel<Boolean>)valueModel);
case EMBEDDED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,26 @@ public class SimpleVisualizer extends AbstractSimpleVisualizer
private final Class<? extends Component> viewComponentClass;
private final Class<? extends Component> editComponentClass;

public SimpleVisualizer(String name, Class<? extends Component> viewComponentClass, Class<? extends Component> editComponentClass, OType... supportedTypes)
public SimpleVisualizer(String name, Class<? extends Component> viewComponentClass,
Class<? extends Component> editComponentClass, OType... supportedTypes)
{
this(name, viewComponentClass, editComponentClass, Arrays.asList(supportedTypes));
}

public SimpleVisualizer(String name, Class<? extends Component> viewComponentClass, Class<? extends Component> editComponentClass, Collection<OType> supportedTypes)
public SimpleVisualizer(String name, Class<? extends Component> viewComponentClass,
Class<? extends Component> editComponentClass, Collection<OType> supportedTypes)
{
this(name, false, viewComponentClass, editComponentClass, supportedTypes);
}

public SimpleVisualizer(String name, boolean extended, Class<? extends Component> viewComponentClass, Class<? extends Component> editComponentClass, OType... supportedTypes)
public SimpleVisualizer(String name, boolean extended, Class<? extends Component> viewComponentClass,
Class<? extends Component> editComponentClass, OType... supportedTypes)
{
this(name, extended, viewComponentClass, editComponentClass, Arrays.asList(supportedTypes));
}

public SimpleVisualizer(String name, boolean extended, Class<? extends Component> viewComponentClass, Class<? extends Component> editComponentClass, Collection<OType> supportedTypes)
public SimpleVisualizer(String name, boolean extended, Class<? extends Component> viewComponentClass,
Class<? extends Component> editComponentClass, Collection<OType> supportedTypes)
{
super(name, extended, supportedTypes);
Args.notNull(name, "name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.common.base.Converter;
import com.google.common.collect.Lists;

public class CheckBoxColumn<T, PK extends Serializable, S> extends AbstractColumn<T, S>
public class CheckBoxColumn<T, P extends Serializable, S> extends AbstractColumn<T, S>
{
private static final JavaScriptResourceReference SELECT_ALL_JS = new JavaScriptResourceReference(CheckBoxColumn.class, "select-all.js");

Expand All @@ -34,10 +34,10 @@ public CheckboxPanel(String id, IModel<Boolean> model)

}
private static final long serialVersionUID = 1L;
private List<PK> selected = new ArrayList<PK>();
private Converter<T, PK> converterToPK;
private List<P> selected = new ArrayList<P>();
private Converter<T, P> converterToPK;

public CheckBoxColumn(Converter<T, PK> converterToPK) {
public CheckBoxColumn(Converter<T, P> converterToPK) {
super(null);
this.converterToPK = converterToPK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

public class CalculablePropertiesHook extends ODocumentHookAbstract
{
private static Pattern FULL_QUERY_PATTERN = Pattern.compile("^\\s*(select|traverse)", Pattern.CASE_INSENSITIVE);
private final static Pattern FULL_QUERY_PATTERN = Pattern.compile("^\\s*(select|traverse)", Pattern.CASE_INSENSITIVE);

private Map<String, Integer> schemaVersions = new ConcurrentHashMap<String, Integer>();
private Table<String, String, List<String>> calcProperties = HashBasedTable.create();
Expand Down Expand Up @@ -129,7 +129,8 @@ public void onRecordAfterRead(ODocument iDocument) {
}
else
{
calculated = iDocument.getDatabase().query(new OSQLSynchQuery<Object>("select "+script+" as value from "+iDocument.getIdentity()));
script = "select "+script+" as value from "+iDocument.getIdentity();
calculated = iDocument.getDatabase().query(new OSQLSynchQuery<Object>(script));
}
if(calculated!=null && calculated.size()>0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,17 @@ public void onRecordAfterUpdate(ODocument doc) {
for(Object originaIdentifiable: (Iterable<?>)original)
{
if(originaIdentifiable!=null && originaIdentifiable instanceof OIdentifiable)
removeLink((ODocument)((OIdentifiable)originaIdentifiable).getRecord(), inverseProperty, doc);
removeLink((ODocument)((OIdentifiable)originaIdentifiable).getRecord(),
inverseProperty, doc);
}
}
if(current!=null && current instanceof Iterable)
{
for(Object currentIdentifiable: (Iterable<?>)current)
{
if(currentIdentifiable!=null && currentIdentifiable instanceof OIdentifiable)
addLink((ODocument)((OIdentifiable)currentIdentifiable).getRecord(), inverseProperty, doc);
addLink((ODocument)((OIdentifiable)currentIdentifiable).getRecord(),
inverseProperty, doc);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ public class PlantUmlService implements IUmlService

private static class AsciiEncoder{

static AsciiEncoder INSTANCE = new AsciiEncoder();
private final static AsciiEncoder INSTANCE = new AsciiEncoder();

final private char encode6bit[] = new char[64];
final private char[] encode6bit = new char[64];

public AsciiEncoder() {
for (byte b = 0; b < 64; b++) {
encode6bit[b] = encode6bit(b);
}
}

public String encode(byte data[]) {
public String encode(byte[] data) {
final StringBuilder resu = new StringBuilder((data.length * 4 + 2) / 3);
for (int i = 0; i < data.length; i += 3) {
append3bytes(resu, data[i] & 0xFF, i + 1 < data.length ? data[i + 1] & 0xFF : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void initialize() {
Form<ODocument> form = new Form<ODocument>("form");
OQueryDataProvider<ODocument> provider = new OQueryDataProvider<ODocument>("select from "+getModelObject().getName());

OrienteerDataTable<ODocument, String> table = new OrienteerDataTable<ODocument, String>("table", oClassIntrospector.getColumnsFor(getModelObject(), true, modeModel), provider, 20);
OrienteerDataTable<ODocument, String> table =
new OrienteerDataTable<ODocument, String>("table", oClassIntrospector.getColumnsFor(getModelObject(), true, modeModel), provider, 20);
table.addCommand(new CreateODocumentCommand(table, getModel()));
table.addCommand(new EditODocumentsCommand(table, modeModel, getModel()));
table.addCommand(new SaveODocumentsCommand(table, modeModel));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ protected void populateItem(ListItem<OProperty> item) {
form.add(OrienteerWebApplication.get()
.getUIVisualizersRegistry()
.getComponentFactory(oProperty.getType(), component)
.createComponent("component", DisplayMode.VIEW, getDocumentModel(), item.getModel(), new DynamicPropertyValueModel<Object>(getDocumentModel(), item.getModel())));
.createComponent("component", DisplayMode.VIEW, getDocumentModel(),
item.getModel(),
new DynamicPropertyValueModel<Object>(getDocumentModel(), item.getModel())));
item.add(form);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ protected void populateItem(ListItem<ODocument> item) {
@Override
public void onClick() {
OrienteerWebSession.get().setPerspecive(getModelObject());
OrienteerBasePage.this.info(getLocalizer().getString("info.perspectivechanged", this, new ODocumentPropertyModel<String>(getModel(), "name")));
OrienteerBasePage.this.info(
getLocalizer().getString("info.perspectivechanged", this, new ODocumentPropertyModel<String>(getModel(), "name"))
);
}
};
link.add(new FAIcon("icon", new ODocumentPropertyModel<String>(itemModel, "icon")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
@MountPath("/search")
public class SearchPage extends OrienteerBasePage<String>
{
public static Ordering<OClass> CLASSES_ORDERING = Ordering.natural().nullsFirst().onResultOf(new Function<OClass, String>() {
public final static Ordering<OClass> CLASSES_ORDERING = Ordering.natural().nullsFirst().onResultOf(new Function<OClass, String>() {

@Override
public String apply(OClass input) {
Expand Down Expand Up @@ -134,10 +134,12 @@ private void prepareResults()

private void prepareResults(OClass oClass)
{
OQueryDataProvider<ODocument> provider = new OQueryDataProvider<ODocument>("select from "+oClass.getName()+" where any() containstext :text");
OQueryDataProvider<ODocument> provider =
new OQueryDataProvider<ODocument>("select from "+oClass.getName()+" where any() containstext :text");
provider.setParameter("text", getModel());
IModel<DisplayMode> modeModel = DisplayMode.VIEW.asModel();
OrienteerDataTable<ODocument, String> table = new OrienteerDataTable<ODocument, String>("results", oClassIntrospector.getColumnsFor(oClass, false, modeModel), provider, 20);
OrienteerDataTable<ODocument, String> table =
new OrienteerDataTable<ODocument, String>("results", oClassIntrospector.getColumnsFor(oClass, false, modeModel), provider, 20);
table.addCommand(new EditODocumentsCommand(table, modeModel, oClass));
table.addCommand(new SaveODocumentsCommand(table, modeModel));
resultsContainer.addOrReplace(table);
Expand Down

1 comment on commit 17d9439

@PhantomYdn
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Custom apply of #167 & #147

Please sign in to comment.