Skip to content

Commit

Permalink
#28 Adapt Chronograph for Passage Operator
Browse files Browse the repository at this point in the history
Add Style interface

Signed-off-by: Alexander Fedorov <[email protected]>
  • Loading branch information
ruspl-afed committed May 14, 2020
1 parent 58531c6 commit 7cd05fc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,11 @@ public interface Chronograph {
*/
void display(Object input);

/**
* Applies the given style
*
* @param style the style to use
*/
void style(Style style);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2020 ArSysOp
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* https://www.eclipse.org/legal/epl-2.0/.
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* ArSysOp - initial API and implementation
*******************************************************************************/
package org.eclipse.chronograph.internal.api;

/**
*
* Decorates given object with a specific style
*
*/
@FunctionalInterface
public interface Style {

void apply(Object object);

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
/**
*
* Interface intended to specify common style.
*
*
* @deprecated use {@link Style} interface
*/
@Deprecated
public interface Styler {

void initClassicTheme();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.List;

import org.eclipse.chronograph.internal.api.Chronograph;
import org.eclipse.chronograph.internal.api.Style;
import org.eclipse.chronograph.internal.api.Styler;
import org.eclipse.chronograph.internal.api.providers.ContainerProvider;
import org.eclipse.chronograph.internal.base.UnitConverter;
Expand Down Expand Up @@ -65,7 +66,11 @@ public void setProvider(ContainerProvider provider) {

@Override
public void display(Object input) {
// TODO update input
this.stage.redraw();
stage.show(input);
}

@Override
public void style(Style style) {
style.apply(stage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -562,4 +562,10 @@ public void setZoomLevelUp() {
this.calculateObjectBounds();
this.redraw();
}

public void show(Object input) {
// FIXME: here we need to clear all caches and start showing new input
// TODO Auto-generated method stub
redraw();
}
}

0 comments on commit 7cd05fc

Please sign in to comment.