Difference between revisions of "ToolBarHandlerExtension"

From OpenKM Documentation
Jump to: navigation, search
 
Line 2: Line 2:
  
 
== Method ==
 
== Method ==
onChange(ToolBarEventConstant event)
+
=== onChange(ToolBarEventConstant event) ===
 
 
 
 
== onChange(ToolBarEventConstant event) ==
 
 
Each time it'll be some new toolbar event the method onChange it'll be fired by OpenKM
 
Each time it'll be some new toolbar event the method onChange it'll be fired by OpenKM
 
  
 
== Example ==
 
== Example ==
 
<source lang="java">
 
<source lang="java">
public class ToolBarButton extends ToolBarButtonExtension implements ToolBarHandlerExtension {
+
public class ToolBarButton extends ToolBarButtonExtension implements ToolBarHandlerExtension {
+
 
public ToolBarButton(Image image, String title, ClickHandler handler) {
+
public ToolBarButton(Image image, String title, ClickHandler handler) {
super(image, title, handler);
+
super(image, title, handler);
}
+
}
  
@Override
+
@Override
public void checkPermissions(GWTFolder folder, GWTFolder folderParent, int originPanel) {
+
public void checkPermissions(GWTFolder folder, GWTFolder folderParent, int originPanel) {
// TODO Auto-generated method stub
+
// TODO Auto-generated method stub
+
}
}
 
  
@Override
+
@Override
public void checkPermissions(GWTDocument doc, GWTFolder folder) {
+
public void checkPermissions(GWTDocument doc, GWTFolder folder) {
// TODO Auto-generated method stub
+
// TODO Auto-generated method stub
+
}
}
 
  
@Override
+
@Override
public void checkPermissions(GWTMail mail, GWTFolder folder) {
+
public void checkPermissions(GWTMail mail, GWTFolder folder) {
// TODO Auto-generated method stub
+
// TODO Auto-generated method stub
+
}
}
 
  
@Override
+
@Override
public void enable(boolean enable) {
+
public void enable(boolean enable) {
// TODO Auto-generated method stub
+
// TODO Auto-generated method stub
+
}
}
 
  
@Override
+
@Override
public boolean isEnabled() {
+
public boolean isEnabled() {
// TODO Auto-generated method stub
+
// TODO Auto-generated method stub
return false;
+
return false;
}
+
}
  
@Override
+
@Override
public void onChange(ToolBarEventConstant event) {
+
public void onChange(ToolBarEventConstant event) {
if (event.equals(HasToolBarEvent.EXECUTE_ADD_DOCUMENT)) {
+
if (event.equals(HasToolBarEvent.EXECUTE_ADD_DOCUMENT)) {
Window.alert("executed add document - " + event.getType());
+
Window.alert("executed add document - " + event.getType());
}
+
}  
}
 
 
}
 
}
 +
}
 
</source>
 
</source>
  
[[Category: OpenKM plugin extensions]]
+
[[Category: Extension Guide]]

Latest revision as of 13:32, 2 December 2010

Any extension that implements ToolBarHandlerExtension will be watching all events fired from toolbar

Method

onChange(ToolBarEventConstant event)

Each time it'll be some new toolbar event the method onChange it'll be fired by OpenKM

Example

public class ToolBarButton extends ToolBarButtonExtension implements ToolBarHandlerExtension {

	public ToolBarButton(Image image, String title, ClickHandler handler) {
		super(image, title, handler);
	}

	@Override
	public void checkPermissions(GWTFolder folder, GWTFolder folderParent, int originPanel) {
		// TODO Auto-generated method stub
	}

	@Override
	public void checkPermissions(GWTDocument doc, GWTFolder folder) {
		// TODO Auto-generated method stub
	}

	@Override
	public void checkPermissions(GWTMail mail, GWTFolder folder) {
		// TODO Auto-generated method stub
	}

	@Override
	public void enable(boolean enable) {
		// TODO Auto-generated method stub
	}

	@Override
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void onChange(ToolBarEventConstant event) {
		if (event.equals(HasToolBarEvent.EXECUTE_ADD_DOCUMENT)) {
			Window.alert("executed add document - " + event.getType());
		} 
	}
}