Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EC4B7CE52 for ; Mon, 3 Jun 2013 18:22:21 +0000 (UTC) Received: (qmail 60356 invoked by uid 500); 3 Jun 2013 18:22:21 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 60336 invoked by uid 500); 3 Jun 2013 18:22:21 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 60329 invoked by uid 99); 3 Jun 2013 18:22:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 18:22:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Jun 2013 18:22:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 127272388847; Mon, 3 Jun 2013 18:21:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1489092 - in /syncope/trunk: ./ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope/console/pages/panels/ Date: Mon, 03 Jun 2013 18:21:57 -0000 To: commits@syncope.apache.org From: massi@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130603182158.127272388847@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: massi Date: Mon Jun 3 18:21:57 2013 New Revision: 1489092 URL: http://svn.apache.org/r1489092 Log: Builder instead of constructors Modified: syncope/trunk/ (props changed) syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java Propchange: syncope/trunk/ ------------------------------------------------------------------------------ Merged /syncope/branches/1_1_X:r1488975-1489090 Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java?rev=1489092&r1=1489091&r2=1489092&view=diff ============================================================================== --- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java (original) +++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java Mon Jun 3 18:21:57 2013 @@ -67,8 +67,8 @@ public class Roles extends BasePage { treePanel.setOutputMarkupId(true); add(treePanel); - final RoleSummaryPanel summaryPanel = new RoleSummaryPanel("summaryPanel", editRoleWin, - Roles.this.getPageReference()); + final RoleSummaryPanel summaryPanel = new RoleSummaryPanel.Builder("summaryPanel") + .window(editRoleWin).callerPageRef(Roles.this.getPageReference()).build(); add(summaryPanel); editRoleWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { @@ -144,8 +144,9 @@ public class Roles extends BasePage { if (event.getPayload() instanceof TreeNodeClickUpdate) { final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload(); - final RoleSummaryPanel summaryPanel = new RoleSummaryPanel("summaryPanel", editRoleWin, - Roles.this.getPageReference(), update.getSelectedNodeId()); + final RoleSummaryPanel summaryPanel = new RoleSummaryPanel.Builder("summaryPanel") + .window(editRoleWin).callerPageRef(Roles.this.getPageReference()) + .selectedNodeId(update.getSelectedNodeId()).build(); addOrReplace(summaryPanel); update.getTarget().add(this); Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java?rev=1489092&r1=1489091&r2=1489092&view=diff ============================================================================== --- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java (original) +++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java Mon Jun 3 18:21:57 2013 @@ -18,6 +18,7 @@ */ package org.apache.syncope.console.pages.panels; +import java.io.Serializable; import org.apache.syncope.common.to.RoleTO; import org.apache.syncope.common.validation.SyncopeClientCompositeErrorException; import org.apache.syncope.console.rest.RoleRestClient; @@ -51,44 +52,68 @@ public class RoleSummaryPanel extends Pa private TreeActionLinkPanel actionLink; - private final PageReference callerPageRef; + public static class Builder implements Serializable { - private final ModalWindow window; + private static final long serialVersionUID = 8150440254654306070L; - public RoleSummaryPanel(final String id, final ModalWindow window, final PageReference callerPageRef) { - this(id, window, callerPageRef, null); - } + private String id; + + private ModalWindow window; + + private PageReference callerPageRef; + + private Long selectedNodeId = null; - public RoleSummaryPanel(final String id, final ModalWindow window, final PageReference callerPageRef, - Long selectedNodeId) { + public Builder(final String id) { + this.id = id; + } + + public RoleSummaryPanel.Builder window(final ModalWindow window) { + this.window = window; + return this; + } - super(id); + public RoleSummaryPanel.Builder callerPageRef(final PageReference callerPageRef) { + this.callerPageRef = callerPageRef; + return this; + } + + public RoleSummaryPanel.Builder selectedNodeId(final Long selectedNodeId) { + this.selectedNodeId = selectedNodeId; + return this; + } + + public RoleSummaryPanel build() { + return new RoleSummaryPanel(this); + } + } - this.callerPageRef = callerPageRef; - this.window = window; + private RoleSummaryPanel(final Builder builder) { + super(builder.id); - if (selectedNodeId == null || selectedNodeId == 0) { + if (builder.selectedNodeId == null || builder.selectedNodeId == 0) { this.selectedNode = null; } else { try { - this.selectedNode = restClient.read(selectedNodeId); + this.selectedNode = restClient.read(builder.selectedNodeId); } catch (SyncopeClientCompositeErrorException e) { - LOG.error("Could not read {}", selectedNodeId, e); + LOG.error("Could not read {}", builder.selectedNodeId, e); this.selectedNode = null; - selectedNodeId = null; + builder.selectedNodeId = null; } } - fragment = new Fragment("roleSummaryPanel", selectedNodeId == null ? "fakerootFrag" - : (selectedNodeId == 0 ? "rootPanel" : "roleViewPanel"), this); + fragment = new Fragment("roleSummaryPanel", builder.selectedNodeId == null ? "fakerootFrag" + : (builder.selectedNodeId == 0 ? "rootPanel" : "roleViewPanel"), this); - if (selectedNodeId != null) { - if (selectedNodeId == 0) { - actionLink = new TreeActionLinkPanel("actionLink", selectedNodeId, new Model(), window, callerPageRef); + if (builder.selectedNodeId != null) { + if (builder.selectedNodeId == 0) { + actionLink = new TreeActionLinkPanel("actionLink", builder.selectedNodeId, new Model(), + builder.window, builder.callerPageRef); actionLink.setOutputMarkupId(true); fragment.add(actionLink); } else { - roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, window, callerPageRef); + roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, builder.window, builder.callerPageRef); roleTabPanel.setOutputMarkupId(true); fragment.add(roleTabPanel); } Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java?rev=1489092&r1=1489091&r2=1489092&view=diff ============================================================================== --- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java (original) +++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/StatusPanel.java Mon Jun 3 18:21:57 2013 @@ -165,39 +165,33 @@ public class StatusPanel extends Panel i switch (item.getModelObject().getStatus()) { case NOT_YET_SUBMITTED: - image = new Image("icon", IMG_STATUES + StatusUtils.Status.UNDEFINED.toString() - + Constants.PNG_EXT); + image = newImage(StatusUtils.Status.UNDEFINED.toString()); alt = "undefined icon"; title = "Not yet submitted"; break; case ACTIVE: - image = new Image("icon", IMG_STATUES + StatusUtils.Status.ACTIVE.toString() - + Constants.PNG_EXT); + image = newImage(StatusUtils.Status.ACTIVE.toString()); alt = "active icon"; title = "Enabled"; break; case UNDEFINED: - image = new Image("icon", IMG_STATUES + StatusUtils.Status.UNDEFINED.toString() - + Constants.PNG_EXT); + image = newImage(StatusUtils.Status.UNDEFINED.toString()); checkVisibility = false; alt = "undefined icon"; title = "Undefined status"; break; case OBJECT_NOT_FOUND: - image = - new Image("icon", IMG_STATUES + StatusUtils.Status.OBJECT_NOT_FOUND.toString() - + Constants.PNG_EXT); + image = newImage(StatusUtils.Status.OBJECT_NOT_FOUND.toString()); checkVisibility = false; alt = "notfound icon"; title = "User not found"; break; default: - image = new Image("icon", IMG_STATUES + StatusUtils.Status.SUSPENDED.toString() - + Constants.PNG_EXT); + image = newImage(StatusUtils.Status.SUSPENDED.toString()); alt = "inactive icon"; title = "Disabled"; } @@ -267,6 +261,10 @@ public class StatusPanel extends Panel i checkGroup.add(statusBeansListView); } + private Image newImage(final String imageStatus) { + return new Image("icon", IMG_STATUES + imageStatus + Constants.PNG_EXT); + } + public PropagationRequestTO getPropagationRequestTO() { PropagationRequestTO result = null;