List of usage examples for org.apache.wicket.request.resource DynamicImageResource DynamicImageResource
public DynamicImageResource()
From source file:kz.supershiny.web.wicket.panels.catalogue.ImageViewerPanel.java
private void switchImage(final int index, AjaxRequestTarget art) { image.setImageResource(new DynamicImageResource() { @Override//from w ww.j a va2s. co m protected byte[] getImageData(IResource.Attributes atrbts) { return images.get(index).getImageBody(); } }); art.add(image); art.add(prev); art.add(next); art.add(numbersContainer); }
From source file:net.rrm.ehour.ui.admin.config.panel.SkinConfigPanel.java
License:Open Source License
private Image createPreviewImage() { final ImageLogo excelLogo = getConfigService().getExcelLogo(); int width = excelLogo.getWidth(); double divideBy = width / 350d; double height = (double) excelLogo.getHeight() / divideBy; Image img = new Image("excelImage", "img"); img.setOutputMarkupId(true);//from w w w . j av a2 s . c o m img.add(AttributeModifier.replace("width", "350")); img.add(AttributeModifier.replace("height", Integer.toString((int) height))); img.setImageResource(new DynamicImageResource() { @Override protected byte[] getImageData(Attributes attributes) { return excelLogo.getImageData(); } }); return img; }
From source file:org.apache.directory.fortress.web.panel.JpegImage.java
License:Apache License
public JpegImage(String id) { super(id);//from ww w .j ava 2s . co m setImageResource(new DynamicImageResource() { /** Default serialVersionUID */ private static final long serialVersionUID = 1L; protected byte[] getImageData(IResource.Attributes attributes) { return getPhoto(); } }); }
From source file:org.apache.syncope.client.console.pages.Configuration.java
License:Apache License
public Configuration() { super();/*from w w w . j av a 2 s .c om*/ // Layouts add(new LayoutsPanel("adminUserLayoutPanel", AttrLayoutType.ADMIN_USER, feedbackPanel)); add(new LayoutsPanel("selfUserLayoutPanel", AttrLayoutType.SELF_USER, feedbackPanel)); add(new LayoutsPanel("adminGroupLayoutPanel", AttrLayoutType.ADMIN_GROUP, feedbackPanel)); add(new LayoutsPanel("selfGroupLayoutPanel", AttrLayoutType.SELF_GROUP, feedbackPanel)); add(new LayoutsPanel("adminMembershipLayoutPanel", AttrLayoutType.ADMIN_MEMBERSHIP, feedbackPanel)); add(new LayoutsPanel("selfMembershipLayoutPanel", AttrLayoutType.SELF_MEMBERSHIP, feedbackPanel)); add(syncopeConfWin = new ModalWindow("syncopeConfWin")); syncopeConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); syncopeConfWin.setInitialHeight(SYNCOPECONF_WIN_HEIGHT); syncopeConfWin.setInitialWidth(SYNCOPECONF_WIN_WIDTH); syncopeConfWin.setCookieName("syncopeconf-modal"); setupSyncopeConf(); add(new PoliciesPanel("passwordPoliciesPanel", getPageReference(), PolicyType.PASSWORD)); add(new PoliciesPanel("accountPoliciesPanel", getPageReference(), PolicyType.ACCOUNT)); add(new PoliciesPanel("syncPoliciesPanel", getPageReference(), PolicyType.SYNC)); add(createNotificationWin = new ModalWindow("createNotificationWin")); createNotificationWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); createNotificationWin.setInitialHeight(NOTIFICATION_WIN_HEIGHT); createNotificationWin.setInitialWidth(NOTIFICATION_WIN_WIDTH); createNotificationWin.setCookieName("create-notification-modal"); add(editNotificationWin = new ModalWindow("editNotificationWin")); editNotificationWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editNotificationWin.setInitialHeight(NOTIFICATION_WIN_HEIGHT); editNotificationWin.setInitialWidth(NOTIFICATION_WIN_WIDTH); editNotificationWin.setCookieName("edit-notification-modal"); setupNotification(); add(createSecurityQuestionWin = new ModalWindow("createSecurityQuestionWin")); createSecurityQuestionWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); createSecurityQuestionWin.setInitialHeight(SECURITY_QUESTION_WIN_HEIGHT); createSecurityQuestionWin.setInitialWidth(SECURITY_QUESTION_WIN_WIDTH); createSecurityQuestionWin.setCookieName("create-security-question-modal"); add(editSecurityQuestionWin = new ModalWindow("editSecurityQuestionWin")); editSecurityQuestionWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); editSecurityQuestionWin.setInitialHeight(SECURITY_QUESTION_WIN_HEIGHT); editSecurityQuestionWin.setInitialWidth(SECURITY_QUESTION_WIN_WIDTH); editSecurityQuestionWin.setCookieName("edit-security-question-modal"); setupSecurityQuestion(); // Workflow definition stuff WebMarkupContainer noActivitiEnabledForUsers = new WebMarkupContainer("noActivitiEnabledForUsers"); noActivitiEnabledForUsers.setOutputMarkupPlaceholderTag(true); add(noActivitiEnabledForUsers); WebMarkupContainer workflowDefContainer = new WebMarkupContainer("workflowDefContainer"); workflowDefContainer.setOutputMarkupPlaceholderTag(true); if (wfRestClient.isActivitiEnabledForUsers()) { noActivitiEnabledForUsers.setVisible(false); } else { workflowDefContainer.setVisible(false); } BookmarkablePageLink<Void> activitiModeler = new BookmarkablePageLink<>("activitiModeler", ActivitiModelerPopupPage.class); activitiModeler.setPopupSettings(new VeilPopupSettings().setHeight(600).setWidth(800)); MetaDataRoleAuthorizationStrategy.authorize(activitiModeler, ENABLE, xmlRolesReader.getEntitlement("Configuration", "workflowDefRead")); workflowDefContainer.add(activitiModeler); // Check if Activiti Modeler directory is found boolean activitiModelerEnabled = false; try { String activitiModelerDirectory = WebApplicationContextUtils .getWebApplicationContext(WebApplication.get().getServletContext()) .getBean("activitiModelerDirectory", String.class); File baseDir = new File(activitiModelerDirectory); activitiModelerEnabled = baseDir.exists() && baseDir.canRead() && baseDir.isDirectory(); } catch (Exception e) { LOG.error("Could not check for Activiti Modeler directory", e); } activitiModeler.setEnabled(activitiModelerEnabled); BookmarkablePageLink<Void> xmlEditor = new BookmarkablePageLink<>("xmlEditor", XMLEditorPopupPage.class); xmlEditor.setPopupSettings(new VeilPopupSettings().setHeight(480).setWidth(800)); MetaDataRoleAuthorizationStrategy.authorize(xmlEditor, ENABLE, xmlRolesReader.getEntitlement("Configuration", "workflowDefRead")); workflowDefContainer.add(xmlEditor); Image workflowDefDiagram = new Image("workflowDefDiagram", new Model()) { private static final long serialVersionUID = -8457850449086490660L; @Override protected IResource getImageResource() { return new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override protected byte[] getImageData(final IResource.Attributes attributes) { return wfRestClient.isActivitiEnabledForUsers() ? wfRestClient.getDiagram() : new byte[0]; } }; } }; workflowDefContainer.add(workflowDefDiagram); MetaDataRoleAuthorizationStrategy.authorize(workflowDefContainer, ENABLE, xmlRolesReader.getEntitlement("Configuration", "workflowDefRead")); add(workflowDefContainer); // Logger stuff PropertyListView<LoggerTO> coreLoggerList = new LoggerPropertyList(null, "corelogger", loggerRestClient.listLogs()); WebMarkupContainer coreLoggerContainer = new WebMarkupContainer("coreLoggerContainer"); coreLoggerContainer.add(coreLoggerList); coreLoggerContainer.setOutputMarkupId(true); MetaDataRoleAuthorizationStrategy.authorize(coreLoggerContainer, ENABLE, xmlRolesReader.getEntitlement("Configuration", "logList")); add(coreLoggerContainer); ConsoleLoggerController consoleLoggerController = new ConsoleLoggerController(); PropertyListView<LoggerTO> consoleLoggerList = new LoggerPropertyList(consoleLoggerController, "consolelogger", consoleLoggerController.getLoggers()); WebMarkupContainer consoleLoggerContainer = new WebMarkupContainer("consoleLoggerContainer"); consoleLoggerContainer.add(consoleLoggerList); consoleLoggerContainer.setOutputMarkupId(true); MetaDataRoleAuthorizationStrategy.authorize(consoleLoggerContainer, ENABLE, xmlRolesReader.getEntitlement("Configuration", "logList")); add(consoleLoggerContainer); // Extension panels setupExtPanels(); }
From source file:org.apache.syncope.client.console.pages.Workflow.java
License:Apache License
public Workflow(final PageParameters parameters) { super(parameters); WebMarkupContainer noActivitiEnabledForUsers = new WebMarkupContainer("noActivitiEnabledForUsers"); noActivitiEnabledForUsers.setOutputMarkupPlaceholderTag(true); body.add(noActivitiEnabledForUsers); WebMarkupContainer workflowDef = new WebMarkupContainer("workflowDefContainer"); workflowDef.setOutputMarkupPlaceholderTag(true); Image workflowDefDiagram = new Image("workflowDefDiagram", new Model<IResource>()) { private static final long serialVersionUID = -8457850449086490660L; @Override// www.j a va 2s . c o m protected IResource getImageResource() { return new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override protected byte[] getImageData(final IResource.Attributes attributes) { return isActivitiEnabledForUsers() ? wfRestClient.getDiagram() : new byte[0]; } }; } }; workflowDefDiagram.setOutputMarkupId(true); workflowDef.add(workflowDefDiagram); WorkflowTogglePanel togglePanel = new WorkflowTogglePanel("togglePanel", getPageReference(), workflowDefDiagram); togglePanel.setOutputMarkupId(true); workflowDef.add(togglePanel); if (isActivitiEnabledForUsers()) { noActivitiEnabledForUsers.setVisible(false); } else { workflowDef.setVisible(false); } MetaDataRoleAuthorizationStrategy.authorize(workflowDef, ENABLE, StandardEntitlement.WORKFLOW_DEF_READ); body.add(workflowDef); }
From source file:org.apache.syncope.client.console.wicket.markup.html.form.ImageModalPanel.java
License:Apache License
public ImageModalPanel(final BaseModal<T> modal, final byte[] content, final PageReference pageRef) { super(modal, pageRef); Image image = new Image("image", new Model<IResource>()) { private static final long serialVersionUID = -8457850449086490660L; @Override// w ww. j av a 2s. c o m protected IResource getImageResource() { return new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override protected byte[] getImageData(final IResource.Attributes attributes) { return content; } }; } }; image.setOutputMarkupId(true); add(image); }
From source file:org.apache.syncope.client.console.wicket.markup.html.form.preview.BinaryImagePreviewer.java
License:Apache License
@Override public Component preview(final byte[] uploadedBytes) { return this.addOrReplace( new NonCachingImage("previewImage", new ThumbnailImageResource(new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override//from w w w . j a v a 2 s. com protected byte[] getImageData(final IResource.Attributes attributes) { return uploadedBytes; } }, IMG_SIZE))); }
From source file:org.apache.syncope.console.pages.Configuration.java
License:Apache License
public Configuration() { super();//from ww w . jav a 2s. c o m setupSyncopeConf(); add(new PoliciesPanel("passwordPoliciesPanel", getPageReference(), PolicyType.PASSWORD)); add(new PoliciesPanel("accountPoliciesPanel", getPageReference(), PolicyType.ACCOUNT)); add(new PoliciesPanel("syncPoliciesPanel", getPageReference(), PolicyType.SYNC)); add(createNotificationWin = new ModalWindow("createNotificationWin")); add(editNotificationWin = new ModalWindow("editNotificationWin")); setupNotification(); // Workflow definition stuff WebMarkupContainer noActivitiEnabledForUsers = new WebMarkupContainer("noActivitiEnabledForUsers"); noActivitiEnabledForUsers.setOutputMarkupPlaceholderTag(true); add(noActivitiEnabledForUsers); WebMarkupContainer workflowDefContainer = new WebMarkupContainer("workflowDefContainer"); workflowDefContainer.setOutputMarkupPlaceholderTag(true); if (wfRestClient.isActivitiEnabledForUsers()) { noActivitiEnabledForUsers.setVisible(false); } else { workflowDefContainer.setVisible(false); } BookmarkablePageLink<Void> activitiModeler = new BookmarkablePageLink<Void>("activitiModeler", ActivitiModelerPopupPage.class); activitiModeler.setPopupSettings(new VeilPopupSettings().setHeight(600).setWidth(800)); MetaDataRoleAuthorizationStrategy.authorize(activitiModeler, ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "workflowDefRead")); workflowDefContainer.add(activitiModeler); // Check if Activiti Modeler directory is found boolean activitiModelerEnabled = false; try { String activitiModelerDirectory = WebApplicationContextUtils .getWebApplicationContext(WebApplication.get().getServletContext()) .getBean("activitiModelerDirectory", String.class); File baseDir = new File(activitiModelerDirectory); activitiModelerEnabled = baseDir.exists() && baseDir.canRead() && baseDir.isDirectory(); } catch (Exception e) { LOG.error("Could not check for Activiti Modeler directory", e); } activitiModeler.setEnabled(activitiModelerEnabled); BookmarkablePageLink<Void> xmlEditor = new BookmarkablePageLink<Void>("xmlEditor", XMLEditorPopupPage.class); xmlEditor.setPopupSettings(new VeilPopupSettings().setHeight(480).setWidth(800)); MetaDataRoleAuthorizationStrategy.authorize(xmlEditor, ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "workflowDefRead")); workflowDefContainer.add(xmlEditor); Image workflowDefDiagram = new Image("workflowDefDiagram", new Model()) { private static final long serialVersionUID = -8457850449086490660L; @Override protected IResource getImageResource() { return new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override protected byte[] getImageData(final IResource.Attributes attributes) { return wfRestClient.isActivitiEnabledForUsers() ? wfRestClient.getDiagram() : new byte[0]; } }; } }; workflowDefContainer.add(workflowDefDiagram); MetaDataRoleAuthorizationStrategy.authorize(workflowDefContainer, ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "workflowDefRead")); add(workflowDefContainer); // Logger stuff PropertyListView<LoggerTO> coreLoggerList = new LoggerPropertyList(null, "corelogger", loggerRestClient.listLogs()); WebMarkupContainer coreLoggerContainer = new WebMarkupContainer("coreLoggerContainer"); coreLoggerContainer.add(coreLoggerList); coreLoggerContainer.setOutputMarkupId(true); MetaDataRoleAuthorizationStrategy.authorize(coreLoggerContainer, ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "logList")); add(coreLoggerContainer); ConsoleLoggerController consoleLoggerController = new ConsoleLoggerController(); PropertyListView<LoggerTO> consoleLoggerList = new LoggerPropertyList(consoleLoggerController, "consolelogger", consoleLoggerController.getLoggers()); WebMarkupContainer consoleLoggerContainer = new WebMarkupContainer("consoleLoggerContainer"); consoleLoggerContainer.add(consoleLoggerList); consoleLoggerContainer.setOutputMarkupId(true); MetaDataRoleAuthorizationStrategy.authorize(consoleLoggerContainer, ENABLE, xmlRolesReader.getAllAllowedRoles("Configuration", "logList")); add(consoleLoggerContainer); }
From source file:org.apache.syncope.console.wicket.markup.html.form.preview.BinaryImagePreviewer.java
License:Apache License
@Override public Component preview() { return this.add(new NonCachingImage("previewImage", new ThumbnailImageResource(new DynamicImageResource() { private static final long serialVersionUID = 923201517955737928L; @Override/*from www.j a va 2 s.c o m*/ protected byte[] getImageData(final IResource.Attributes attributes) { return uploadedBytes; } }, IMG_SIZE))); }
From source file:org.patientview.radar.web.components.JFreeChartImage.java
License:Open Source License
@Override protected IResource getImageResource() { DynamicImageResource resource = new DynamicImageResource() { @Override/*from w ww . ja v a2 s . c o m*/ protected byte[] getImageData(final Attributes attributes) { JFreeChart chart = (JFreeChart) getDefaultModelObject(); return toImageData(chart.createBufferedImage(width, height)); } @Override protected void configureResponse(final ResourceResponse response, final Attributes attributes) { super.configureResponse(response, attributes); response.setCacheDuration(Duration.NONE); response.setCacheScope(WebResponse.CacheScope.PRIVATE); } }; return resource; }