/** Initializes the dialog with values from the preferences */ public void initFromPreferences() { // Copy current JOSM preferences to update API url with the one used in this wizard Preferences copyPref = CustomConfigurator.clonePreferences(Main.pref); copyPref.put("osm-server-url", apiUrl); pnlFullyAutomaticAuthorisationUI.initFromPreferences(copyPref); pnlSemiAutomaticAuthorisationUI.initFromPreferences(copyPref); pnlManualAuthorisationUI.initFromPreferences(copyPref); }
/** * Builds the row with the action buttons * * @return panel with buttons */ protected JPanel buildButtonRow() { JPanel pnl = new JPanel(new FlowLayout(FlowLayout.CENTER)); AcceptAccessTokenAction actAcceptAccessToken = new AcceptAccessTokenAction(); pnlFullyAutomaticAuthorisationUI.addPropertyChangeListener(actAcceptAccessToken); pnlSemiAutomaticAuthorisationUI.addPropertyChangeListener(actAcceptAccessToken); pnlManualAuthorisationUI.addPropertyChangeListener(actAcceptAccessToken); pnl.add(new SideButton(actAcceptAccessToken)); pnl.add(new SideButton(new CancelAction())); pnl.add( new SideButton( new ContextSensitiveHelpAction(HelpUtil.ht("/Dialog/OAuthAuthorisationWizard")))); return pnl; }
/** * Refreshes the view of the authorisation panel, depending on the authorisation procedure * currently selected */ protected void refreshAuthorisationProcedurePanel() { AuthorizationProcedure procedure = (AuthorizationProcedure) cbAuthorisationProcedure.getSelectedItem(); switch (procedure) { case FULLY_AUTOMATIC: spAuthorisationProcedureUI.getViewport().setView(pnlFullyAutomaticAuthorisationUI); pnlFullyAutomaticAuthorisationUI.revalidate(); break; case SEMI_AUTOMATIC: spAuthorisationProcedureUI.getViewport().setView(pnlSemiAutomaticAuthorisationUI); pnlSemiAutomaticAuthorisationUI.revalidate(); break; case MANUALLY: spAuthorisationProcedureUI.getViewport().setView(pnlManualAuthorisationUI); pnlManualAuthorisationUI.revalidate(); break; } validate(); repaint(); }