- 시작하는 제품에 따라 제품이 보여지고 관리되도록 수정.
[Tadpole.git] / com.hangum.tadpole.applicaion.start / src / com / hangum / tadpole / application / start / update / checker / NewVersionViewDialog.java
blob26c514e8155872a8c09164f17eb0b8e21c6ad049
1 /*******************************************************************************
2 * Copyright (c) 2016 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7 *
8 * Contributors:
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com.hangum.tadpole.application.start.update.checker;
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.jface.dialogs.TitleAreaDialog;
15 import org.eclipse.rap.rwt.RWT;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.events.SelectionAdapter;
18 import org.eclipse.swt.events.SelectionEvent;
19 import org.eclipse.swt.graphics.Point;
20 import org.eclipse.swt.layout.GridData;
21 import org.eclipse.swt.layout.GridLayout;
22 import org.eclipse.swt.widgets.Button;
23 import org.eclipse.swt.widgets.Composite;
24 import org.eclipse.swt.widgets.Control;
25 import org.eclipse.swt.widgets.Label;
26 import org.eclipse.swt.widgets.Shell;
28 import com.hangum.tadpole.application.start.Messages;
29 import com.hangum.tadpole.commons.libs.core.define.PublicTadpoleDefine;
30 import com.hangum.tadpole.commons.libs.core.define.SystemDefine;
31 import com.hangum.tadpole.commons.libs.core.message.CommonMessages;
32 import com.hangum.tadpole.commons.util.CookieUtils;
33 import com.hangum.tadpole.commons.util.GlobalImageUtils;
35 /**
36 * new version view diloag
38 * @author hangum
41 public class NewVersionViewDialog extends TitleAreaDialog {
42 private NewVersionObject newVersionObj;
43 private Button btnDonotShow;
45 /**
46 * Create the dialog.
47 * @param parentShell
49 public NewVersionViewDialog(Shell parentShell, NewVersionObject newVersionObj) {
50 super(parentShell);
52 this.newVersionObj = newVersionObj;
55 @Override
56 public void configureShell(Shell newShell) {
57 super.configureShell(newShell);
58 newShell.setText(SystemDefine.DBHUB_NAME);
59 newShell.setImage(GlobalImageUtils.getTadpoleIcon());
62 /**
63 * Create contents of the dialog.
64 * @param parent
66 @Override
67 protected Control createDialogArea(Composite parent) {
68 setMessage(Messages.get().NewVersionViewDialog_0); //$NON-NLS-1$
69 setTitle(Messages.get().NewVersionViewDialog_1); //$NON-NLS-1$
70 Composite area = (Composite) super.createDialogArea(parent);
71 Composite container = new Composite(area, SWT.NONE);
72 container.setLayout(new GridLayout(2, false));
73 container.setLayoutData(new GridData(GridData.FILL_BOTH));
75 Label lblCurrentVersion = new Label(container, SWT.NONE);
76 lblCurrentVersion.setText(Messages.get().NewVersionViewDialog_2); //$NON-NLS-1$
78 Label lblCurrentversionvalue = new Label(container, SWT.NONE);
79 lblCurrentversionvalue.setText(SystemDefine.getDBHubSystemInfo());
80 new Label(container, SWT.NONE);
82 Label labelRight = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
83 labelRight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
85 Label lblNewVersion = new Label(container, SWT.NONE);
86 lblNewVersion.setText(Messages.get().NewVersionViewDialog_NewVersion);
88 Label lblNewversionvalue = new Label(container, SWT.NONE);
89 lblNewversionvalue.setText(newVersionObj.getMajorVer() + " " + newVersionObj.getSubVer() + " - " + newVersionObj.getDate());
91 Label lblInformationUrl = new Label(container, SWT.NONE);
92 lblInformationUrl.setText(Messages.get().NewVersionViewDialog_7); //$NON-NLS-1$
94 Label lblInformationurlvalue = new Label(container, SWT.NONE);
95 lblInformationurlvalue.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
96 lblInformationurlvalue.setText(String.format(Messages.get().NewVersionViewDialog_8, newVersionObj.getInfoUrl())); //$NON-NLS-1$
98 Label lblDownloadUrl = new Label(container, SWT.NONE);
99 lblDownloadUrl.setText(Messages.get().NewVersionViewDialog_5); //$NON-NLS-1$
101 Label lblDownloadurlvalue = new Label(container, SWT.NONE);
102 lblDownloadurlvalue.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
103 lblDownloadurlvalue.setText(String.format(Messages.get().NewVersionViewDialog_6, newVersionObj.getDownloadUrl())); //$NON-NLS-1$
104 new Label(container, SWT.NONE);
106 btnDonotShow = new Button(container, SWT.CHECK);
107 btnDonotShow.addSelectionListener(new SelectionAdapter() {
108 @Override
109 public void widgetSelected(SelectionEvent e) {
110 CookieUtils.saveCookie(PublicTadpoleDefine.TDB_COOKIE_UPDATE_CHECK, ""+btnDonotShow.getSelection());
113 btnDonotShow.setText(Messages.get().NewVersionViewDialog_DoesnotCheck);
115 initUI();
117 return area;
121 * Initialize UI
123 private void initUI() {
124 btnDonotShow.setSelection(CookieUtils.isUpdateChecker());
128 * Create contents of the button bar.
129 * @param parent
131 @Override
132 protected void createButtonsForButtonBar(Composite parent) {
133 createButton(parent, IDialogConstants.OK_ID, CommonMessages.get().Close, true); //$NON-NLS-1$
137 * Return the initial size of the dialog.
139 @Override
140 protected Point getInitialSize() {
141 return new Point(502, 290);